Giter VIP home page Giter VIP logo

pytorch-unet-segmentation's Introduction

Unet segmentation

This repository contains the resources needed for semantic segmentation using Unet for Pytorch.

Setting environment up

Make sure conda >=4.8.3 is installed in your system. Then, type:

conda env create -f unet_segmentation/environment.yml
conda env activate unet

Training

First of all, we need to ensure we have data to train on. We can generate fashion data through the Deep Fashion 2 dataset by following the instructions in the dataset directory.

Once your dataset is generated and your environment is active, you can type:

python unet_segmentation/trainer.py

This script assumes your dataset is located in segmentation_dataset and will start logging Tensorboard data into logs.

You can visualize this data by typing:

tensorboard --logdir=logs

You will be able to visualize the following:

Metrics in Tensorboard Predicted and groundtruth masks in Tensorboard

Pre-trained model

A pre-trained model (Mean IOU 0.63) is available here.

Given model weights are in unet.pt, you can predict mask on example example.png by:

import torch
from unet_segmentation.prediction.display import display_prediction

model = torch.load('unet.pt')
display_prediction(model, 'example.png')

Future work

  • Add test evaluation for generated models.
  • Argument parsing in trainer script (as parameters are hard-coded in the trainer script).
  • Port code to Pytorch Ignite.
  • Generate masks in a GAN-fashion.
  • Explore using trained model for clothing retrieval.

pytorch-unet-segmentation's People

Contributors

danielmoradc avatar dani-mora avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.