What Importance Do Machiavelli and Calvin Give to the Concept of Human Liberty?

Human libery might be the most discussed issue throughout the history. Politicians, priests, prophets, economists, and many other people from different backgrounds had thought about what human…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to use DeepLab in TensorFlow for object segmentation using Deep Learning

Modifying the DeepLab code to train on your own dataset for object segmentation in images

In this article, I will be sharing how we can train a DeepLab semantic segmentation model for our own data-set in TensorFlow. But before we begin…

Before you create your own dataset and train DeepLab, you should be very clear about what you want to want to do with it. Here are the two scenarios:

Let us name your new dataset as “PQR”. Create a new folder “PQR” as: tensorflow/models/research/deeplab/datasets/PQR.

To start, all you need is input images and their pre-segmented images as ground-truth for training. Input images need to be color images and the segmented images need to be color indexed images. Refer to the PASCAL dataset.

Create a folder named “dataset” inside “PQR”. It should have the following directory structure:

It contains all the input color images in *.jpg format.

A sample input image from PASCAL VOC dataset

This folder contains all the semantic segmentation annotations images for each of the color input images, which is the ground truth for the semantic segmentation.

These images should be color indexed. Each color index represents a unique class (with unique color) known as a color map.

Note: Files in the “SegmentationClass” folder should have the same name as in the “JPEGImage” folder for corresponding image-segmentation file pair.

A sample semantic segmentation ground truth image from PASCAL VOC dataset

This folder contains:

Sample *.txt file looks something like this:

If your segmentation annotation images are RGB images instead of color indexed images. Here is a Python script that will be of help.

The converted dataset will be saved at ./deeplab/datasets/PQR/tfrecord

Make the following changes as shown bellow:

In order to train the model on your dataset, you need to run the train.py file in the research/deeplab/ folder. So, we have written a script file train-pqr.sh to do the task for you.

Finally, run the above script from the …/research/deeplab directory.

Voilà! You have successfully trained DeepLab on your dataset.

In the coming months, I will be sharing more of my experiences with Images & Deep Learning. Stay tuned and don’t forget to spare some claps if you like this article. It will encourage me immensely.

Add a comment

Related posts:

Best React Scheduler Component Libraries

React has become popular for building user interfaces in web development due to its component-based architecture and robust ecosystem. When it comes to scheduling and managing time-related tasks…

Reasons Why the Future of Work Is Remote

It is no news that remote working (not necessarily working from home but working anywhere besides the traditional office) is the future of work. Before now it seemed like one of the waves of the…

Scientists found something different in the brains of bullies

Bulling is a shameful side of society that is still present on a large scale. Studies show that one out of every five people is a victim of bullying. An international team of neuroscientists recently…