Open Guolin-Yin opened 2 months ago
Hello,
I've been looking into this as well, but am not officially involved with the project.
The weights are calculated with the following block of code in compute_class_weights.py
all_counts = sum(list(class_pixel_counts.values()))
n_classes = len(class_pixel_counts)
class_weights = {k: all_counts / (n_classes * v) for k, v in class_pixel_counts.items()}
all_counts
/ n_classes
yeilds the average number of counts per class.
Each class weight is then the average_count_per_class / count_per_class
This means that:
Dear authors,
Thanks for your amazing work, it helps me a lot.
However, I am wondering how the class weight was defined (quoted). I guess it could be related to the number of samples for each class in the dataset, but I am not sure. Please give me some hints on how it is computed.
https://github.com/Orion-AI-Lab/S4A-Models/blob/ae5a3761395cd259724516fa52a89879850558ab/utils/settings/config.py#L128