Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pavlo Beylin
MaD Patch Yolov5
Commits
ab0bc76f
Commit
ab0bc76f
authored
Sep 22, 2021
by
Pavlo Beylin
Browse files
Fix obfuscation position.
parent
9282a3ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
patch_transformer.py
View file @
ab0bc76f
...
...
@@ -109,9 +109,10 @@ class PatchTransformer(nn.Module):
if
obfuscate
:
max_x
=
adv_patch
.
shape
[
1
]
max_y
=
adv_patch
.
shape
[
2
]
obfuscation_root
=
[
int
(
random
.
random
()
*
max_x
),
int
(
random
.
random
()
*
max_y
)]
obfuscation_shape
=
[
int
(
random
.
random
()
*
max_obs_part
*
max_x
),
int
(
random
.
random
()
*
max_obs_part
*
max_y
)]
obfuscation_root
=
[
int
(
random
.
random
()
*
(
max_x
-
obfuscation_shape
[
0
])),
int
(
random
.
random
()
*
(
max_y
-
obfuscation_shape
[
1
]))]
adv_patch
[:,
obfuscation_root
[
0
]:
obfuscation_root
[
0
]
+
obfuscation_shape
[
0
],
obfuscation_root
[
1
]:
obfuscation_root
[
1
]
+
obfuscation_shape
[
1
]]
=
0.001
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment