Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
0db4e3df
Commit
0db4e3df
authored
Sep 15, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct rounding in resize
parent
30248bcf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
tensorpack/dataflow/imgaug/misc.py
tensorpack/dataflow/imgaug/misc.py
+5
-5
No files found.
tensorpack/dataflow/imgaug/misc.py
View file @
0db4e3df
...
@@ -96,9 +96,9 @@ class ResizeShortestEdge(TransformAugmentorBase):
...
@@ -96,9 +96,9 @@ class ResizeShortestEdge(TransformAugmentorBase):
h
,
w
=
img
.
shape
[:
2
]
h
,
w
=
img
.
shape
[:
2
]
scale
=
self
.
size
*
1.0
/
min
(
h
,
w
)
scale
=
self
.
size
*
1.0
/
min
(
h
,
w
)
if
h
<
w
:
if
h
<
w
:
newh
,
neww
=
self
.
size
,
int
(
scale
*
w
)
newh
,
neww
=
self
.
size
,
int
(
scale
*
w
+
0.5
)
else
:
else
:
newh
,
neww
=
int
(
scale
*
h
),
self
.
size
newh
,
neww
=
int
(
scale
*
h
+
0.5
),
self
.
size
return
ResizeTransform
(
return
ResizeTransform
(
h
,
w
,
newh
,
neww
,
self
.
interp
)
h
,
w
,
newh
,
neww
,
self
.
interp
)
...
@@ -144,14 +144,14 @@ class RandomResize(TransformAugmentorBase):
...
@@ -144,14 +144,14 @@ class RandomResize(TransformAugmentorBase):
destX
=
max
(
sx
*
w
,
self
.
minimum
[
0
])
destX
=
max
(
sx
*
w
,
self
.
minimum
[
0
])
destY
=
max
(
sy
*
h
,
self
.
minimum
[
1
])
destY
=
max
(
sy
*
h
,
self
.
minimum
[
1
])
else
:
else
:
sx
=
int
(
self
.
_rand_range
(
*
self
.
xrange
)
)
sx
=
self
.
_rand_range
(
*
self
.
xrange
)
if
self
.
aspect_ratio_thres
==
0
:
if
self
.
aspect_ratio_thres
==
0
:
sy
=
sx
*
1.0
/
w
*
h
sy
=
sx
*
1.0
/
w
*
h
else
:
else
:
sy
=
self
.
_rand_range
(
*
self
.
yrange
)
sy
=
self
.
_rand_range
(
*
self
.
yrange
)
destX
=
max
(
sx
,
self
.
minimum
[
0
])
destX
=
max
(
sx
,
self
.
minimum
[
0
])
destY
=
max
(
sy
,
self
.
minimum
[
1
])
destY
=
max
(
sy
,
self
.
minimum
[
1
])
return
(
destX
,
destY
)
return
(
int
(
destX
+
0.5
),
int
(
destY
+
0.5
)
)
while
True
:
while
True
:
destX
,
destY
=
get_dest_size
()
destX
,
destY
=
get_dest_size
()
...
@@ -165,7 +165,7 @@ class RandomResize(TransformAugmentorBase):
...
@@ -165,7 +165,7 @@ class RandomResize(TransformAugmentorBase):
logger
.
warn
(
"RandomResize failed to augment an image"
)
logger
.
warn
(
"RandomResize failed to augment an image"
)
return
ResizeTransform
(
h
,
w
,
h
,
w
,
self
.
interp
)
return
ResizeTransform
(
h
,
w
,
h
,
w
,
self
.
interp
)
continue
continue
return
ResizeTransform
(
h
,
w
,
int
(
destY
),
int
(
destX
)
,
self
.
interp
)
return
ResizeTransform
(
h
,
w
,
destY
,
destX
,
self
.
interp
)
class
Transpose
(
ImageAugmentor
):
class
Transpose
(
ImageAugmentor
):
...
...
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