ZFTurbo / Weighted-Boxes-Fusion

Set of methods to ensemble boxes from different object detection models, including implementation of "Weighted boxes fusion (WBF)" method.
MIT License
1.7k stars 237 forks source link

confidence score > 1 issue #43

Open shanggdlk opened 2 years ago

shanggdlk commented 2 years ago
elif not allows_overflow:
                weighted_boxes[i][1] = weighted_boxes[i][1] * min(len(weights), len(clustered_boxes)) / weights.sum()

Hi there, I noticed this line of code indicating whether the confidence score is allowed to overflow 1 or not. However, I didn't get it. Suppose I have four models with weights: 0.5, 0.5, 0.5, 1. we thus have weights.sum=2.5

Let's say the current cluster have 5 boxes, then len(clustered_boxes)=5. Now we have min(len(weights), len(clustered_boxes)) = min(4,5)=4 > weights.sum()

Do weighted_boxes[i][1] will overflow... Did I misunderstand something here? Thanks!

ZFTurbo commented 2 years ago

As I remeber this was resolved here: https://github.com/ZFTurbo/Weighted-Boxes-Fusion/issues/38

In all experiments it was lower than 1.0. Please try to create counter example.