Skip to content

Multiple Issues with attack_adversarial_patch_pytorch_yolo.ipynb #2261

Answered by f4str
alexdevassy asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @alexdevassy thank you for pointing out these issues. I've investigated the and believe have found some answers.

Issue 1 - ART will try to reuse as much memory as possible to avoid making copies. PyTorch operations like x_tensor = torch.from_numpy(x) and x_tensor /= 255 will reuse the same memory as the numpy array. Therefore, when we resize the torch tensor from [0, 255] to [0, 1], it also resizes the original numpy array (since its the same internal memory). This is a bug that we'll fix. For now a temporary workaround create a copy before running predict:

- dets = detector.predict(coco_images)
+ dets = detector.predict(coco_images.copy())

Issue 2 - Our current implementation of YOLO …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@alexdevassy
Comment options

@beat-buesser
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by beat-buesser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2260 on August 28, 2023 11:11.