Code Monkey home page Code Monkey logo

custom-instance-segmentation's Introduction

Custom-Instance-Segmentation

Image Segmentation is an important field in computer vision, it is applied in different fields of life. PixelLib is a library created to allow easy application of segmentation to real life problems. Segmentation with coco model is limited as you cannot perform segmentation beyond the 80 classes available in coco.

It is now possible to train your custom objects’ segmentation model with PixelLib Library with just 7 Lines of Code.

Install PixelLib and its dependencies:

Install Tensorflow with:(PixelLib supports tensorflow 2.0 and above)

  1. pip install tensorflow

Install imgaug with:

  1. pip install imgaug

Install PixelLib with

  1. pip install pixellib

The steps required to train a custom model.

STEP1:

Prepare your dataset:

Our goal is to create a model that can perform instance segmentation and object detection on custom images. Collect images for the objects you want to detect and annotate your dataset for custom training. Labelme is the tool employed to perform polygon annotation of objects. Create a root directory or folder and within it create train and test folder. Separate the images required for training (a minimum of 300) and test. Put the images you want to use for training in the train folder and put the images you want to use for testing in the test folder. You will annotate both images in the train and test folder.

Image Annotation With Labelme

Labelme is one of the most convenient annotation tool for polygon annotation. This article explains how to use labelme for annotation of objects. Install labelme and its dependencies.

On Windows:

pip install pyqt5

pip install labelme

On Ubuntu 14.04 / Ubuntu 16.04:

sudo apt-get install python3-pyqt5

sudo pip3 install labelme

In your PC’s anaconda or command prompt just type labelme and labelme’s GUI will be displayed as a separate window.

1

In the GUI interface click on Open Dir, the second-left corner icon to open directory of the images you intend to annotate.

2

When you click on open Dir you can choose the folder containing the images.

It will show the first image in the folder you selected.

3

We intend to annotate the squirrel in this image, click on the create polygons, the seventh-left corner icon of the GUI interface. Drag your mouse to the object in the image.

4

Start annotating by moving the mouse round the object. Please take note of the starting point because we are going to close the polygon at the starting point. The annotation was started at the neck of the squirrel.

Finalize the annotation at the starting point i.e the neck of the squirrel(when you reached the starting point to join the polygon lines it will show this white circle). We finished the polygon annotation of the squirrel, we have to save it. You click the save icon(fifth-left corner icon) to save it.

5

It saved annotation in a json format. By default the json file is saved in the image name and in the same directory as the image. Do not alter the name of the saved json file and the directory in which it is saved.

Note: You should ensure that the images and the json files are saved in the same directory. The train images and json files generated by labelme must be in the same train folder. Do not store the json files in a separate folder and do not change the default name of the json’s file corresponding to the image name. The image and json’s file corresponding to it must have the same name. e.g image.jpg and image.json.

custom-instance-segmentation's People

Contributors

rammohanbethi avatar

Watchers

 avatar  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.