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
f0b70002
Unverified
Commit
f0b70002
authored
Feb 15, 2023
by
Philip Meier
Committed by
GitHub
Feb 15, 2023
Browse files
allow integer parameters in ColorJitter (#7255)
parent
1e19d73c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
torchvision/prototype/transforms/_color.py
torchvision/prototype/transforms/_color.py
+5
-3
No files found.
torchvision/prototype/transforms/_color.py
View file @
f0b70002
...
@@ -80,14 +80,16 @@ class ColorJitter(Transform):
...
@@ -80,14 +80,16 @@ class ColorJitter(Transform):
if
value
is
None
:
if
value
is
None
:
return
None
return
None
if
isinstance
(
value
,
float
):
if
isinstance
(
value
,
(
int
,
float
)
)
:
if
value
<
0
:
if
value
<
0
:
raise
ValueError
(
f
"If
{
name
}
is a single number, it must be non negative."
)
raise
ValueError
(
f
"If
{
name
}
is a single number, it must be non negative."
)
value
=
[
center
-
value
,
center
+
value
]
value
=
[
center
-
value
,
center
+
value
]
if
clip_first_on_zero
:
if
clip_first_on_zero
:
value
[
0
]
=
max
(
value
[
0
],
0.0
)
value
[
0
]
=
max
(
value
[
0
],
0.0
)
elif
not
(
isinstance
(
value
,
collections
.
abc
.
Sequence
)
and
len
(
value
)
==
2
):
elif
isinstance
(
value
,
collections
.
abc
.
Sequence
)
and
len
(
value
)
==
2
:
raise
TypeError
(
f
"
{
name
}
should be a single number or a sequence with length 2."
)
value
=
[
float
(
v
)
for
v
in
value
]
else
:
raise
TypeError
(
f
"
{
name
}
=
{
value
}
should be a single number or a sequence with length 2."
)
if
not
bound
[
0
]
<=
value
[
0
]
<=
value
[
1
]
<=
bound
[
1
]:
if
not
bound
[
0
]
<=
value
[
0
]
<=
value
[
1
]
<=
bound
[
1
]:
raise
ValueError
(
f
"
{
name
}
values should be between
{
bound
}
, but got
{
value
}
."
)
raise
ValueError
(
f
"
{
name
}
values should be between
{
bound
}
, but got
{
value
}
."
)
...
...
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