Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
a7b66f03
Commit
a7b66f03
authored
Mar 02, 2018
by
vfdev
Committed by
Francisco Massa
Mar 02, 2018
Browse files
* Replace np.random by random (#354)
parent
3ce7ded3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
torchvision/transforms/transforms.py
torchvision/transforms/transforms.py
+6
-6
No files found.
torchvision/transforms/transforms.py
View file @
a7b66f03
...
...
@@ -700,22 +700,22 @@ class ColorJitter(object):
"""
transforms
=
[]
if
brightness
>
0
:
brightness_factor
=
np
.
random
.
uniform
(
max
(
0
,
1
-
brightness
),
1
+
brightness
)
brightness_factor
=
random
.
uniform
(
max
(
0
,
1
-
brightness
),
1
+
brightness
)
transforms
.
append
(
Lambda
(
lambda
img
:
F
.
adjust_brightness
(
img
,
brightness_factor
)))
if
contrast
>
0
:
contrast_factor
=
np
.
random
.
uniform
(
max
(
0
,
1
-
contrast
),
1
+
contrast
)
contrast_factor
=
random
.
uniform
(
max
(
0
,
1
-
contrast
),
1
+
contrast
)
transforms
.
append
(
Lambda
(
lambda
img
:
F
.
adjust_contrast
(
img
,
contrast_factor
)))
if
saturation
>
0
:
saturation_factor
=
np
.
random
.
uniform
(
max
(
0
,
1
-
saturation
),
1
+
saturation
)
saturation_factor
=
random
.
uniform
(
max
(
0
,
1
-
saturation
),
1
+
saturation
)
transforms
.
append
(
Lambda
(
lambda
img
:
F
.
adjust_saturation
(
img
,
saturation_factor
)))
if
hue
>
0
:
hue_factor
=
np
.
random
.
uniform
(
-
hue
,
hue
)
hue_factor
=
random
.
uniform
(
-
hue
,
hue
)
transforms
.
append
(
Lambda
(
lambda
img
:
F
.
adjust_hue
(
img
,
hue_factor
)))
np
.
random
.
shuffle
(
transforms
)
random
.
shuffle
(
transforms
)
transform
=
Compose
(
transforms
)
return
transform
...
...
@@ -782,7 +782,7 @@ class RandomRotation(object):
Returns:
sequence: params to be passed to ``rotate`` for random rotation.
"""
angle
=
np
.
random
.
uniform
(
degrees
[
0
],
degrees
[
1
])
angle
=
random
.
uniform
(
degrees
[
0
],
degrees
[
1
])
return
angle
...
...
Write
Preview
Markdown
is supported
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