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
fa69c70a
Commit
fa69c70a
authored
Nov 12, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix patchlist visualization
parent
70802354
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
tensorpack/utils/viz.py
tensorpack/utils/viz.py
+7
-6
No files found.
tensorpack/utils/viz.py
View file @
fa69c70a
...
...
@@ -71,8 +71,9 @@ def interactive_imshow(img, lclick_cb=None, rclick_cb=None, **kwargs):
cv2
.
imwrite
(
'out.png'
,
img
)
def
_prepro
ec
ss_patch_list
(
plist
):
def
_prepro
ce
ss_patch_list
(
plist
):
plist
=
np
.
asarray
(
plist
)
assert
plist
.
dtype
!=
np
.
object
if
plist
.
ndim
==
3
:
plist
=
plist
[:,
:,
:,
np
.
newaxis
]
assert
plist
.
ndim
==
4
and
plist
.
shape
[
3
]
in
[
1
,
3
],
plist
.
shape
...
...
@@ -102,8 +103,8 @@ def _pad_patch_list(plist, bgcolor):
ret
[:,
:,
:]
=
bgcolor
for
idx
,
p
in
enumerate
(
plist
):
s
=
p
.
shape
sh
=
(
ph
-
s
[
0
])
/
2
sw
=
(
pw
-
s
[
1
])
/
2
sh
=
(
ph
-
s
[
0
])
/
/
2
sw
=
(
pw
-
s
[
1
])
/
/
2
ret
[
idx
,
sh
:
sh
+
s
[
0
],
sw
:
sw
+
s
[
1
],
:]
=
p
return
ret
...
...
@@ -184,8 +185,8 @@ def stack_patches(
np.ndarray: the stacked image.
"""
if
pad
:
patch_list
=
_pad_patch_list
(
patch_list
)
patch_list
=
_prepro
ec
ss_patch_list
(
patch_list
)
patch_list
=
_pad_patch_list
(
patch_list
,
bgcolor
)
patch_list
=
_prepro
ce
ss_patch_list
(
patch_list
)
if
lclick_cb
is
not
None
:
viz
=
True
...
...
@@ -229,7 +230,7 @@ def gen_stack_patches(patch_list,
np.ndarray: the stacked image.
"""
# setup parameters
patch_list
=
_prepro
ec
ss_patch_list
(
patch_list
)
patch_list
=
_prepro
ce
ss_patch_list
(
patch_list
)
if
lclick_cb
is
not
None
:
viz
=
True
ph
,
pw
=
patch_list
.
shape
[
1
:
3
]
...
...
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