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
dc782068
Commit
dc782068
authored
Jul 10, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update docs
parent
67786cbb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
8 deletions
+11
-8
examples/DoReFa-Net/README.md
examples/DoReFa-Net/README.md
+1
-4
tensorpack/dataflow/dataset/ilsvrc.py
tensorpack/dataflow/dataset/ilsvrc.py
+6
-2
tensorpack/utils/fs.py
tensorpack/utils/fs.py
+3
-1
tensorpack/utils/timer.py
tensorpack/utils/timer.py
+1
-1
No files found.
examples/DoReFa-Net/README.md
View file @
dc782068
...
@@ -56,12 +56,9 @@ To eval on ILSVRC12, `path/to/ILSVRC12` must have a subdirectory named 'val' con
...
@@ -56,12 +56,9 @@ To eval on ILSVRC12, `path/to/ILSVRC12` must have a subdirectory named 'val' con
Please use
[
github issues
](
https://github.com/ppwwyyxx/tensorpack/issues
)
for any issues related to the code.
Please use
[
github issues
](
https://github.com/ppwwyyxx/tensorpack/issues
)
for any issues related to the code.
Send email to the authors for other questions related to the paper.
Send email to the authors for other questions related to the paper.
Note that although the it uses low bitwidth weights, activations and gradients, these values
here are still represented in
`tf.float32`
, since TensorFlow doesn't natively support low bitwidth computation.
## Citation
## Citation
If you use our models in your research, please cite:
If you use our
code or
models in your research, please cite:
```
```
@article{zhou2016dorefa,
@article{zhou2016dorefa,
author = {Shuchang Zhou and Zekun Ni and Xinyu Zhou and He Wen and Yuxin Wu and Yuheng Zou},
author = {Shuchang Zhou and Zekun Ni and Xinyu Zhou and He Wen and Yuxin Wu and Yuheng Zou},
...
...
tensorpack/dataflow/dataset/ilsvrc.py
View file @
dc782068
...
@@ -101,7 +101,9 @@ class ILSVRCMeta(object):
...
@@ -101,7 +101,9 @@ class ILSVRCMeta(object):
class
ILSVRC12
(
DataFlow
):
class
ILSVRC12
(
DataFlow
):
def
__init__
(
self
,
dir
,
name
,
meta_dir
=
None
,
shuffle
=
True
):
def
__init__
(
self
,
dir
,
name
,
meta_dir
=
None
,
shuffle
=
True
):
"""
"""
name: 'train' or 'val' or 'test'
:param name: 'train' or 'val' or 'test'
:param dir: A directory containing a subdir named `name`, inside which the
original ILSVRC12_`name`.tar gets decompressed.
"""
"""
assert
name
in
[
'train'
,
'test'
,
'val'
]
assert
name
in
[
'train'
,
'test'
,
'val'
]
self
.
full_dir
=
os
.
path
.
join
(
dir
,
name
)
self
.
full_dir
=
os
.
path
.
join
(
dir
,
name
)
...
@@ -136,7 +138,9 @@ class ILSVRC12(DataFlow):
...
@@ -136,7 +138,9 @@ class ILSVRC12(DataFlow):
im
=
np
.
expand_dims
(
im
,
2
)
.
repeat
(
3
,
2
)
im
=
np
.
expand_dims
(
im
,
2
)
.
repeat
(
3
,
2
)
yield
[
im
,
tp
[
1
]]
yield
[
im
,
tp
[
1
]]
# TODO more generally, just CaffeLMDB
class
ILSVRC12CaffeLMDB
(
DataFlow
):
class
ILSVRC12CaffeLMDB
(
DataFlow
):
""" Read a Caffe LMDB file where each value contains a caffe.Datum protobuf """
def
__init__
(
self
,
lmdb_dir
,
shuffle
=
True
):
def
__init__
(
self
,
lmdb_dir
,
shuffle
=
True
):
"""
"""
:param shuffle: about 3 times slower
:param shuffle: about 3 times slower
...
@@ -150,7 +154,7 @@ class ILSVRC12CaffeLMDB(DataFlow):
...
@@ -150,7 +154,7 @@ class ILSVRC12CaffeLMDB(DataFlow):
self
.
_txn
=
self
.
_lmdb
.
begin
()
self
.
_txn
=
self
.
_lmdb
.
begin
()
self
.
_size
=
self
.
_txn
.
stat
()[
'entries'
]
self
.
_size
=
self
.
_txn
.
stat
()[
'entries'
]
if
shuffle
:
if
shuffle
:
with
timed_operation
(
"Loading LMDB keys ..."
):
with
timed_operation
(
"Loading LMDB keys ..."
,
log_start
=
True
):
self
.
keys
=
[
k
for
k
,
_
in
self
.
_txn
.
cursor
()]
self
.
keys
=
[
k
for
k
,
_
in
self
.
_txn
.
cursor
()]
def
reset_state
(
self
):
def
reset_state
(
self
):
...
...
tensorpack/utils/fs.py
View file @
dc782068
...
@@ -25,7 +25,9 @@ def download(url, dir):
...
@@ -25,7 +25,9 @@ def download(url, dir):
def
_progress
(
count
,
block_size
,
total_size
):
def
_progress
(
count
,
block_size
,
total_size
):
sys
.
stdout
.
write
(
'
\r
>> Downloading
%
s
%.1
f
%%
'
%
sys
.
stdout
.
write
(
'
\r
>> Downloading
%
s
%.1
f
%%
'
%
(
fname
,
float
(
count
*
block_size
)
/
float
(
total_size
)
*
100.0
))
(
fname
,
min
(
float
(
count
*
block_size
)
/
total_size
,
1.0
)
*
100.0
))
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
try
:
try
:
fpath
,
_
=
urllib
.
request
.
urlretrieve
(
url
,
fpath
,
reporthook
=
_progress
)
fpath
,
_
=
urllib
.
request
.
urlretrieve
(
url
,
fpath
,
reporthook
=
_progress
)
...
...
tensorpack/utils/timer.py
View file @
dc782068
...
@@ -18,7 +18,7 @@ __all__ = ['total_timer', 'timed_operation', 'print_total_timer']
...
@@ -18,7 +18,7 @@ __all__ = ['total_timer', 'timed_operation', 'print_total_timer']
@
contextmanager
@
contextmanager
def
timed_operation
(
msg
,
log_start
=
False
):
def
timed_operation
(
msg
,
log_start
=
False
):
if
log_start
:
if
log_start
:
logger
.
info
(
'
s
tart {} ...'
.
format
(
msg
))
logger
.
info
(
'
S
tart {} ...'
.
format
(
msg
))
start
=
time
.
time
()
start
=
time
.
time
()
yield
yield
logger
.
info
(
'{} finished, time={:.2f}sec.'
.
format
(
logger
.
info
(
'{} finished, time={:.2f}sec.'
.
format
(
...
...
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