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
2c8cd32f
Commit
2c8cd32f
authored
Nov 17, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shuffle imagefromfile
parent
6221d17d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
tensorpack/dataflow/image.py
tensorpack/dataflow/image.py
+6
-3
No files found.
tensorpack/dataflow/image.py
View file @
2c8cd32f
...
@@ -5,14 +5,14 @@
...
@@ -5,14 +5,14 @@
import
numpy
as
np
import
numpy
as
np
import
cv2
import
cv2
import
copy
import
copy
from
.base
import
DataFlow
,
ProxyDataFlow
from
.base
import
RNGDataFlow
,
DataFlow
,
ProxyDataFlow
from
.common
import
MapDataComponent
,
MapData
from
.common
import
MapDataComponent
,
MapData
from
.imgaug
import
AugmentorList
from
.imgaug
import
AugmentorList
__all__
=
[
'ImageFromFile'
,
'AugmentImageComponent'
,
'AugmentImageComponents'
]
__all__
=
[
'ImageFromFile'
,
'AugmentImageComponent'
,
'AugmentImageComponents'
]
class
ImageFromFile
(
DataFlow
):
class
ImageFromFile
(
RNG
DataFlow
):
def
__init__
(
self
,
files
,
channel
=
3
,
resize
=
None
):
def
__init__
(
self
,
files
,
channel
=
3
,
resize
=
None
,
shuffle
=
False
):
"""
"""
Generate rgb images from list of files
Generate rgb images from list of files
:param files: list of file paths
:param files: list of file paths
...
@@ -23,11 +23,14 @@ class ImageFromFile(DataFlow):
...
@@ -23,11 +23,14 @@ class ImageFromFile(DataFlow):
self
.
files
=
files
self
.
files
=
files
self
.
channel
=
int
(
channel
)
self
.
channel
=
int
(
channel
)
self
.
resize
=
resize
self
.
resize
=
resize
self
.
shuffle
=
shuffle
def
size
(
self
):
def
size
(
self
):
return
len
(
self
.
files
)
return
len
(
self
.
files
)
def
get_data
(
self
):
def
get_data
(
self
):
if
self
.
shuffle
:
self
.
rng
.
shuffle
(
self
.
files
)
for
f
in
self
.
files
:
for
f
in
self
.
files
:
im
=
cv2
.
imread
(
im
=
cv2
.
imread
(
f
,
cv2
.
IMREAD_GRAYSCALE
if
self
.
channel
==
1
else
cv2
.
IMREAD_COLOR
)
f
,
cv2
.
IMREAD_GRAYSCALE
if
self
.
channel
==
1
else
cv2
.
IMREAD_COLOR
)
...
...
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