├── adversarial-patch-object-detection.ipynb └── readme.md /readme.md: -------------------------------------------------------------------------------- 1 | # On Physical Adversarial Patches for Object Detection 2 | 3 | Code for https://arxiv.org/pdf/1906.11897.pdf. 4 | 5 | Warning: this code is old and mainly experimental. 6 | 7 | The yolov3 implementation used is [here](https://github.com/eriklindernoren/PyTorch-YOLOv3/tree/96d02089fedb7dd3003997199ee5bdf6b38fcd02). The following diff should be applied to the yolov3 code in order to run properly: 8 | ``` 9 | diff --git a/models.py b/models.py 10 | index 1c9ba57..5a57b4c 100644 11 | --- a/models.py 12 | +++ b/models.py 13 | @@ -173,7 +173,13 @@ class YOLOLayer(nn.Module): 14 | 15 | nProposals = int((pred_conf > 0.5).sum().item()) 16 | recall = float(nCorrect / nGT) if nGT else 1 17 | - precision = float(nCorrect / nProposals) 18 | + # precision = float(nCorrect / nProposals) 19 | + if nProposals: 20 | + precision = float(nCorrect / nProposals) 21 | + elif nCorrect: 22 | + precision = 0 23 | + else: 24 | + precision = 1 25 | 26 | # Handle masks 27 | mask = Variable(mask.type(ByteTensor)) 28 | ``` 29 | --------------------------------------------------------------------------------