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] db loss TF and PT also for training with rotated samples #1396

Merged
merged 13 commits into from
Jan 16, 2024

Conversation

felixdittrich92
Copy link
Contributor

@felixdittrich92 felixdittrich92 commented Dec 1, 2023

This PR:

  • change DB loss from Balanced BCE to Focal loss
  • fix target building

Any feedback is welcome 🤗

Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (a48b72a) 95.76% compared to head (0375ee8) 95.76%.
Report is 1 commits behind head on main.

Files Patch % Lines
...s/detection/differentiable_binarization/pytorch.py 93.75% 1 Missing ⚠️
...etection/differentiable_binarization/tensorflow.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1396      +/-   ##
==========================================
- Coverage   95.76%   95.76%   -0.01%     
==========================================
  Files         155      155              
  Lines        6950     6941       -9     
==========================================
- Hits         6656     6647       -9     
  Misses        294      294              
Flag Coverage Δ
unittests 95.76% <95.83%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@felixdittrich92
Copy link
Contributor Author

@odulcy-mindee @charlesmindee Still some work in progress

target building needs to be checked again (especially for the shrunken masks) and the loss comp

@felixdittrich92
Copy link
Contributor Author

norm input:
input

seg_target:
seg_target

seg_mask: (should be empty / ones if there are no ignored polygons ?)
seg_mask

thresh_target:
thresh_target

thresh_mask:
thresh_mask

balanced_bce_loss = torch.zeros(1, device=out_map.device)
dice_loss = torch.zeros(1, device=out_map.device)
l1_loss = torch.zeros(1, device=out_map.device)

# TODO: Still in progress @Oliver @Charles
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loss comp is mostly borrowed from mmocr to see wht's going wrong (and because of missing time xD)

@felixdittrich92 felixdittrich92 changed the title [DRAFT] db loss [FIX] db loss TF and PT also for training with rotated samples Jan 16, 2024
@felixdittrich92 felixdittrich92 added this to the 0.8.0 milestone Jan 16, 2024
@felixdittrich92 felixdittrich92 added type: bug Something isn't working module: models Related to doctr.models framework: pytorch Related to PyTorch backend framework: tensorflow Related to TensorFlow backend topic: text detection Related to the task of text detection labels Jan 16, 2024
@felixdittrich92 felixdittrich92 self-assigned this Jan 16, 2024
@felixdittrich92 felixdittrich92 marked this pull request as ready for review January 16, 2024 08:39
@felixdittrich92
Copy link
Contributor Author

@odulcy-mindee I think that's also fine now :)

Copy link
Collaborator

@odulcy-mindee odulcy-mindee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @felixdittrich92 ! 🚀

@felixdittrich92 felixdittrich92 merged commit ff9982b into mindee:main Jan 16, 2024
66 of 67 checks passed
@felixdittrich92 felixdittrich92 deleted the db-loss branch January 16, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework: pytorch Related to PyTorch backend framework: tensorflow Related to TensorFlow backend module: models Related to doctr.models topic: text detection Related to the task of text detection type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants