Skip to content
GitLab
Menu
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
feeb0bf1
Commit
feeb0bf1
authored
Sep 22, 2021
by
Pavlo Beylin
Browse files
Activate noise and brightness transformation.
parent
ab0bc76f
Changes
1
Hide whitespace changes
Inline
Side-by-side
patch_transformer.py
View file @
feeb0bf1
...
@@ -145,7 +145,7 @@ class PatchTransformer(nn.Module):
...
@@ -145,7 +145,7 @@ class PatchTransformer(nn.Module):
noise
=
torch
.
cuda
.
FloatTensor
(
adv_batch
.
size
()).
uniform_
(
-
1
,
1
)
*
self
.
noise_factor
noise
=
torch
.
cuda
.
FloatTensor
(
adv_batch
.
size
()).
uniform_
(
-
1
,
1
)
*
self
.
noise_factor
# Apply contrast/brightness/noise, clamp
# Apply contrast/brightness/noise, clamp
adv_batch
=
adv_batch
#
* contrast + brightness + noise
adv_batch
=
adv_batch
*
contrast
+
brightness
+
noise
adv_batch
=
torch
.
clamp
(
adv_batch
,
0.000001
,
0.99999
)
adv_batch
=
torch
.
clamp
(
adv_batch
,
0.000001
,
0.99999
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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