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
1f02847d
Commit
1f02847d
authored
Dec 06, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix inputvar problems with py3, and lmdb bug
parent
88ed2c24
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
11 deletions
+13
-11
README.md
README.md
+2
-2
examples/GAN/Image2Image.py
examples/GAN/Image2Image.py
+2
-1
tensorpack/dataflow/format.py
tensorpack/dataflow/format.py
+1
-1
tensorpack/models/batch_norm.py
tensorpack/models/batch_norm.py
+1
-1
tensorpack/models/model_desc.py
tensorpack/models/model_desc.py
+6
-5
tensorpack/utils/loadcaffe.py
tensorpack/utils/loadcaffe.py
+1
-1
No files found.
README.md
View file @
1f02847d
...
@@ -33,13 +33,13 @@ Describe your training task with three components:
...
@@ -33,13 +33,13 @@ Describe your training task with three components:
+
Print some variables of interest
+
Print some variables of interest
+
Run inference on a test dataset
+
Run inference on a test dataset
+
Run some operations once a while
+
Run some operations once a while
+
Send
the accuracy
to your phone
+
Send
loss
to your phone
With the above components defined, tensorpack trainer will run the training iterations for you.
With the above components defined, tensorpack trainer will run the training iterations for you.
Multi-GPU training is off-the-shelf by simply switching the trainer.
Multi-GPU training is off-the-shelf by simply switching the trainer.
You can also define your own trainer for non-standard training (e.g. GAN).
You can also define your own trainer for non-standard training (e.g. GAN).
The components are designed to be independent. You can use
only Model or DataFlow in your project
.
The components are designed to be independent. You can use
Model or DataFlow in other projects as well
.
## Dependencies:
## Dependencies:
...
...
examples/GAN/Image2Image.py
View file @
1f02847d
...
@@ -20,8 +20,9 @@ from GAN import GANTrainer, RandomZData, build_GAN_losses
...
@@ -20,8 +20,9 @@ from GAN import GANTrainer, RandomZData, build_GAN_losses
To train:
To train:
./Image2Image.py --data /path/to/datadir --mode {AtoB,BtoA}
./Image2Image.py --data /path/to/datadir --mode {AtoB,BtoA}
# datadir should contain 512x256 images formed by A and B
# datadir should contain 512x256 images formed by A and B
# training visualization will appear be in tensorboard
To visualize:
To visualize
on test set
:
./Image2Image.py --sample --data /path/to/test/datadir --mode {AtoB,BtoA} --load pretrained.model
./Image2Image.py --sample --data /path/to/test/datadir --mode {AtoB,BtoA} --load pretrained.model
"""
"""
...
...
tensorpack/dataflow/format.py
View file @
1f02847d
...
@@ -128,7 +128,7 @@ class LMDBDataDecoder(LMDBData):
...
@@ -128,7 +128,7 @@ class LMDBDataDecoder(LMDBData):
class
LMDBDataPoint
(
LMDBDataDecoder
):
class
LMDBDataPoint
(
LMDBDataDecoder
):
""" Read a LMDB file where each value is a serialized datapoint"""
""" Read a LMDB file where each value is a serialized datapoint"""
def
__init__
(
self
,
lmdb_path
,
shuffle
=
True
):
def
__init__
(
self
,
lmdb_path
,
shuffle
=
True
):
super
(
SimpleLMDBLoader
,
self
)
.
__init__
(
super
(
LMDBDataPoint
,
self
)
.
__init__
(
lmdb_path
,
decoder
=
lambda
k
,
v
:
loads
(
v
),
shuffle
=
shuffle
)
lmdb_path
,
decoder
=
lambda
k
,
v
:
loads
(
v
),
shuffle
=
shuffle
)
class
CaffeLMDB
(
LMDBDataDecoder
):
class
CaffeLMDB
(
LMDBDataDecoder
):
...
...
tensorpack/models/batch_norm.py
View file @
1f02847d
...
@@ -149,7 +149,7 @@ def BatchNormV2(x, use_local_stat=None, decay=0.9, epsilon=1e-5):
...
@@ -149,7 +149,7 @@ def BatchNormV2(x, use_local_stat=None, decay=0.9, epsilon=1e-5):
if
use_local_stat
:
if
use_local_stat
:
xn
,
batch_mean
,
batch_var
=
tf
.
nn
.
fused_batch_norm
(
x
,
gamma
,
beta
,
xn
,
batch_mean
,
batch_var
=
tf
.
nn
.
fused_batch_norm
(
x
,
gamma
,
beta
,
epsilon
=
epsilon
,
is_training
=
ctx
.
is_training
)
epsilon
=
epsilon
,
is_training
=
True
)
if
ctx
.
is_training
:
if
ctx
.
is_training
:
# maintain EMA if training
# maintain EMA if training
update_op1
=
moving_averages
.
assign_moving_average
(
update_op1
=
moving_averages
.
assign_moving_average
(
...
...
tensorpack/models/model_desc.py
View file @
1f02847d
...
@@ -17,12 +17,13 @@ from ..tfutils.tower import get_current_tower_context
...
@@ -17,12 +17,13 @@ from ..tfutils.tower import get_current_tower_context
__all__
=
[
'ModelDesc'
,
'InputVar'
,
'ModelFromMetaGraph'
]
__all__
=
[
'ModelDesc'
,
'InputVar'
,
'ModelFromMetaGraph'
]
_InputVar
=
namedtuple
(
'InputVar'
,
[
'type'
,
'shape'
,
'name'
,
'sparse'
])
#
_InputVar = namedtuple('InputVar', ['type', 'shape', 'name', 'sparse'])
class
InputVar
(
_InputVar
):
class
InputVar
(
object
):
def
__init__
(
self
,
type
,
shape
,
name
,
sparse
=
False
):
def
__init__
(
self
,
type
,
shape
,
name
,
sparse
=
False
):
super
(
InputVar
,
self
)
.
__init__
(
type
,
shape
,
name
,
sparse
)
self
.
type
=
type
def
__new__
(
cls
,
type
,
shape
,
name
,
sparse
=
False
):
self
.
shape
=
shape
return
super
(
InputVar
,
cls
)
.
__new__
(
cls
,
type
,
shape
,
name
,
sparse
)
self
.
name
=
name
self
.
sparse
=
sparse
def
dumps
(
self
):
def
dumps
(
self
):
return
pickle
.
dumps
(
self
)
return
pickle
.
dumps
(
self
)
@
staticmethod
@
staticmethod
...
...
tensorpack/utils/loadcaffe.py
View file @
1f02847d
...
@@ -97,7 +97,7 @@ class CaffeLayerProcessor(object):
...
@@ -97,7 +97,7 @@ class CaffeLayerProcessor(object):
def
load_caffe
(
model_desc
,
model_file
):
def
load_caffe
(
model_desc
,
model_file
):
"""
"""
return
a dict of params
:return:
a dict of params
"""
"""
with
change_env
(
'GLOG_minloglevel'
,
'2'
):
with
change_env
(
'GLOG_minloglevel'
,
'2'
):
import
caffe
import
caffe
...
...
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