Pjryan
Pjryan

Reputation: 249

Image segmentation for yolo

For a project I am using YOLO to detect phallusia (microbial organisms) that swim into focus in a video. The issue is that I have to train YOLO on my own data. The data needs to be segmented so I can isolate the phallusia. I am not sure how to properly segment/cut-out the phallusia to fit the format that YOLO needs. For example in the picture below I want YOLO to detect when a phallusia is in focus similar to the one I have boxed in red. Do I just cut-out that segment of the image and save it as its own image and feed to that to YOLO? Do all segmented images need to have the same dimensions? Not sure what I am doing and could use some guidance. In focus phallusia

Upvotes: 3

Views: 7768

Answers (3)

GianAnge
GianAnge

Reputation: 633

It looks like you need to start from basics, ok, no fear. I will try to suggest a simple route to start efficiently to use YOLO techniques. Luckly the web has a lot of examples.

  1. Understand WHAT is a YOLO method.
    Andrew NG's YOLO explanation is a good start, but only if you alread know what are classification and detection.
  2. Understand the YOLO Loss function, the heart of the algorithm.
    Check the paper YOLO itself, don't be scared. At page #2, in Unified Detection section, you will find the information about the bounding box detection used, but be aware that you can use whatever notation you want (even invent a new one), in order to be compatible with the Loss function, real meaning of this algorithm.
  3. Start to implement an example
    As I wrote above, there are plenty of examples. You can check this one if you are familiar with python and tensorflow. Inside it you will find a way to prepare the dataset, that is your target for this question, I think. In this case a tool named labelImg is used.

I hope it will be useful. Please share your code when it will be ready, I'm curious :). Good luck!

Upvotes: 4

Uziel
Uziel

Reputation: 41

Do I just cut-out that segment of the image and save it as its own image and feed to that to YOLO?

You need as much images as you can get of your microbial organism, in different sizes, positions, etc. It doesn't need to be the only thing on the image, but you need to know the <x> <y> <width> <height> position of it.

Do all segmented images need to have the same dimensions?

No, they can be of any size and Yolo adapts them. See the VOC dataset for examples of images Yolo is normally trained on. A couple examples; kitchen, dogs

Not sure what I am doing and could use some guidance.

My advice would be to follow the instructions for "Training YOLO on VOC" from the original Yolo website; https://pjreddie.com/darknet/yolo/

Once you have that working, you will have a better idea of the steeps you need to take.

Upvotes: 1

Zoltan Szabo
Zoltan Szabo

Reputation: 51

I had similar problems when I wanted to train YOLOv2 for some game cards. In order to solve the problem I took a picture from every game card with my cellphone and I cut out them. Because I didn't have enough training data I wrote a dataset generator program what generated the training data by using the photos from the cards. This program is able to multiply, rotate, scale the image then to place it on a background.

It can happen that you will have problems if you don't have enough learning data. In this case don't panic, because from several raw images by rotating and scaling you can generate a large dataset.

Here you can find my dataset generator, which is able to generate Pascal VOC style and darknet style training data: https://github.com/szaza/dataset-generator. Feel free to reuse it, if you need something similar.

Upvotes: 0

Related Questions