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

Fix FOMO head #152

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Fix FOMO head #152

wants to merge 6 commits into from

Conversation

JSabadin
Copy link
Contributor

@JSabadin JSabadin commented Jan 16, 2025

FOMO Model Updates and Improvements

The FOMO model, with its very simple architecture, can sometimes cause issues in object detection tasks. These issues have been addressed in this pull request.

Identified Issue: Multiple Predictions Per Object

In its default configuration, the model occasionally predicts multiple points for each object. This behavior can be mitigated by:

  1. Reducing the Loss Weight: Lowering the weight applied to object centers in the loss function significantly reduces the likelihood of multiple predictions.
  2. Applying Non-Maximum Suppression (NMS): If adjusting the loss weight does not fully resolve the issue, the model includes an optional, simple, and fast NMS (Non-Maximum Suppression) step to filter redundant predictions.

Demonstration of Results

The following images illustrate the model's performance under different configurations:

  1. Before Adjustment (Loss Weight: 1000, No NMS):
    The model predicts multiple points for each object.

    Before Adjustment
  2. After Adjustment 1 (Loss Weight: 500, With NMS):
    The model's predictions are improved with fewer redundant points, thanks to a combination of reduced loss weight and NMS.

    After Adjustment 1
  3. After Adjustment 2 (Loss Weight: 5, No NMS):
    A significantly lower loss weight further simplifies the predictions, even without applying NMS.

    After Adjustment 2

Validation Loss for Larger Objects

One remaining issue with this simple model is that the validation loss can rise for larger objects. This occurs because, in the initial training stages, the model tends to make uncertain and excessive predictions. For example:

  • Initial State: The model predicts numerous uncertain points for each object.
    Initial Predictions

  • After a Few Epochs: The model gradually learns to identify the centers of objects but can still occasionally misplace them due to the inherent difficulty in defining the "correct" center in the labels.
    Refined Predictions

This behavior is important to keep in mind when using this model, especially for datasets with larger or irregularly shaped objects.


@JSabadin JSabadin requested a review from a team as a code owner January 16, 2025 07:23
@JSabadin JSabadin requested review from kozlov721, klemen1999, tersekmatija and conorsim and removed request for a team January 16, 2025 07:23
@github-actions github-actions bot added documentation Improvements or additions to documentation fix Fixing a bug labels Jan 16, 2025
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 69.23077% with 8 lines in your changes missing coverage. Please review.

Project coverage is 94.91%. Comparing base (631b905) to head (2ceacc5).
Report is 29 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
luxonis_train/nodes/heads/fomo_head.py 65.21% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #152      +/-   ##
==========================================
- Coverage   96.31%   94.91%   -1.41%     
==========================================
  Files         147      170      +23     
  Lines        6304     7539    +1235     
==========================================
+ Hits         6072     7156    +1084     
- Misses        232      383     +151     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kozlov721 kozlov721 changed the title Fix/fomo head Fix FOMO head Jan 16, 2025
@JSabadin JSabadin requested a review from klemen1999 January 16, 2025 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation fix Fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants