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
3ed48310
Commit
3ed48310
authored
Jan 02, 2017
by
Soumith Chintala
Committed by
GitHub
Jan 02, 2017
Browse files
Merge pull request #21 from pytorch/float
Fixes for inconsistency between / in Python 2 and 3
parents
5c39840c
0786baec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
torchvision/transforms.py
torchvision/transforms.py
+4
-4
No files found.
torchvision/transforms.py
View file @
3ed48310
...
@@ -111,8 +111,8 @@ class CenterCrop(object):
...
@@ -111,8 +111,8 @@ class CenterCrop(object):
def
__call__
(
self
,
img
):
def
__call__
(
self
,
img
):
w
,
h
=
img
.
size
w
,
h
=
img
.
size
th
,
tw
=
self
.
size
th
,
tw
=
self
.
size
x1
=
int
(
round
((
w
-
tw
)
/
2
))
x1
=
int
(
round
((
w
-
tw
)
/
2
.
))
y1
=
int
(
round
((
h
-
th
)
/
2
))
y1
=
int
(
round
((
h
-
th
)
/
2
.
))
return
img
.
crop
((
x1
,
y1
,
x1
+
tw
,
y1
+
th
))
return
img
.
crop
((
x1
,
y1
,
x1
+
tw
,
y1
+
th
))
...
@@ -187,7 +187,7 @@ class RandomSizedCrop(object):
...
@@ -187,7 +187,7 @@ class RandomSizedCrop(object):
for
attempt
in
range
(
10
):
for
attempt
in
range
(
10
):
area
=
img
.
size
[
0
]
*
img
.
size
[
1
]
area
=
img
.
size
[
0
]
*
img
.
size
[
1
]
target_area
=
random
.
uniform
(
0.08
,
1.0
)
*
area
target_area
=
random
.
uniform
(
0.08
,
1.0
)
*
area
aspect_ratio
=
random
.
uniform
(
3
/
4
,
4
/
3
)
aspect_ratio
=
random
.
uniform
(
3
.
/
4
,
4
.
/
3
)
w
=
int
(
round
(
math
.
sqrt
(
target_area
*
aspect_ratio
)))
w
=
int
(
round
(
math
.
sqrt
(
target_area
*
aspect_ratio
)))
h
=
int
(
round
(
math
.
sqrt
(
target_area
/
aspect_ratio
)))
h
=
int
(
round
(
math
.
sqrt
(
target_area
/
aspect_ratio
)))
...
...
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