weiliu89 / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
4.77k stars 1.67k forks source link

Is it possible to add background images in the training set that do not have any classes? #146

Open abhisheksgumadi opened 8 years ago

abhisheksgumadi commented 8 years ago

Hi,

Is it possible to add images that are labeled as background (the background node in its annotation xml file) image and annotate the whole image as a bounding box as background in the training set?

I see that after I have trained the SSD to detect a particular kind of object (object v/s background 2 classes) it is throwing a lot of false positives on human faces (that do not contain my object).

So I want SSD to consider human faces as background images. Is it possible to somehow do this?

abhisheksgumadi commented 8 years ago

I was thinking of it is possible to include annotation files for additional background images and not include any nodes inside the annotation. In that case would the detector treat all detections as negative and thus learn to treat these additional images included in the training set as background images?

leosteets commented 8 years ago

I was wondering the same thing. Even with a threshold of 0.9 I'm still finding a lot of false positives.

I add some noise to the image in order to preserve the aspect ratio, I found that it increases the precision but it decreases the recall, maybe because I didn't use this technique on training, IDK.

Anyway if it is possible to train the model providing negative samples it would be great. Please let us know if it is possible.

weiliu89 commented 8 years ago

Currently, it only samples negatives from images which have ground truth annotation. It is possible to hack the multibox_loss_layer to also select negatives from images which do not have any ground truth (background images).

abhisheksgumadi commented 8 years ago

@weiliu89 can you please suggest what changes in the code is required? That would be of great help. I can make those changes, give it a try and report back my findings. Thanks.

gurkirt commented 7 years ago

Did anybody figured it out?

YvesSchoenberg commented 7 years ago

@weiliu89, could you please give us a pointer to the code where we can add this change? The multibox loss layer did change and #145 does not seem to apply anymore. Thanks.

weiliu89 commented 7 years ago

You can search MineHardNegative in the bbox_util.cpp

abhisheksgumadi commented 7 years ago

Hi Wei Liu,

Do you mean MineHardExamples function here? https://github.com/weiliu89/caffe/blob/ssd/src/caffe/util/bbox_util.cpp#L850

Thanks Abhishek S

Thank you!

With Regards, Abhishek S

On Thu, Feb 23, 2017 at 4:50 PM, Wei Liu notifications@github.com wrote:

You can search MineHardNegative in the bbox_util.cpp

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/weiliu89/caffe/issues/146#issuecomment-282050201, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-XJme-Oyka585g2AqUeGGOeedlEh5zks5rfbjfgaJpZM4Jtinr .

weiliu89 commented 7 years ago

Yes.

guoxiaolu commented 7 years ago

Is it possible to add some images with 'background' label, instead purely background image without any label? @weiliu89

sirluckyluke commented 7 years ago

@abhisheksgumadi : i am running in similar problems like you. Did you get your solution running?

MyVanitar commented 7 years ago

Anybody could solve this?