π Object Detection and Segmentation
In this example, we will create a simple pipeline that generates a dataset that we can use for objet detection. In particular, we are going to build a model that detects fruits. Additionally, we will also make sure to generate masks that we can use for segmentation task.
Initial dataset
Before we begin, we need to prepare some background. I am going to use some pictures of beautiful, sunny beaches. I have also prepares some images containing fruits. Both of these "datasets" were put in seperate directories.
Start the project
Now, open Rodina Flow. In case, you did not download it yet, check out the introduction.
Let's start by reading both the foreground and the background. You can do that by creating two Read Nodes and choosing appropraite directories.
Prepare the background
We are going to resize the background to 256 by 256 pixels as well as randomly change the hue of the iamge to introduce some more variance in the dataset.
Modify the foreground
Now, all we need to do it to apply some transformations on the foregrounds. We are going to apply a random perspective transformation.
Combine the images
Before putting the fruits on the beach background, we need to make sure they are the same size. We are going to add a border to the fruit image such that it fits the background size.
Now, we can stack two images on top of each other using the Stack Node.
Storing the results
For each sample we are going to save three files:
- Original image
- Bounding box with a YOLO format
- Image mask
We are going to do that using the Data Nodes.
Running the project
Simply click the RUN
button at the top of the window. You should see a loading bar that tracks the progress of data generation. The results are stored in a specified directory and are ready to be used for training of your
computer vision model.
Saving the project
You can save your project by navigating to File->Save As
in the application bar. If you want to reopen the project, simply navigate to File->Open
and select your project.