Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cls bias init #5520

Merged
merged 2 commits into from
Nov 5, 2021
Merged

Update cls bias init #5520

merged 2 commits into from
Nov 5, 2021

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Nov 5, 2021

Increased numerical precision. Returns 1.0 probability for single-class datasets now. Addresses #5357

torch.sigmoid(torch.tensor([math.log(0.6 / (1 - 0.999999))]))
Out[19]: tensor([1.0000])

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Adjusted initial bias in YOLO object detection model.

πŸ“Š Key Changes

  • Modified the calculation for class probability bias initialization in the object detection layer.

🎯 Purpose & Impact

  • 🎯 Purpose: To fine-tune the initial bias calculation for better stability in class prediction, preventing overconfidence in the less frequent classes.
  • πŸ’₯ Impact: Should slightly improve the robustness and performance of the model, particularly in datasets with class imbalance. Users may notice better class probability estimates during training and inference.

Increased numerical precision. Returns 1.0 probability for single-class datasets now. Addresses #5357

```python
torch.sigmoid(torch.tensor([math.log(0.6 / (1 - 0.99999))]))
Out[19]: tensor([1.0000])
```
@glenn-jocher glenn-jocher linked an issue Nov 5, 2021 that may be closed by this pull request
@glenn-jocher glenn-jocher merged commit bfacfc6 into master Nov 5, 2021
@glenn-jocher glenn-jocher deleted the update/cls_bias branch November 5, 2021 12:18
@glenn-jocher glenn-jocher self-assigned this Nov 5, 2021
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* Update cls bias init

Increased numerical precision. Returns 1.0 probability for single-class datasets now. Addresses ultralytics#5357

```python
torch.sigmoid(torch.tensor([math.log(0.6 / (1 - 0.99999))]))
Out[19]: tensor([1.0000])
```

* Update yolo.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Single class inference, class score is still 0.98 but not 1
1 participant