Open andraugust opened 5 years ago
Hi @andraugust , therectically, yes. The background images will only provide negative samples. You just need to make sure there is at least one image with bounding boxes (positie samples) in every batch during training.
I succeed make the training support background images. you need modify hard_negative_mining
to support it.
How can we reduce the number of default boxes per feature map? can it be done by having single aspect ratio and size per map?
I succeed make the training support background images. you need modify
hard_negative_mining
to support it.
Could you be more specific?
@Barath19 we can do that. For that, u need to make changes in three files.
Following changes are with-respect-to SSD-Mobilenet-V2-Lite
1. ~\pytorchssd\vision\ssd\config\mobilenetv1_ssd_config.py If you see inside this file, there is a variable specs and it consists of four parameters, there is a last parameter which is basically a List, and this parameter is aspect ratio. Make this list with a single item of your desired aspect ratio. For example, u want an asapect ratio of 0.49, do it this way, SSDSpec(10, 32, SSDBoxSizes(105, 150), [ 0.490]). Similarly u need to change the last paramter as a single-item list of your desired aspect ratio for the rest 5 as well.
2. ~\pytorch-ssd\vision\utils\box_utils.py
Inside the function generate_ssd_priors, the author generates 2 square boxes + 2-variable-sized boxes of a given aspect ratio. In-order for your code to work, comment out the small box and bigger-box and one of the variable-sized box. Now you are left with just one anchor box.
3. ~pytorch-ssd\vision\ssd\mobilenet_v2_ssd_lite.py
In this file, there are two lists called classification_headers and regression_headers, inside these two, you see a lot of conv2d layers, and in the out_channels parameters, there is something like (64num_channels) for regression_headers and (61num_channels) for classification_headers. Replace the "6" with "1". Thats it.
Was there ever an answer to how to train on negative images?
Thanks for the great package!
Is it possible to train on images that don't have boxes in them?
I have several images without boxes that serve as background examples. I'd like the model to learn from these. I believe the dataloader is set up to only load images with boxes, is this true?