Creating Semantic Segmentation Labels for the Training Data.

IMAGE / LABEL EXAMPLE AS MOTIVATION

IMAGE
LABEL

One of my Research Topics required some training data, which was not easily available publicly anywhere, and I decided to create a dataset of my own. After a lot of searching I found LabelMe to annotate and label the image.

What is LabelMe :

LabelMe is a tool which is written in Python to annotate an image.

Types of Annotation which can be done in LabelMe :

1. Classification
2. Detection
3. Semantic Segmentation
4. Instance Segmentation

Steps to Install and Run LabelMe :

  • It is always suggested to create a new Conda Environment for LabelMe.
    conda create -name labeme python=3.6
  • Activate the Environment.
    conda activate labelme
  • Installing the Labelme
    pip install labelme
  • Run Labelme
    labelme

Using LabelMe :

  • Once you start labelme by typing the labelme command you will see the below image.
LabelMe First Screen
  • Click on Open (Or Open Dir — If there are multiple images).
  • Select the Image you want to annotate.
  • Once the image is loaded on LabelMe, click on the Edit button on the Toolbar, this will give you various options to create a shape.
Options to Annotate
  • Start drawing the shape around the object you would like to annotate, use frequent clicks to create the vertices of a shape, and change the direction of the edge. (Note : If you are creating a Polygon, make sure your end point meets the first point)
  • Once you are done with creating the shape, a popup will appear, where you can enter the label (class) name.
Popup to enter the Label (Class) Name
  • Whenever you add a new Label, it will get added to the list, which you can select for multiclass segmentation.
  • Once done, click on save and enter the file name and save it. (The extension will be JSON always).
  • The JSON output file will have the ImagePath, the shape type, points, the class name and many more information.
  • Now either you can use the JSON output file directly to train the data (Based on your preprocessing), or convert the JSON into PNG file (Steps mentioned below).

Steps to convert the JSON output into PNG file :

  1. Open Anaconda Prompt again.
  2. Activate the LabelMe environment which you created to install LabelMe.
  3. Go to the path where the JSON file had been download.
  4. Run the below command (Replace your file names):
    labelme_json_to_dataset your_file_name.json -o output_file_name
  5. Once done, you will see some info and warning loggers on the command prompt, ending with Saved to : <output_file_name>
  6. Open the folder and you will see your input image with the label output image (Both in PNG format).

Credits goes to the LabelMe team and more information about LabelMe can be found here

HAPPY TRAINING!!!!

--

--

--

1 X Top Writer | Maps and Steel are underrated | Geospatial Developer | Data Science | Productivity | Discipline | GIS | Ex-EY | Ex-PwC | Wreck Diver |

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Build a Spam Classifier using the Naive Bayes Algorithm

OpenAI GPT-3: Language Models are Few-Shot Learners

Query And Content Understanding with Machine Learning — live knowledge sharing with Daniel…

Machine Learning is boosting eCommerce in 2020

NLP Classifying Positive and Negative Restaurant Reviews (Bag of Words model)

Chinese Zodiac Sign Classification Challenge with Pytorch

An Introduction to Random Forest with Python and scikit-learn

READ/DOWNLOAD#% Machine Learning With Random Fores

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aman Jain

Aman Jain

1 X Top Writer | Maps and Steel are underrated | Geospatial Developer | Data Science | Productivity | Discipline | GIS | Ex-EY | Ex-PwC | Wreck Diver |

More from Medium

Subsurface Salt Interpretation Automation — Enhancing ML workflow for semantic segmentation

Is L2-Norm = Euclidean Distance?

Simple Linear Regression from Scratch!

K Means Clustering for anomaly detection