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
d6d06389
Commit
d6d06389
authored
Apr 13, 2016
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
example with argscope
parent
fbb73a8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
examples/cifar10_convnet.py
examples/cifar10_convnet.py
+14
-17
No files found.
examples/cifar10_convnet.py
View file @
d6d06389
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# File:
cifar10_convne
t.py
# File:
argscope_tes
t.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import
tensorflow
as
tf
...
...
@@ -19,7 +19,7 @@ from tensorpack.dataflow import *
from
tensorpack.dataflow
import
imgaug
"""
CIFAR10 90
%
validation accuracy after
7
0k step.
CIFAR10 90
%
validation accuracy after
4
0k step.
"""
BATCH_SIZE
=
128
...
...
@@ -43,27 +43,24 @@ class Model(ModelDesc):
tf
.
image_summary
(
"train_image"
,
image
,
10
)
image
=
image
/
4.0
# just to make range smaller
l
=
Conv2D
(
'conv1.1'
,
image
,
out_channel
=
64
,
kernel_shape
=
3
,
nl
=
BNReLU
(
is_training
),
use_bias
=
False
)
l
=
Conv2D
(
'conv1.2'
,
l
,
out_channel
=
64
,
kernel_shape
=
3
,
nl
=
BNReLU
(
is_training
),
use_bias
=
False
)
l
=
MaxPooling
(
'pool1'
,
l
,
3
,
stride
=
2
,
padding
=
'SAME'
)
l
=
Conv2D
(
'conv2.1'
,
l
,
out_channel
=
128
,
kernel_shape
=
3
,
nl
=
BNReLU
(
is_training
),
use_bias
=
False
)
l
=
Conv2D
(
'conv2.2'
,
l
,
out_channel
=
128
,
kernel_shape
=
3
,
nl
=
BNReLU
(
is_training
),
use_bias
=
False
)
l
=
MaxPooling
(
'pool2'
,
l
,
3
,
stride
=
2
,
padding
=
'SAME'
)
l
=
Conv2D
(
'conv3.1'
,
l
,
out_channel
=
128
,
kernel_shape
=
3
,
padding
=
'VALID'
,
nl
=
BNReLU
(
is_training
),
use_bias
=
False
)
l
=
Conv2D
(
'conv3.2'
,
l
,
out_channel
=
128
,
kernel_shape
=
3
,
padding
=
'VALID'
,
nl
=
BNReLU
(
is_training
),
use_bias
=
False
)
with
argscope
(
Conv2D
,
nl
=
BNReLU
(
is_training
),
use_bias
=
False
,
kernel_shape
=
3
):
l
=
Conv2D
(
'conv1.1'
,
image
,
out_channel
=
64
)
l
=
Conv2D
(
'conv1.2'
,
l
,
out_channel
=
64
)
l
=
MaxPooling
(
'pool1'
,
l
,
3
,
stride
=
2
,
padding
=
'SAME'
)
l
=
Conv2D
(
'conv2.1'
,
l
,
out_channel
=
128
)
l
=
Conv2D
(
'conv2.2'
,
l
,
out_channel
=
128
)
l
=
MaxPooling
(
'pool2'
,
l
,
3
,
stride
=
2
,
padding
=
'SAME'
)
l
=
Conv2D
(
'conv3.1'
,
l
,
out_channel
=
128
,
padding
=
'VALID'
)
l
=
Conv2D
(
'conv3.2'
,
l
,
out_channel
=
128
,
padding
=
'VALID'
)
l
=
FullyConnected
(
'fc0'
,
l
,
1024
+
512
,
b_init
=
tf
.
constant_initializer
(
0.1
))
l
=
tf
.
nn
.
dropout
(
l
,
keep_prob
)
l
=
FullyConnected
(
'fc1'
,
l
,
out_dim
=
512
,
l
=
FullyConnected
(
'fc1'
,
l
,
512
,
b_init
=
tf
.
constant_initializer
(
0.1
))
# fc will have activation summary by default. disable for the output layer
logits
=
FullyConnected
(
'linear'
,
l
,
out_dim
=
10
,
nl
=
tf
.
identity
)
prob
=
tf
.
nn
.
softmax
(
logits
,
name
=
'output'
)
y
=
one_hot
(
label
,
10
)
cost
=
tf
.
nn
.
softmax_cross_entropy_with_logits
(
logits
,
y
)
...
...
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