mvoelk / ssd_detectors

SSD-based object and text detection with Keras, SSD, DSOD, TextBoxes, SegLink, TextBoxes++, CRNN
MIT License
302 stars 85 forks source link

[Question] how to set Focal loss Parameters #14

Closed vkherde closed 5 years ago

vkherde commented 5 years ago

Hi @mvoelk

I am trying to use focal loss in SSD model, as per the code in DSOD_train.ipynb, lines

I want to understand how these parameters were calculated for "lamba_conf" and "class_weights" please confirm if you got a chance. Many thanks indeed

Best Regards Vaibhav

mvoelk commented 5 years ago

I did not spend much time on the DSOD model.

The value for lambda is probably much too high. I took this value only for some experiments. A value of 100.0, as I used it for the SegLink models, should work find. I will also change that in the code.

The class_weight values were calculated using compute_class_weights method in the PriorUtility. https://github.com/mvoelk/ssd_detectors/blob/3ef2c31dd6486a18940ec79f448f4f2e7d1c9df8/ssd_utils.py#L552-L561 Roughly speaking, they are the normalized inverse of the class frequencies in the local ground truth.

vkherde commented 5 years ago

Thanks for the explanation @mvoelk

mvoelk commented 5 years ago

Just in case someone reads it... #18 may also be relevant.