AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.66k stars 7.96k forks source link

Not labeling objects that are far from the camera #7118

Open Mike20001 opened 3 years ago

Mike20001 commented 3 years ago

I have a simple question that I wasn't able to find an answer to on google. Is it OK to train YOLO with incomplete labeled images?(I only labeled images that are close to the camera and ignored the objects that are further away)

Would this make my detector less accurate since it expects an object but then because there is no ground truth label it messes with its prediction?

CSTEZCAN commented 3 years ago

it will. https://youtu.be/j4Le5zx4KCU

divid3d commented 3 years ago

So does this means that every instance of the class visible in frame should be labeled?

CSTEZCAN commented 3 years ago

"yes"

panban-ux commented 3 years ago

Well your contribution is valuable, i'm on the same boat and a) i train apples with 2 classes bad or good but it can also detect as a test pomegranates and tomatoes. I only trained 35 images. What number can be considered adequate for training. Is it an issue whether i train apples and for a test purposes i fed it with pics of pomegranate or apples and get them as apples?.

b) How is it possible to eliminate the labeling after recognition and keep only the bounding boxes? I'm trying to figure why on labeling before training i have about 70 annotations on a single pic and after i run the detection it recognizes me more than 100. Does it lie to the point that i trained too little of a dataset or this is considered over fitting? I want to count them manualy on detection to see if its true. Over to that pic you can see left my results middle is the labelimg instance of that particular object and right is the output json of the populated recognition on that single image. Screenshot from 2020-12-21 16-33-09

stephanecharette commented 3 years ago

I only trained 35 images. What number can be considered adequate for training.

See: https://www.ccoderun.ca/programming/darknet_faq/#how_many_images

Is it an issue whether i train apples and for a test purposes i fed it with pics of pomegranate or apples and get them as apples?.

Normally you want your training images to be similar to your test images. If you want a network to recognize both pomegranate and apples, then you should have both in your training images.

b) How is it possible to eliminate the labeling after recognition and keep only the bounding boxes?

If you use DarkHelp you can do so with the --autohide true flag. (https://www.ccoderun.ca/darkhelp/api/Tool.html)

panban-ux commented 3 years ago

@stephanecharette Thank you Stephan for your inputs, really helpful to implement them.

Normally you want your training images to be similar to your test images. If you want a network to recognize both pomegranate and apples, then you should have both in your training

Sorry for my English, what i wanted to say its that i only train and test it for apples during the colab instance and the aim is to recognize only apples. If by then to test the robustness of the network i throw some pomegranates and tomatoes just for the sole purpose "proof of concept" it can recognize correctly the apples. But it doesn't as it recognizes similar in color and form objects. Maybe if i add more variability and add some negative images as it mention it for tackling it. By the way by negative it means to add for my needs lets say unbounded images of pomegranates and tomatoes just to avoid them?

stephanecharette commented 3 years ago

Look up "negative samples": https://www.ccoderun.ca/programming/darknet_faq/#image_markup

So if your training images includes tomatoes and pomegranates and you don't mark anything in those images, it will strengthen the network to learn specifically apples. Especially for custom networks like what you are building to recognize different apples, it is very important to have negative samples.

If you are recognizing apples based on colour (green vs red for example) then the other thing you should do is turn down the data augmentation values related to colour. For example, if you have classes for "red apple" and "green apple". The FAQ briefly mentions how to completely turn it off here: https://www.ccoderun.ca/programming/darknet_faq/#turn_off_data_augmentation ...but specifically, the ones you'd want to turn down (not necessarily off) if your classes are colour-based are hue, and possibly saturation: https://www.ccoderun.ca/darkmark/DataAugmentationColour.html

Lastly, if the "bad apples" are the ones on the ground vs the ones in the trees, then another option you may not have considered is to group all the ground ones together. This of course would only work if you're not expected to count them. So if you have a large group of apples on the ground, instead of marking each one, mark them all as a single very large object.

panban-ux commented 3 years ago

New perspectives i wasn't aware about: group labeling/annotating and the negative images along with data augmentation. Thanks again Stephane!!