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
5b7d5106
Commit
5b7d5106
authored
Feb 05, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more logs/checks for RandomResize
parent
271ffad1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
examples/FasterRCNN/train.py
examples/FasterRCNN/train.py
+2
-0
tensorpack/dataflow/imgaug/misc.py
tensorpack/dataflow/imgaug/misc.py
+10
-5
No files found.
examples/FasterRCNN/train.py
View file @
5b7d5106
...
@@ -10,8 +10,10 @@ import itertools
...
@@ -10,8 +10,10 @@ import itertools
import
tqdm
import
tqdm
import
numpy
as
np
import
numpy
as
np
import
json
import
json
import
six
import
tensorflow
as
tf
import
tensorflow
as
tf
assert
six
.
PY3
,
"FasterRCNN requires Python 3!"
from
tensorpack
import
*
from
tensorpack
import
*
from
tensorpack.tfutils.summary
import
add_moving_summary
from
tensorpack.tfutils.summary
import
add_moving_summary
...
...
tensorpack/dataflow/imgaug/misc.py
View file @
5b7d5106
...
@@ -106,14 +106,14 @@ class ResizeShortestEdge(TransformAugmentorBase):
...
@@ -106,14 +106,14 @@ class ResizeShortestEdge(TransformAugmentorBase):
class
RandomResize
(
TransformAugmentorBase
):
class
RandomResize
(
TransformAugmentorBase
):
""" Randomly rescale width and height of the image."""
""" Randomly rescale width and height of the image."""
def
__init__
(
self
,
xrange
,
yrange
,
minimum
=
(
0
,
0
),
aspect_ratio_thres
=
0.15
,
def
__init__
(
self
,
xrange
,
yrange
=
None
,
minimum
=
(
0
,
0
),
aspect_ratio_thres
=
0.15
,
interp
=
cv2
.
INTER_LINEAR
):
interp
=
cv2
.
INTER_LINEAR
):
"""
"""
Args:
Args:
xrange (tuple): a (min, max) tuple. If is floating point, the
xrange (tuple): a (min, max) tuple. If is floating point, the
tuple defines the range of scaling ratio of new width, e.g. (0.9, 1.2).
tuple defines the range of scaling ratio of new width, e.g. (0.9, 1.2).
If is integer, the tuple defines the range of new width in pixels, e.g. (200, 350).
If is integer, the tuple defines the range of new width in pixels, e.g. (200, 350).
yrange (tuple): similar to xrange, but for height.
yrange (tuple): similar to xrange, but for height.
Should be None when aspect_ratio_thres==0.
minimum (tuple): (xmin, ymin) in pixels. To avoid scaling down too much.
minimum (tuple): (xmin, ymin) in pixels. To avoid scaling down too much.
aspect_ratio_thres (float): discard samples which change aspect ratio
aspect_ratio_thres (float): discard samples which change aspect ratio
larger than this threshold. Set to 0 to keep aspect ratio.
larger than this threshold. Set to 0 to keep aspect ratio.
...
@@ -126,11 +126,16 @@ class RandomResize(TransformAugmentorBase):
...
@@ -126,11 +126,16 @@ class RandomResize(TransformAugmentorBase):
def
is_float
(
tp
):
def
is_float
(
tp
):
return
isinstance
(
tp
[
0
],
float
)
or
isinstance
(
tp
[
1
],
float
)
return
isinstance
(
tp
[
0
],
float
)
or
isinstance
(
tp
[
1
],
float
)
assert
is_float
(
xrange
)
==
is_float
(
yrange
),
"xrange and yrange has different type!"
if
yrange
is
not
None
:
assert
is_float
(
xrange
)
==
is_float
(
yrange
),
"xrange and yrange has different type!"
self
.
_is_scale
=
is_float
(
xrange
)
self
.
_is_scale
=
is_float
(
xrange
)
if
self
.
_is_scale
and
aspect_ratio_thres
==
0
:
if
aspect_ratio_thres
==
0
:
assert
xrange
==
yrange
if
self
.
_is_scale
:
assert
xrange
==
yrange
or
yrange
is
None
else
:
if
yrange
is
not
None
:
logger
.
warn
(
"aspect_ratio_thres==0, yrange is not used!"
)
def
_get_augment_params
(
self
,
img
):
def
_get_augment_params
(
self
,
img
):
cnt
=
0
cnt
=
0
...
...
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