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
22221fd8
Commit
22221fd8
authored
Aug 12, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix in ResizeShortestEdge.
parent
2bbe988b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
tensorpack/dataflow/common.py
tensorpack/dataflow/common.py
+5
-1
tensorpack/dataflow/imgaug/noname.py
tensorpack/dataflow/imgaug/noname.py
+6
-3
No files found.
tensorpack/dataflow/common.py
View file @
22221fd8
...
...
@@ -5,6 +5,7 @@
from
__future__
import
division
import
numpy
as
np
from
copy
import
copy
import
pprint
from
termcolor
import
colored
from
collections
import
deque
,
defaultdict
from
six.moves
import
range
,
map
...
...
@@ -136,8 +137,11 @@ class BatchData(ProxyDataFlow):
np
.
asarray
([
x
[
k
]
for
x
in
data_holder
],
dtype
=
tp
))
except
KeyboardInterrupt
:
raise
except
:
except
Exception
as
e
:
# noqa
logger
.
exception
(
"Cannot batch data. Perhaps they are of inconsistent shape?"
)
if
isinstance
(
dt
,
np
.
ndarray
):
s
=
pprint
.
pformat
([
x
[
k
]
.
shape
for
x
in
data_holder
])
logger
.
error
(
"Shape of all arrays to be batched: "
+
s
)
try
:
# open an ipython shell if possible
import
IPython
as
IP
;
IP
.
embed
()
# noqa
...
...
tensorpack/dataflow/imgaug/noname.py
View file @
22221fd8
...
...
@@ -101,13 +101,16 @@ class ResizeShortestEdge(ImageAugmentor):
Args:
size (int): the size to resize the shortest edge to.
"""
size
=
size
*
1.0
size
=
int
(
size
)
self
.
_init
(
locals
())
def
_get_augment_params
(
self
,
img
):
h
,
w
=
img
.
shape
[:
2
]
scale
=
self
.
size
/
min
(
h
,
w
)
newh
,
neww
=
map
(
int
,
[
scale
*
h
,
scale
*
w
])
scale
=
self
.
size
*
1.0
/
min
(
h
,
w
)
if
h
<
w
:
newh
,
neww
=
self
.
size
,
int
(
scale
*
w
)
else
:
newh
,
neww
=
int
(
scale
*
h
),
self
.
size
return
(
h
,
w
,
newh
,
neww
)
def
_augment
(
self
,
img
,
param
):
...
...
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