scheckmedia / centernet-uda

This repository holds a small framework to evaluate unsupervised domain adaptation methods in combination with a CenterNet object detection network.
MIT License
26 stars 5 forks source link

num_classes = 1 will cause entropy map to break #2

Open hikrr opened 3 years ago

hikrr commented 3 years ago

num_classes in the CenterNet can don't have to include background class, so if I only have one class, num_classes should be set to 1. This will make the denominator log(1) => 0

https://github.com/scheckmedia/centernet-uda/blob/ea2f439a9015bd4d8094448425844955bcff4e0c/utils/image.py#L121-L124

twmht commented 3 years ago

@stagmoose

did you solve?

hikrr commented 3 years ago

@twmht I add a bg class in my annotation file and it worked.

scheckmedia commented 3 years ago

You can also add an epsilon for numerical stability like np.log2(c + 1) to the loss.