-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 #2321 Subclass PyTorchYolo and PyTorchDetectionTransformer off PyTorchObjectDetector #2371
Conversation
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Farhan Ahmed <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## dev_1.17.0 #2371 +/- ##
==============================================
- Coverage 85.35% 84.79% -0.57%
==============================================
Files 327 327
Lines 30622 29887 -735
Branches 5779 5526 -253
==============================================
- Hits 26138 25342 -796
- Misses 3043 3132 +89
+ Partials 1441 1413 -28
|
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
Signed-off-by: Beat Buesser <[email protected]>
# def test_errors(art_warning): | ||
# try: | ||
# from torch import hub | ||
# | ||
# from art.estimators.object_detection.pytorch_detection_transformer import PyTorchDetectionTransformer | ||
# | ||
# model = hub.load("facebookresearch/detr", "detr_resnet50", pretrained=True) | ||
# | ||
# with pytest.raises(ValueError): | ||
# PyTorchDetectionTransformer( | ||
# model=model, | ||
# clip_values=(1, 2), | ||
# attack_losses=("loss_ce", "loss_bbox", "loss_giou"), |
Check notice
Code scanning / CodeQL
Commented-out code Note test
# with pytest.raises(ValueError): | ||
# PyTorchDetectionTransformer( | ||
# model=model, | ||
# clip_values=(-1, 1), | ||
# attack_losses=("loss_ce", "loss_bbox", "loss_giou"), |
Check notice
Code scanning / CodeQL
Commented-out code Note test
# with pytest.raises(ValueError): | ||
# PyTorchDetectionTransformer( | ||
# model=model, | ||
# clip_values=(0, 1), | ||
# attack_losses=("loss_ce", "loss_bbox", "loss_giou"), | ||
# postprocessing_defences=post_def, |
Check notice
Code scanning / CodeQL
Commented-out code Note test
# except ARTTestException as e: | ||
# art_warning(e) |
Check notice
Code scanning / CodeQL
Commented-out code Note test
# def test_preprocessing_defences(art_warning, get_pytorch_detr): | ||
# try: | ||
# object_detector, x_test, _ = get_pytorch_detr | ||
# | ||
# from art.defences.preprocessor.spatial_smoothing_pytorch import SpatialSmoothingPyTorch | ||
# | ||
# pre_def = SpatialSmoothingPyTorch() | ||
# | ||
# object_detector.set_params(preprocessing_defences=pre_def) | ||
# | ||
# # Create labels | ||
# result = object_detector.predict(x=x_test) | ||
# | ||
# y = [ |
Check notice
Code scanning / CodeQL
Commented-out code Note test
# except ARTTestException as e: | ||
# art_warning(e) |
Check notice
Code scanning / CodeQL
Commented-out code Note test
# def test_compute_losses(art_warning, get_pytorch_detr): | ||
# try: | ||
# object_detector, x_test, y_test = get_pytorch_detr | ||
# losses = object_detector.compute_losses(x=x_test, y=y_test) | ||
# assert len(losses) == 3 | ||
# | ||
# except ARTTestException as e: | ||
# art_warning(e) |
Check notice
Code scanning / CodeQL
Commented-out code Note test
# def test_compute_loss(art_warning, get_pytorch_detr): | ||
# try: | ||
# object_detector, x_test, y_test = get_pytorch_detr | ||
# | ||
# # Compute loss | ||
# loss = object_detector.compute_loss(x=x_test, y=y_test) | ||
# | ||
# assert pytest.approx(6.7767677, abs=0.1) == float(loss) | ||
# | ||
# except ARTTestException as e: | ||
# art_warning(e) |
Check notice
Code scanning / CodeQL
Commented-out code Note test
# def test_pgd(art_warning, get_pytorch_detr): | ||
# try: | ||
# from art.attacks.evasion import ProjectedGradientDescent | ||
# | ||
# object_detector, x_test, y_test = get_pytorch_detr | ||
# | ||
# attack = ProjectedGradientDescent(estimator=object_detector, max_iter=2) | ||
# x_test_adv = attack.generate(x=x_test, y=y_test) | ||
# np.testing.assert_raises(AssertionError, np.testing.assert_array_equal, x_test_adv, x_test) | ||
# | ||
# except ARTTestException as e: | ||
# art_warning(e) |
Check notice
Code scanning / CodeQL
Commented-out code Note test
@beat-buesser PR #2321 should now be fixed. It's also been rebased to the |
fixed by #2321 |
Description
This pull request continues #2321 and fixes the failing unit tests.