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
95037482
You need to sign in or sign up before continuing.
Commit
95037482
authored
Jan 02, 2016
by
ppwwyyxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rollback cifar model to old one
parent
95f4b9b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
15 deletions
+10
-15
example_cifar10.py
example_cifar10.py
+8
-13
tensorpack/models/conv2d.py
tensorpack/models/conv2d.py
+1
-1
tensorpack/models/fc.py
tensorpack/models/fc.py
+1
-1
No files found.
example_cifar10.py
View file @
95037482
...
...
@@ -10,10 +10,10 @@ import os
from
tensorpack.train
import
TrainConfig
,
start_train
from
tensorpack.models
import
*
from
tensorpack.callbacks
import
*
from
tensorpack.utils
import
*
from
tensorpack.utils.symbolic_functions
import
*
from
tensorpack.utils.summary
import
*
from
tensorpack.callbacks
import
*
from
tensorpack.dataflow
import
*
from
tensorpack.dataflow
import
imgaug
...
...
@@ -27,7 +27,7 @@ def get_model(inputs, is_training):
image
,
label
=
inputs
if
is_training
:
if
is_training
:
# slow?
image
,
label
=
tf
.
train
.
shuffle_batch
(
[
image
,
label
],
BATCH_SIZE
,
CAPACITY
,
MIN_AFTER_DEQUEUE
,
num_threads
=
6
,
enqueue_many
=
False
)
...
...
@@ -43,19 +43,14 @@ def get_model(inputs, is_training):
l
=
MaxPooling
(
'pool0'
,
l
,
3
,
stride
=
2
,
padding
=
'SAME'
)
l
=
tf
.
nn
.
lrn
(
l
,
4
,
bias
=
1.0
,
alpha
=
0.001
/
9.0
,
beta
=
0.75
,
name
=
'norm0'
)
l
=
Conv2D
(
'conv1'
,
l
,
out_channel
=
64
,
kernel_shape
=
5
,
padding
=
'SAME'
,
b_init
=
tf
.
constant_initializer
(
0.1
))
l
=
Conv2D
(
'conv1'
,
l
,
out_channel
=
64
,
kernel_shape
=
5
,
padding
=
'SAME'
)
l
=
tf
.
nn
.
lrn
(
l
,
4
,
bias
=
1.0
,
alpha
=
0.001
/
9.0
,
beta
=
0.75
,
name
=
'norm1'
)
l
=
MaxPooling
(
'pool1'
,
l
,
3
,
stride
=
2
,
padding
=
'SAME'
)
l
=
FullyConnected
(
'fc0'
,
l
,
384
,
b_init
=
tf
.
constant_initializer
(
0.1
))
l
=
FullyConnected
(
'fc1'
,
l
,
out_dim
=
192
,
b_init
=
tf
.
constant_initializer
(
0.1
))
l
=
FullyConnected
(
'fc0'
,
l
,
384
)
l
=
FullyConnected
(
'fc1'
,
l
,
out_dim
=
192
)
# fc will have activation summary by default. disable this for the output layer
logits
=
FullyConnected
(
'linear'
,
l
,
out_dim
=
10
,
summary_activation
=
False
,
nl
=
tf
.
identity
,
W_init
=
tf
.
truncated_normal_initializer
(
1
/
192.0
))
logits
=
FullyConnected
(
'fc2'
,
l
,
out_dim
=
10
,
summary_activation
=
False
,
nl
=
tf
.
identity
)
prob
=
tf
.
nn
.
softmax
(
logits
,
name
=
'output'
)
y
=
one_hot
(
label
,
10
)
...
...
@@ -73,7 +68,7 @@ def get_model(inputs, is_training):
SUMMARY_VARS_KEY
,
tf
.
reduce_mean
(
wrong
,
name
=
'train_error'
))
# weight decay on all W of fc layers
wd_cost
=
tf
.
mul
(
4e-3
,
wd_cost
=
tf
.
mul
(
1e-4
,
regularize_cost
(
'fc.*/W'
,
tf
.
nn
.
l2_loss
),
name
=
'regularize_loss'
)
tf
.
add_to_collection
(
COST_VARS_KEY
,
wd_cost
)
...
...
@@ -124,7 +119,7 @@ def get_config():
lr
=
tf
.
train
.
exponential_decay
(
learning_rate
=
1e-1
,
global_step
=
get_global_step_var
(),
decay_steps
=
dataset_train
.
size
()
*
35
0
,
decay_steps
=
dataset_train
.
size
()
*
20
0
,
decay_rate
=
0.1
,
staircase
=
True
,
name
=
'learning_rate'
)
tf
.
scalar_summary
(
'learning_rate'
,
lr
)
...
...
tensorpack/models/conv2d.py
View file @
95037482
...
...
@@ -31,7 +31,7 @@ def Conv2D(x, out_channel, kernel_shape,
stride
=
shape4d
(
stride
)
if
W_init
is
None
:
W_init
=
tf
.
truncated_normal_initializer
(
stddev
=
4e-
3
)
W_init
=
tf
.
truncated_normal_initializer
(
stddev
=
4e-
2
)
if
b_init
is
None
:
b_init
=
tf
.
constant_initializer
()
...
...
tensorpack/models/fc.py
View file @
95037482
...
...
@@ -17,7 +17,7 @@ def FullyConnected(x, out_dim, W_init=None, b_init=None, nl=tf.nn.relu):
in_dim
=
x
.
get_shape
()
.
as_list
()[
1
]
if
W_init
is
None
:
W_init
=
tf
.
truncated_normal_initializer
(
stddev
=
0.04
)
W_init
=
tf
.
truncated_normal_initializer
(
stddev
=
1.0
/
math
.
sqrt
(
float
(
in_dim
))
)
if
b_init
is
None
:
b_init
=
tf
.
constant_initializer
()
...
...
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