Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: [email protected]
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Take our 85+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Publication

Create a Dataset for Object Detection
Latest   Machine Learning

Create a Dataset for Object Detection

Last Updated on July 24, 2023 by Editorial Team

Author(s): Pushkar Pushp

Originally published on Towards AI.

Computer Vision

Create a Dataset for Object Detection

Source: Unsplash

Introduction

The first step for most computer vision tasks such as classification, segmentation, or detection is to have custom data for your problem set. There are multiple ways of creating labeled data; one such method is annotations.

The annotation technique manually creates regions in an image and assign a label.

Now to keep things simple, we will be using two tools Pixel Annotation tool and Microsoft VoTT. You can read more about this tool, Pixel and Microsoft VoTT.

Pixel Annotation Tools

Installation for macOS.

git clone https://github.com/abreheret/PixelAnnotationTool

Then update brew using brew update.

Next, you need to install a cross-platform application development framework such as qt.

brew install qt

Pixel Annotation tool uses a watershed algorithm to do image segmentation.

Readers can use this link to read more about the watershed algorithm in detail.

brew install opencv

In Mac curl is already installed, you can check it by using typing curl -V in the terminal.

Something like this will appear, else install curl using brew.

brew install curl

Pixel Annotation tool does not come up with a .dmg file or a Graphic interface, so you need to transform source code to a stand-alone form via build.

cd PixelAnnotationTool

Inside this directory create the build

mkdir build
cd build

Next, inside build use the following command:

cmake .. -DCMAKE_BUILD_TYPE=$CONFIG -DDISABLE_MAINTAINER_CFLAGS=off -DCMAKE_PREFIX_PATH=$(brew --prefix qt) -DQMAKE_PATH=$(brew --prefix qt)/bin

Finally,

cmake --build .

We are all set to run and use the Pixel Annotation tool.

Go to the spotlight and search for the Pixel Annotation tool.

Pixel Annotation Tool

Creating a Dataset.

Go to the File option at the top left and select Open a directory.

On the top right, see all file names.

Select one image, say β€˜Sachin.jpg.’

Go to the color panel on the left side and select any color, let me set the sky.

Move your cursor around the person (Sachin).

Then select another color say β€˜out of roi’ and move the cursor around the entire region except for a person.

Then click on the watershed option at the bottom left and press Command + S to save the image.

Finally, you will get this mask.

Result

Input

Output

This mask serves as input for any object detection model.

Microsoft Visual Object Tagging Tool (VoTT)

Installation for macOS.

Unlike Pixel Annotation Tools, VoTT comes with Disk Image(dmg) file.

Tool Appears like this.
  • Click on New Project
  • Fill Display Name, say Cricketers in my case.
  • Add Source Connection, click on that a screen will pop up like
  • In Provider, select Local File System if your file to annotate is on the Laptop.
  • Select the folder where the images are and click on β€œSave Connection.”
  • Once saved, something like below will appear, from source connection drop-down select β€˜Cricketers,’ which we have created.
  • Next, go to the target connection and add a connection.

Same as source, for target select Cricketers_annotations.

  • At the bottom, there will be Tags.

Enter the label you want, cricketers in our case.

  • Save Project

A screen similar to this will appear.

  • In the left panel, you will see an arrow mark (fourth row ), click on that below screen will appear.

From the Provider drop-down menu, select Pascal VOC and enter β€œSave Export Settings.”

Create a box around the player and select tag from right, then save it from the save option at the top.

  • Repeat this process for all images in the folder. Once done, we need to export the output.
  • At the top of the image, there is an Export project option.

Once exported, go to that folder.

In this blog, we learned how to create a dataset for object detection and segmentation. Next, I will walk through the conversion of this mask into polygon co-ordinates, annotations.

A directory Cricketers-PascalVOC-export creates at the target location provided earlier.

Enjoy!

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming aΒ sponsor.

Published via Towards AI

Feedback ↓