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

Add general object detection estimator for PyTorch #1295

Merged
merged 9 commits into from
Sep 9, 2021

Conversation

beat-buesser
Copy link
Collaborator

Description

This pull request adds a general, model-independent, object detection estimator for PyTorch models in art.estimators.object_detection.PyTorchObjectDetector.

Fixes #1196

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

Signed-off-by: Beat Buesser <beat.buesser@ie.ibm.com>
@beat-buesser beat-buesser changed the base branch from main to dev_1.8.0 August 31, 2021 23:45
@beat-buesser beat-buesser self-assigned this Aug 31, 2021
@beat-buesser beat-buesser added the enhancement New feature or request label Aug 31, 2021
@beat-buesser beat-buesser added this to Pull request open in ART 1.8.0 via automation Aug 31, 2021
@beat-buesser beat-buesser added this to the ART 1.8.0 milestone Aug 31, 2021
@codecov-commenter
Copy link

codecov-commenter commented Aug 31, 2021

Codecov Report

Merging #1295 (173481f) into dev_1.8.0 (58839f7) will increase coverage by 0.43%.
The diff coverage is 60.57%.

Impacted file tree graph

@@              Coverage Diff              @@
##           dev_1.8.0    #1295      +/-   ##
=============================================
+ Coverage      80.90%   81.34%   +0.43%     
=============================================
  Files            226      227       +1     
  Lines          19284    19300      +16     
  Branches        3499     3502       +3     
=============================================
+ Hits           15602    15699      +97     
+ Misses          2379     2304      -75     
+ Partials        1303     1297       -6     
Impacted Files Coverage Δ
...ted_gradient_descent/projected_gradient_descent.py 94.44% <ø> (ø)
art/utils.py 74.08% <ø> (+10.70%) ⬆️
...imators/object_detection/python_object_detector.py 59.76% <59.76%> (ø)
...estimators/object_detection/pytorch_faster_rcnn.py 90.90% <80.00%> (+31.51%) ⬆️
art/estimators/object_detection/__init__.py 100.00% <100.00%> (ø)
art/attacks/evasion/brendel_bethge.py 84.93% <0.00%> (+0.32%) ⬆️
art/defences/detector/poison/activation_defence.py 85.18% <0.00%> (+0.33%) ⬆️
...rt/defences/detector/poison/clustering_analyzer.py 97.46% <0.00%> (+2.53%) ⬆️
art/estimators/poison_mitigation/strip/strip.py 77.08% <0.00%> (+4.16%) ⬆️
... and 4 more

@lgtm-com
Copy link

lgtm-com bot commented Sep 1, 2021

This pull request introduces 4 alerts and fixes 1 when merging 8f64dd3 into 07e18ee - view on LGTM.com

new alerts:

  • 2 for Module is imported more than once
  • 2 for Unused import

fixed alerts:

  • 1 for Module is imported more than once

@lgtm-com
Copy link

lgtm-com bot commented Sep 1, 2021

This pull request introduces 4 alerts and fixes 1 when merging 8f64dd3 into bb5b5c1 - view on LGTM.com

new alerts:

  • 2 for Module is imported more than once
  • 2 for Unused import

fixed alerts:

  • 1 for Module is imported more than once

Signed-off-by: Beat Buesser <beat.buesser@ie.ibm.com>
@lgtm-com
Copy link

lgtm-com bot commented Sep 1, 2021

This pull request introduces 2 alerts and fixes 1 when merging 5579ce6 into bb5b5c1 - view on LGTM.com

new alerts:

  • 2 for Module is imported more than once

fixed alerts:

  • 1 for Module is imported more than once

BEAT BUESSER added 2 commits September 1, 2021 23:40
Signed-off-by: Beat Buesser <beat.buesser@ie.ibm.com>
Signed-off-by: Beat Buesser <beat.buesser@ie.ibm.com>
@lgtm-com
Copy link

lgtm-com bot commented Sep 2, 2021

This pull request introduces 1 alert and fixes 3 when merging 66ce420 into bb5b5c1 - view on LGTM.com

new alerts:

  • 1 for Module is imported more than once

fixed alerts:

  • 3 for Module is imported more than once

Copy link
Collaborator

@GiulioZizzo GiulioZizzo left a comment

Choose a reason for hiding this comment

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

Hi Beat, thank you for the review and I have left a few comments!

return self._device

def _get_losses(
self, x: np.ndarray, y: Union[List[Dict[str, np.ndarray]], List[Dict[str, "torch.Tensor"]]]
Copy link
Collaborator

@GiulioZizzo GiulioZizzo Sep 8, 2021

Choose a reason for hiding this comment

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

does the type hint for x need to be updated as we check several times if x is either an array or a tensor? (similar for later hints as well)

Perhaps also the name and description could be updated as we do not compute the loss here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For now we don't support torch.Tensor for x and checked in line 182, but I agree with you for future releases.

art/estimators/object_detection/python_object_detector.py Outdated Show resolved Hide resolved
Beat Buesser and others added 3 commits September 8, 2021 13:36
Signed-off-by: Beat Buesser <beat.buesser@ie.ibm.com>
Signed-off-by: Beat Buesser <beat.buesser@ie.ibm.com>
@lgtm-com
Copy link

lgtm-com bot commented Sep 8, 2021

This pull request introduces 1 alert and fixes 3 when merging 8271c09 into 56a9fad - view on LGTM.com

new alerts:

  • 1 for Module is imported more than once

fixed alerts:

  • 3 for Module is imported more than once

@lgtm-com
Copy link

lgtm-com bot commented Sep 9, 2021

This pull request introduces 1 alert and fixes 3 when merging eb1f1cf into 58839f7 - view on LGTM.com

new alerts:

  • 1 for Module is imported more than once

fixed alerts:

  • 3 for Module is imported more than once

Signed-off-by: Beat Buesser <beat.buesser@ie.ibm.com>
@lgtm-com
Copy link

lgtm-com bot commented Sep 9, 2021

This pull request introduces 1 alert and fixes 3 when merging 173481f into 58839f7 - view on LGTM.com

new alerts:

  • 1 for Module is imported more than once

fixed alerts:

  • 3 for Module is imported more than once

@beat-buesser beat-buesser merged commit bc6aa61 into dev_1.8.0 Sep 9, 2021
ART 1.8.0 automation moved this from Pull request open to Pull request done Sep 9, 2021
@beat-buesser beat-buesser deleted the development_issue_1196 branch September 9, 2021 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
ART 1.8.0
  
Pull request done
Development

Successfully merging this pull request may close these issues.

General estimator for object detectors in PyTorch
3 participants