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 PytorchObjectDetector Loss Gradient Bug #2238

Merged
merged 3 commits into from
Aug 14, 2023

Conversation

f4str
Copy link
Collaborator

@f4str f4str commented Aug 9, 2023

Description

Add the missing if-condition when setting gradients in the PyTorchObjectDetector estimator such that loss gradients can be properly calculated. This if-condition is copied from PyTorchYolo.

Fixes #2237

Type of change

Please check all relevant options.

  • Improvement (non-breaking)
  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing

Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.

  • Tests for PyTorchObjectDetector are unchanged
  • Tests for PyTorchFasterRCNN are unchanged

Test Configuration:

  • OS
  • Python version
  • ART version or commit number
  • TensorFlow / Keras / PyTorch / MXNet version

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: Farhan Ahmed <Farhan.Ahmed@ibm.com>
@f4str f4str changed the title FIx PytorchObjectDetector loss gradient bug FIx PytorchObjectDetector Loss Gradient Bug Aug 9, 2023
@codecov-commenter
Copy link

codecov-commenter commented Aug 9, 2023

Codecov Report

Merging #2238 (37628a6) into dev_1.15.1 (c7f0a4a) will decrease coverage by 0.01%.
The diff coverage is 33.33%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Impacted file tree graph

@@              Coverage Diff               @@
##           dev_1.15.1    #2238      +/-   ##
==============================================
- Coverage       85.62%   85.61%   -0.01%     
==============================================
  Files             308      308              
  Lines           27448    27450       +2     
  Branches         5044     5045       +1     
==============================================
  Hits            23502    23502              
- Misses           2667     2668       +1     
- Partials         1279     1280       +1     
Files Changed Coverage Δ
...mators/object_detection/pytorch_object_detector.py 85.54% <33.33%> (-1.01%) ⬇️

@beat-buesser beat-buesser self-requested a review August 10, 2023 11:10
@beat-buesser beat-buesser self-assigned this Aug 10, 2023
@beat-buesser beat-buesser added bug Something isn't working improvement Improve implementation labels Aug 10, 2023
@beat-buesser beat-buesser added this to the ART 1.15.1 milestone Aug 10, 2023
@beat-buesser beat-buesser linked an issue Aug 10, 2023 that may be closed by this pull request
Copy link
Collaborator

@beat-buesser beat-buesser left a comment

Choose a reason for hiding this comment

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

Hi @f4str Thank you very much for fixing this bug! The changes look good to me.

@beat-buesser beat-buesser merged commit c6da8c4 into Trusted-AI:dev_1.15.1 Aug 14, 2023
37 checks passed
@f4str f4str deleted the pytorch-object-detector-fix branch August 14, 2023 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement Improve implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adversarial Patch Error in PyTorchObjectDetector
3 participants