Code Monkey home page Code Monkey logo

deep-learning-project-instance-segmentation's Introduction

Pet-Dataset-Instance-Segmentation

Oxford-IIIT Pet Dataset - Instance Segmentation

Table of contents


Notebooks

  1. Data analysis here.
  2. Convert a custom dataset to COCO format here.
  3. When making a custom dataset check if your data is compatible with the COCO format here.
  4. Create a config to train the model here.
  5. Demo training here.

Quick start

Nice virtualenv tutorial here

pip3 install --upgrade pip
which python3.8
mkvirtualenv -p <path to python3> <name>
workon <name>

For example:

mkvirtualenv -p /usr/bin/python3.8 Febrin
workon Febrin

Ensure that you have properly installed all the required packages:

  • CUDA 11.0
  • GCC 7.5
  • torch 1.7.1+cu110
  • torchvision 0.8.2+cu110
  • Comet ML 3.9.0
  • OpenCV: 4.1.2
  • MMCV: 1.3.1
  • MMDetection: 2.11.0+187774b

In our case we use torch 1.7.1 and Cuda 11.0

$ nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.102.04   Driver Version: 450.102.04   CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+

Install correct pytorch

pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

Install mmdetection with mmcv

rm -rf mmdetection
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -e .

So this is matching mmcv

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html

Download dataset and models

python download.py

Test Your own images

python inference.py image.jpg

image


General info

Our goal is to create an instance segmentation model based on the Oxford-IIIT Pet Dataset.

Instance segmentation is a task in Computer Vision that aims to identify each instance of each object within the image at the pixel level. In our case, each image contains a single object, which means our goal is to predict which pixels belong to the object and which to the background as well as predict the object's class.

Our dataset contains ~200 images for each from 37 classes.

image

Near 2/3 of those classes are dog breeds, the rest of them are cat breeds.

image

The images have different sizes and rations, therefore they need to be resized. There's a high variance in background colors and the amount of light on the pictures.

image

We will build our model using MMDetection - an open-source object detection toolbox based on PyTorch. We will experiment with different types of backbones, for example, ResNet, ResNext, or VGG.


Folder structure

├── /model                 - folder for keeping models
│   └── download_model.py  - script for downloading dataset
│
├── /trainer               - training scripts
│   └── train.py
|   └── test.py
│   
├──  /mains                - main files responsible for the whole pipeline
│    └── main.py 
|
├──  /figures              - figures generated during analysis and used in README
│    └── ...
│ 
├──  /notebooks            - notebook files created for tests on Colaboratory
│    ├── /Convert_to_COCO_format.ipynb
│    ├── /Create_config.ipynb
│    ├── /Demo training.ipynb
│    ├── /Demo.ipynb
│    ├── /Pycoco-test.ipynb
│    └── /Data_analysis.ipynb
| 
├──  /dataset              - things related to the dataset
│    ├── /train            - train datapoints and labels
│    ├── /test             - test datapoints and labels
│    ├── /valid            - valid datapoints and labels
│    └── divide_dataset.py - script that divides the dataset into /train/test/valid
│
└── /utils 
     ├── logger.py
     └── ...

Main Components


Comet.ml logger

This template also supports reporting to Comet.ml which allows you to see all your hyper-params, metrics, graphs, dependencies and more including real-time metric.

Here's how it looks after you start training:

image

You can also link your Github repository to your comet.ml project for full version control. Here's a live page showing the example from this repo


Status

Project started: 09.03.2021

  1. Week 1:

    • Created the repository
    • Analyzed the dataset
    • Investigated data storing options (GCS) and model training (GCP machine)
    • Created a Kanban board where we track the tasks and progress.
  2. Week 2:

    • Downloaded the data and created a dataloader
    • Started to familiarize ourselves with mmdet environment
    • Tested CometML and played with it
    • Created requirements.txt
  3. Week 3:

    • Created our own CometML logger hook and integrated it with their API
    • Created a proper DataLoader
    • Started writing a mmdet notebook that will transition to train.py soon
    • Read some papers i.e. Feature Pyramid Network
  4. Week 4:

  5. Week 5:

    • Moved our code from Colab files to Python scripts
    • Created Docerfile to be used as an environment created inside Colab

Project ended: 27.04.2021


Credits

deep-learning-project-instance-segmentation's People

Contributors

maciekdragula avatar matmarkiewicz avatar thefebrin avatar

Stargazers

 avatar  avatar

Watchers

 avatar

deep-learning-project-instance-segmentation's Issues

Welcome update to OpenMMLab 2.0

Welcome update to OpenMMLab 2.0

I am Vansin, the technical operator of OpenMMLab. In September of last year, we announced the release of OpenMMLab 2.0 at the World Artificial Intelligence Conference in Shanghai. We invite you to upgrade your algorithm library to OpenMMLab 2.0 using MMEngine, which can be used for both research and commercial purposes. If you have any questions, please feel free to join us on the OpenMMLab Discord at https://discord.gg/amFNsyUBvm or add me on WeChat (van-sin) and I will invite you to the OpenMMLab WeChat group.

Here are the OpenMMLab 2.0 repos branches:

OpenMMLab 1.0 branch OpenMMLab 2.0 branch
MMEngine 0.x
MMCV 1.x 2.x
MMDetection 0.x 、1.x、2.x 3.x
MMAction2 0.x 1.x
MMClassification 0.x 1.x
MMSegmentation 0.x 1.x
MMDetection3D 0.x 1.x
MMEditing 0.x 1.x
MMPose 0.x 1.x
MMDeploy 0.x 1.x
MMTracking 0.x 1.x
MMOCR 0.x 1.x
MMRazor 0.x 1.x
MMSelfSup 0.x 1.x
MMRotate 1.x 1.x
MMYOLO 0.x

Attention: please create a new virtual environment for OpenMMLab 2.0.

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.