YOLO Annotation Files for Already-Cropped Images

此生再无相见时 提交于 2021-02-20 05:15:06

问题


I'm attempting to create my own dataset for use with YOLO (You Only Look Once). Initially, I started with a large geotiff file that had pictures of landscape and animals. I was able to write a script to extract the images of the animals into separate files.

I'm now at a point where I'd like to use those animal images as part of a YOLO dataset. However, all of the examples I've seen online utilize annotation files, which denote the location of an object-to-be-detected within a larger image.

In my case, each animal picture in its entirety is what would be included within the bounding box. What can I do in this case?

Edit: What I mean to ask is this: Is it still possible for me to use these already-cropped images, and then note on the annotation file that the bounding box should cover the entire image?


回答1:


Simple answer : No. In case of object detection like Yolo, we want Yolo to identify which is object and which is non-object. When you create bounding box, Yolo will identify the bounding box as a positive object that belong to 1 class, and the part outside the bounding box is identified as non-object.

The model will try to learn how to distinguish between object and not, and how to draw the bounding box on exact coordinate (x,y,w,h) according to your training data annotation. In this case, Yolo uses anchor boxes concept, and Yolo will adjust the size of nearest anchor box to size of the predicted object.

When you create your custom training dataset, yolo need : annotated image with bounding box + bounding box coordinate that saved in text file, such as :

<object-class> <x_center> <y_center> <width> <height>

So you will need those information in order to train Yolo model.

Usually when you have already cropped dataset, I think it's more suitable for image classification task. Or if you were able to create script to distinguish animal from large image, why don't you automatically create bounding boxes annotation and yolo coordinate training text files for related images?




回答2:


As YOLO is an object detection tool and not an object classification tool, it requires uncropped images to understand objects as well as background.

In order to understand how YOLO sees dataset, have a look at this image

In this image, let’s say we need to annotate a car (class id-1), then the annotation would be done as-

<class id> <Xo/X> <Yo/Y> <W/X> <H/Y>

where, class id, label index of the class to be annotated
Xo, X coordinate of the bounding box’s center
Yo, Y coordinate of the bounding box’s center
W, Width of the bounding box
H, Height of the bounding box
X, Width of the image
Y, Height of the image

For more details on YOLO annotation, have a look at this medium post



来源:https://stackoverflow.com/questions/55248489/yolo-annotation-files-for-already-cropped-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!