darknet icon indicating copy to clipboard operation
darknet copied to clipboard

how to use the images contains no objects?

Open liyheart opened this issue 7 years ago • 8 comments

In my setting, there are some images contain some persons and some images no persons(background images). how can i use all of them for training the yolo? Should I add empty txt files for the background images?

liyheart avatar Jun 21 '18 08:06 liyheart

Should I add empty txt files for the background images?

Yes.

https://github.com/AlexeyAB/darknet#how-to-improve-object-detection

desirable that your training dataset include images with non-labeled objects that you do not want to detect - negative samples without bounded box (empty .txt files) - use as many images of negative samples as there are images with objects

AlexeyAB avatar Jun 21 '18 10:06 AlexeyAB

Should i give background images as an another class? For example, if i want to detect cars, i should have a bunch of images with car with label 1. But when i add background images, should i create only empty file and configure my yolo_voc.cfg file's class value as a 1 or 2?

For example; because of i have 1 class, my file consists; classes=1 and filters=30. But did i do classes=2 and filters=35. (i'm talking about Yolov2)

Thank you @AlexeyAB

ErolCitak avatar Jan 25 '19 16:01 ErolCitak

Should i give background images as an another class? For example, if i want to detect cars, i should have a bunch of images with car with label 1. But when i add background images, should i create only empty file and configure my yolo_voc.cfg file's class value as a 1 or 2?

For example; because of i have 1 class, my file consists; classes=1 and filters=30. But did i do classes=2 and filters=35. (i'm talking about Yolov2)

Thank you @AlexeyAB

how did you deal with it? I also met this problem.

Chida15 avatar Aug 04 '19 02:08 Chida15

Do we have to add the negative image paths to the train.txt file?

dasmehdix avatar Aug 06 '19 11:08 dasmehdix

Do we have to add the negative image paths to the train.txt file?

Yes, you are supposed to add it to your train.txt

Chida15 avatar Aug 06 '19 12:08 Chida15

How does yolo use these empty labels to calculate loss? One told me that these empty labels will be coded as a point [0,0,0,0,1] in background. But I`m confused about that.

ducheng678 avatar Aug 26 '19 08:08 ducheng678

Dear all, can the negative images be added to both train.txt and valid.txt? Thanks!

nathnim avatar Apr 01 '20 05:04 nathnim

Dear all, can the negative images be added to both train.txt and valid.txt? Thanks!

yes. that's what i do.

robisen1 avatar Aug 06 '20 21:08 robisen1