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
d2262d1d
Commit
d2262d1d
authored
Jan 04, 2016
by
ppwwyyxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix image.py
parent
977134e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
tensorpack/dataflow/image.py
tensorpack/dataflow/image.py
+5
-4
No files found.
tensorpack/dataflow/image.py
View file @
d2262d1d
...
@@ -11,11 +11,12 @@ __all__ = ['ImageFromFile']
...
@@ -11,11 +11,12 @@ __all__ = ['ImageFromFile']
class
ImageFromFile
(
DataFlow
):
class
ImageFromFile
(
DataFlow
):
""" generate rgb images from files """
""" generate rgb images from files """
def
__init__
(
self
,
files
,
channel
,
resize
=
None
):
def
__init__
(
self
,
files
,
channel
=
3
,
resize
=
None
):
""" files: list of file path
""" files: list of file path
channel: 1 or 3 channel
channel: 1 or 3 channel
resize: a (
w, h
) tuple. If given, will force a resize
resize: a (
h, w
) tuple. If given, will force a resize
"""
"""
assert
len
(
self
.
files
)
self
.
files
=
files
self
.
files
=
files
self
.
channel
=
int
(
channel
)
self
.
channel
=
int
(
channel
)
self
.
resize
=
resize
self
.
resize
=
resize
...
@@ -30,6 +31,6 @@ class ImageFromFile(DataFlow):
...
@@ -30,6 +31,6 @@ class ImageFromFile(DataFlow):
if
self
.
channel
==
3
:
if
self
.
channel
==
3
:
im
=
cv2
.
cvtColor
(
im
,
cv2
.
COLOR_BGR2RGB
)
im
=
cv2
.
cvtColor
(
im
,
cv2
.
COLOR_BGR2RGB
)
if
self
.
resize
is
not
None
:
if
self
.
resize
is
not
None
:
im
=
cv2
.
resize
(
im
,
self
.
resize
)
im
=
cv2
.
resize
(
im
,
self
.
resize
[::
-
1
]
)
yield
(
im
,)
yield
[
im
]
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