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
e90acf27
Commit
e90acf27
authored
Apr 13, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better log & h5py
parent
d6d06389
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
27 deletions
+29
-27
examples/mnist_convnet.py
examples/mnist_convnet.py
+1
-0
tensorpack/dataflow/dataset/ilsvrc.py
tensorpack/dataflow/dataset/ilsvrc.py
+6
-1
tensorpack/dataflow/format.py
tensorpack/dataflow/format.py
+5
-4
tensorpack/models/_common.py
tensorpack/models/_common.py
+17
-11
usercustomize.py
usercustomize.py
+0
-11
No files found.
examples/mnist_convnet.py
View file @
e90acf27
...
@@ -18,6 +18,7 @@ from tensorpack.tfutils.summary import *
...
@@ -18,6 +18,7 @@ from tensorpack.tfutils.summary import *
from
tensorpack.tfutils
import
*
from
tensorpack.tfutils
import
*
from
tensorpack.callbacks
import
*
from
tensorpack.callbacks
import
*
from
tensorpack.dataflow
import
*
from
tensorpack.dataflow
import
*
from
IPython
import
embed
;
embed
()
"""
"""
MNIST ConvNet example.
MNIST ConvNet example.
...
...
tensorpack/dataflow/dataset/ilsvrc.py
View file @
e90acf27
...
@@ -16,6 +16,11 @@ __all__ = ['ILSVRCMeta', 'ILSVRC12']
...
@@ -16,6 +16,11 @@ __all__ = ['ILSVRCMeta', 'ILSVRC12']
CAFFE_ILSVRC12_URL
=
"http://dl.caffe.berkeleyvision.org/caffe_ilsvrc12.tar.gz"
CAFFE_ILSVRC12_URL
=
"http://dl.caffe.berkeleyvision.org/caffe_ilsvrc12.tar.gz"
CAFFE_PROTO_URL
=
"https://github.com/BVLC/caffe/raw/master/src/caffe/proto/caffe.proto"
CAFFE_PROTO_URL
=
"https://github.com/BVLC/caffe/raw/master/src/caffe/proto/caffe.proto"
"""
cd train
for i in *.tar; do dir=${i
%
.tar}; echo $dir; mkdir -p $dir; tar xf $i -C $dir; done
"""
class
ILSVRCMeta
(
object
):
class
ILSVRCMeta
(
object
):
"""
"""
Provide metadata for ILSVRC dataset.
Provide metadata for ILSVRC dataset.
...
@@ -119,7 +124,7 @@ class ILSVRC12(DataFlow):
...
@@ -119,7 +124,7 @@ class ILSVRC12(DataFlow):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
meta
=
ILSVRCMeta
()
meta
=
ILSVRCMeta
()
print
meta
.
get_per_pixel_mean
(
)
print
(
meta
.
get_per_pixel_mean
()
)
#print(meta.get_synset_words_1000())
#print(meta.get_synset_words_1000())
#ds = ILSVRC12('/home/wyx/data/imagenet', 'val')
#ds = ILSVRC12('/home/wyx/data/imagenet', 'val')
...
...
tensorpack/dataflow/format.py
View file @
e90acf27
...
@@ -11,15 +11,16 @@ from six.moves import range
...
@@ -11,15 +11,16 @@ from six.moves import range
try
:
try
:
import
h5py
import
h5py
except
ImportError
:
except
ImportError
:
logger
.
error
(
"Error in `import h5py`. HDF5Data cannot function."
)
logger
.
error
(
"Error in 'import h5py'. HDF5Data won't be imported."
)
__all__
=
[]
else
:
__all__
=
[
'HDF5Data'
]
"""
"""
Adapter for different data format.
Adapter
s
for different data format.
"""
"""
__all__
=
[
'HDF5Data'
]
class
HDF5Data
(
DataFlow
):
class
HDF5Data
(
DataFlow
):
"""
"""
Zip data from different paths in an HDF5 file. Will load all data into memory.
Zip data from different paths in an HDF5 file. Will load all data into memory.
...
...
tensorpack/models/_common.py
View file @
e90acf27
...
@@ -27,31 +27,37 @@ def layer_register(summary_activation=False, log_shape=True):
...
@@ -27,31 +27,37 @@ def layer_register(summary_activation=False, log_shape=True):
def
wrapped_func
(
*
args
,
**
kwargs
):
def
wrapped_func
(
*
args
,
**
kwargs
):
name
=
args
[
0
]
name
=
args
[
0
]
assert
isinstance
(
name
,
six
.
string_types
),
\
assert
isinstance
(
name
,
six
.
string_types
),
\
'name must be the first argument. Args: {}'
.
format
(
str
(
args
)
)
'name must be the first argument. Args: {}'
.
format
(
args
)
args
=
args
[
1
:]
args
=
args
[
1
:]
do_summary
=
kwargs
.
pop
(
do_summary
=
kwargs
.
pop
(
'summary_activation'
,
summary_activation
)
'summary_activation'
,
summary_activation
)
inputs
=
args
[
0
]
inputs
=
args
[
0
]
# update from current argument scope
actual_args
=
get_arg_scope
()[
func
.
__name__
]
actual_args
=
get_arg_scope
()[
func
.
__name__
]
actual_args
.
update
(
kwargs
)
actual_args
.
update
(
kwargs
)
with
tf
.
variable_scope
(
name
)
as
scope
:
with
tf
.
variable_scope
(
name
)
as
scope
:
do_log_shape
=
log_shape
and
scope
.
name
not
in
_layer_logged
do_summary
=
do_summary
and
scope
.
name
not
in
_layer_logged
if
do_log_shape
:
logger
.
info
(
"{} input: {}"
.
format
(
scope
.
name
,
get_shape_str
(
inputs
)))
# run the actual function
outputs
=
func
(
*
args
,
**
actual_args
)
outputs
=
func
(
*
args
,
**
actual_args
)
if
log_shape
and
scope
.
name
not
in
_layer_logged
:
if
do_log_shape
:
# log shape info and add activation
# log shape info and add activation
logger
.
info
(
"{} input: {}"
.
format
(
scope
.
name
,
get_shape_str
(
inputs
)))
logger
.
info
(
"{} output: {}"
.
format
(
logger
.
info
(
"{} output: {}"
.
format
(
scope
.
name
,
get_shape_str
(
outputs
)))
scope
.
name
,
get_shape_str
(
outputs
)))
if
do_summary
:
if
isinstance
(
outputs
,
list
):
for
x
in
outputs
:
add_activation_summary
(
x
,
scope
.
name
)
else
:
add_activation_summary
(
outputs
,
scope
.
name
)
_layer_logged
.
add
(
scope
.
name
)
_layer_logged
.
add
(
scope
.
name
)
if
do_summary
:
if
isinstance
(
outputs
,
list
):
for
x
in
outputs
:
add_activation_summary
(
x
,
scope
.
name
)
else
:
add_activation_summary
(
outputs
,
scope
.
name
)
return
outputs
return
outputs
wrapped_func
.
f
=
func
# attribute to access the underlining function object
wrapped_func
.
f
=
func
# attribute to access the underlining function object
return
wrapped_func
return
wrapped_func
...
...
usercustomize.py
deleted
100644 → 0
View file @
d6d06389
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: usercustomize.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
# use user-space protobuf
#import sys, os
#if not sys.version_info >= (3, 0):
#site = os.path.join(os.environ['HOME'],
#'.local/lib/python2.7/site-packages')
#sys.path.insert(0, site)
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