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
6d299170
Commit
6d299170
authored
Mar 31, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
svhn mean
parent
56178e92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
tensorpack/dataflow/dataset/svhn.py
tensorpack/dataflow/dataset/svhn.py
+19
-0
No files found.
tensorpack/dataflow/dataset/svhn.py
View file @
6d299170
...
@@ -20,10 +20,15 @@ class SVHNDigit(DataFlow):
...
@@ -20,10 +20,15 @@ class SVHNDigit(DataFlow):
SVHN Cropped Digit Dataset
SVHN Cropped Digit Dataset
return img of 32x32x3, label of 0-9
return img of 32x32x3, label of 0-9
"""
"""
Cache
=
{}
def
__init__
(
self
,
name
,
data_dir
=
None
):
def
__init__
(
self
,
name
,
data_dir
=
None
):
"""
"""
name: 'train', 'test', or 'extra'
name: 'train', 'test', or 'extra'
"""
"""
if
name
in
SVHNDigit
.
Cache
:
self
.
X
,
self
.
Y
=
SVHNDigit
.
Cache
[
name
]
return
if
data_dir
is
None
:
if
data_dir
is
None
:
data_dir
=
os
.
path
.
join
(
data_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
os
.
path
.
dirname
(
__file__
),
...
@@ -38,6 +43,7 @@ http://ufldl.stanford.edu/housenumbers/".format(filename)
...
@@ -38,6 +43,7 @@ http://ufldl.stanford.edu/housenumbers/".format(filename)
self
.
X
=
data
[
'X'
]
.
transpose
(
3
,
0
,
1
,
2
)
self
.
X
=
data
[
'X'
]
.
transpose
(
3
,
0
,
1
,
2
)
self
.
Y
=
data
[
'y'
]
.
reshape
((
-
1
))
self
.
Y
=
data
[
'y'
]
.
reshape
((
-
1
))
self
.
Y
[
self
.
Y
==
10
]
=
0
self
.
Y
[
self
.
Y
==
10
]
=
0
SVHNDigit
.
Cache
[
name
]
=
(
self
.
X
,
self
.
Y
)
def
size
(
self
):
def
size
(
self
):
return
self
.
X
.
shape
[
0
]
return
self
.
X
.
shape
[
0
]
...
@@ -47,3 +53,16 @@ http://ufldl.stanford.edu/housenumbers/".format(filename)
...
@@ -47,3 +53,16 @@ http://ufldl.stanford.edu/housenumbers/".format(filename)
for
k
in
range
(
n
):
for
k
in
range
(
n
):
yield
[
self
.
X
[
k
],
self
.
Y
[
k
]]
yield
[
self
.
X
[
k
],
self
.
Y
[
k
]]
@
staticmethod
def
get_per_pixel_mean
():
"""
return 32x32x3 image
"""
a
=
SVHNDigit
(
'train'
)
b
=
SVHNDigit
(
'test'
)
c
=
SVHNDigit
(
'extra'
)
return
numpy
.
concatenate
((
a
.
X
,
b
.
X
,
c
.
X
))
.
mean
(
axis
=
0
)
if
__name__
==
'__main__'
:
a
=
SVHNDigit
(
'train'
)
b
=
SVHNDigit
.
get_per_pixel_mean
()
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