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
0bd1e92f
Commit
0bd1e92f
authored
Apr 18, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better log for grad & model preparation
parent
d04661e3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
9 deletions
+14
-9
README.md
README.md
+4
-4
tensorpack/callbacks/common.py
tensorpack/callbacks/common.py
+1
-1
tensorpack/callbacks/param.py
tensorpack/callbacks/param.py
+1
-1
tensorpack/dataflow/imgaug/crop.py
tensorpack/dataflow/imgaug/crop.py
+2
-2
tensorpack/train/trainer.py
tensorpack/train/trainer.py
+6
-1
No files found.
README.md
View file @
0bd1e92f
# tensorpack
# tensorpack
Neural Network Toolbox on TensorFlow
Neural Network Toolbox on TensorFlow
In development. No document.
In development. No document.
See
[
examples
](
https://github.com/ppwwyyxx/tensorpack/tree/master/examples
)
.
## Features:
## Features:
+
Scoped abstraction of common models.
+
Scoped abstraction of common models.
+
Callbacks systems to control different aspects of training
.
+
Use
`Dataflow`
to define data preprocessing in pure Python
.
+
Use
`Dataflow`
to gain fine-grained control on data preprocess
ing.
+
Callbacks systems to control train
ing.
+
Training and testing
graph are model
ed together. Just need to follow the conventions to setup stuffs.
+
Training and testing
are describ
ed together. Just need to follow the conventions to setup stuffs.
+
Write summary easier for tensorboard.
+
Write summary easier for tensorboard.
tensorpack/callbacks/common.py
View file @
0bd1e92f
...
@@ -36,7 +36,7 @@ class ModelSaver(Callback):
...
@@ -36,7 +36,7 @@ class ModelSaver(Callback):
for
v
in
vars
:
for
v
in
vars
:
name
=
v
.
op
.
name
name
=
v
.
op
.
name
if
re
.
match
(
'tower[1-9]'
,
name
):
if
re
.
match
(
'tower[1-9]'
,
name
):
logger
.
info
(
"Skip {} when saving model."
.
format
(
name
))
#
logger.info("Skip {} when saving model.".format(name))
continue
continue
if
'tower0/'
in
name
:
if
'tower0/'
in
name
:
new_name
=
name
.
replace
(
'tower0/'
,
''
)
new_name
=
name
.
replace
(
'tower0/'
,
''
)
...
...
tensorpack/callbacks/param.py
View file @
0bd1e92f
...
@@ -50,7 +50,7 @@ class HyperParamSetter(Callback):
...
@@ -50,7 +50,7 @@ class HyperParamSetter(Callback):
ret
=
self
.
_get_current_value
()
ret
=
self
.
_get_current_value
()
if
ret
is
not
None
and
ret
!=
self
.
last_value
:
if
ret
is
not
None
and
ret
!=
self
.
last_value
:
logger
.
info
(
"{} at epoch {} will change to {}"
.
format
(
logger
.
info
(
"{} at epoch {} will change to {}"
.
format
(
self
.
op_name
,
self
.
epoch_num
,
ret
))
self
.
op_name
,
self
.
epoch_num
+
1
,
ret
))
self
.
last_value
=
ret
self
.
last_value
=
ret
return
ret
return
ret
...
...
tensorpack/dataflow/imgaug/crop.py
View file @
0bd1e92f
...
@@ -36,8 +36,8 @@ class CenterCrop(ImageAugmentor):
...
@@ -36,8 +36,8 @@ class CenterCrop(ImageAugmentor):
def
_augment
(
self
,
img
):
def
_augment
(
self
,
img
):
orig_shape
=
img
.
arr
.
shape
orig_shape
=
img
.
arr
.
shape
h0
=
(
orig_shape
[
0
]
-
self
.
crop_shape
[
0
])
*
0.5
h0
=
int
((
orig_shape
[
0
]
-
self
.
crop_shape
[
0
])
*
0.5
)
w0
=
(
orig_shape
[
1
]
-
self
.
crop_shape
[
1
])
*
0.5
w0
=
int
((
orig_shape
[
1
]
-
self
.
crop_shape
[
1
])
*
0.5
)
img
.
arr
=
img
.
arr
[
h0
:
h0
+
self
.
crop_shape
[
0
],
w0
:
w0
+
self
.
crop_shape
[
1
]]
img
.
arr
=
img
.
arr
[
h0
:
h0
+
self
.
crop_shape
[
0
],
w0
:
w0
+
self
.
crop_shape
[
1
]]
if
img
.
coords
:
if
img
.
coords
:
raise
NotImplementedError
()
raise
NotImplementedError
()
...
...
tensorpack/train/trainer.py
View file @
0bd1e92f
...
@@ -88,8 +88,12 @@ class QueueInputTrainer(Trainer):
...
@@ -88,8 +88,12 @@ class QueueInputTrainer(Trainer):
ret
=
[]
ret
=
[]
with
tf
.
device
(
'/gpu:0'
):
with
tf
.
device
(
'/gpu:0'
):
for
grad_and_vars
in
zip
(
*
tower_grads
):
for
grad_and_vars
in
zip
(
*
tower_grads
):
grad
=
tf
.
add_n
([
x
[
0
]
for
x
in
grad_and_vars
])
/
float
(
len
(
tower_grads
))
v
=
grad_and_vars
[
0
][
1
]
v
=
grad_and_vars
[
0
][
1
]
try
:
grad
=
tf
.
add_n
([
x
[
0
]
for
x
in
grad_and_vars
])
/
float
(
len
(
tower_grads
))
except
AssertionError
:
logger
.
error
(
"Error while processing gradients of {}"
.
format
(
v
.
name
))
raise
ret
.
append
((
grad
,
v
))
ret
.
append
((
grad
,
v
))
return
ret
return
ret
...
@@ -129,6 +133,7 @@ class QueueInputTrainer(Trainer):
...
@@ -129,6 +133,7 @@ class QueueInputTrainer(Trainer):
tf
.
get_variable_scope
()
.
reuse_variables
()
tf
.
get_variable_scope
()
.
reuse_variables
()
for
k
in
coll_keys
:
for
k
in
coll_keys
:
kept_summaries
[
k
]
=
copy
.
copy
(
tf
.
get_collection
(
k
))
kept_summaries
[
k
]
=
copy
.
copy
(
tf
.
get_collection
(
k
))
logger
.
info
(
"Graph built for tower {}."
.
format
(
i
))
for
k
in
coll_keys
:
for
k
in
coll_keys
:
del
tf
.
get_collection
(
k
)[:]
del
tf
.
get_collection
(
k
)[:]
tf
.
get_collection
(
k
)
.
extend
(
kept_summaries
[
k
])
tf
.
get_collection
(
k
)
.
extend
(
kept_summaries
[
k
])
...
...
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