Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
models
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitsoko services
models
Commits
9681f3fc
Commit
9681f3fc
authored
Nov 24, 2016
by
Daniil Pakhomov
Committed by
Neal Wu
Apr 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit to enable true fully convolutional application of network
parent
2d7bd1d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
vgg.py
slim/nets/vgg.py
+24
-6
No files found.
slim/nets/vgg.py
View file @
9681f3fc
...
@@ -68,7 +68,8 @@ def vgg_a(inputs,
...
@@ -68,7 +68,8 @@ def vgg_a(inputs,
is_training
=
True
,
is_training
=
True
,
dropout_keep_prob
=
0.5
,
dropout_keep_prob
=
0.5
,
spatial_squeeze
=
True
,
spatial_squeeze
=
True
,
scope
=
'vgg_a'
):
scope
=
'vgg_a'
,
fc_conv_padding
=
'VALID'
):
"""Oxford Net VGG 11-Layers version A Example.
"""Oxford Net VGG 11-Layers version A Example.
Note: All the fully_connected layers have been transformed to conv2d layers.
Note: All the fully_connected layers have been transformed to conv2d layers.
...
@@ -83,6 +84,11 @@ def vgg_a(inputs,
...
@@ -83,6 +84,11 @@ def vgg_a(inputs,
spatial_squeeze: whether or not should squeeze the spatial dimensions of the
spatial_squeeze: whether or not should squeeze the spatial dimensions of the
outputs. Useful to remove unnecessary dimensions for classification.
outputs. Useful to remove unnecessary dimensions for classification.
scope: Optional scope for the variables.
scope: Optional scope for the variables.
fc_conv_padding: the type of padding to use for the fully connected layer
that is implemented as a convolutional layer. Use 'SAME' padding if you
are applying the network in a fully convolutional manner and want to
get a prediction map downsampled by a factor of 32 as an output. Otherwise,
the output prediction map will be (input / 32) - 6 in case of 'VALID' padding.
Returns:
Returns:
the last op containing the log predictions and end_points dict.
the last op containing the log predictions and end_points dict.
...
@@ -103,7 +109,7 @@ def vgg_a(inputs,
...
@@ -103,7 +109,7 @@ def vgg_a(inputs,
net
=
slim
.
repeat
(
net
,
2
,
slim
.
conv2d
,
512
,
[
3
,
3
],
scope
=
'conv5'
)
net
=
slim
.
repeat
(
net
,
2
,
slim
.
conv2d
,
512
,
[
3
,
3
],
scope
=
'conv5'
)
net
=
slim
.
max_pool2d
(
net
,
[
2
,
2
],
scope
=
'pool5'
)
net
=
slim
.
max_pool2d
(
net
,
[
2
,
2
],
scope
=
'pool5'
)
# Use conv2d instead of fully_connected layers.
# Use conv2d instead of fully_connected layers.
net
=
slim
.
conv2d
(
net
,
4096
,
[
7
,
7
],
padding
=
'VALID'
,
scope
=
'fc6'
)
net
=
slim
.
conv2d
(
net
,
4096
,
[
7
,
7
],
padding
=
fc_conv_padding
,
scope
=
'fc6'
)
net
=
slim
.
dropout
(
net
,
dropout_keep_prob
,
is_training
=
is_training
,
net
=
slim
.
dropout
(
net
,
dropout_keep_prob
,
is_training
=
is_training
,
scope
=
'dropout6'
)
scope
=
'dropout6'
)
net
=
slim
.
conv2d
(
net
,
4096
,
[
1
,
1
],
scope
=
'fc7'
)
net
=
slim
.
conv2d
(
net
,
4096
,
[
1
,
1
],
scope
=
'fc7'
)
...
@@ -127,7 +133,8 @@ def vgg_16(inputs,
...
@@ -127,7 +133,8 @@ def vgg_16(inputs,
is_training
=
True
,
is_training
=
True
,
dropout_keep_prob
=
0.5
,
dropout_keep_prob
=
0.5
,
spatial_squeeze
=
True
,
spatial_squeeze
=
True
,
scope
=
'vgg_16'
):
scope
=
'vgg_16'
,
fc_conv_padding
=
'VALID'
):
"""Oxford Net VGG 16-Layers version D Example.
"""Oxford Net VGG 16-Layers version D Example.
Note: All the fully_connected layers have been transformed to conv2d layers.
Note: All the fully_connected layers have been transformed to conv2d layers.
...
@@ -142,6 +149,11 @@ def vgg_16(inputs,
...
@@ -142,6 +149,11 @@ def vgg_16(inputs,
spatial_squeeze: whether or not should squeeze the spatial dimensions of the
spatial_squeeze: whether or not should squeeze the spatial dimensions of the
outputs. Useful to remove unnecessary dimensions for classification.
outputs. Useful to remove unnecessary dimensions for classification.
scope: Optional scope for the variables.
scope: Optional scope for the variables.
fc_conv_padding: the type of padding to use for the fully connected layer
that is implemented as a convolutional layer. Use 'SAME' padding if you
are applying the network in a fully convolutional manner and want to
get a prediction map downsampled by a factor of 32 as an output. Otherwise,
the output prediction map will be (input / 32) - 6 in case of 'VALID' padding.
Returns:
Returns:
the last op containing the log predictions and end_points dict.
the last op containing the log predictions and end_points dict.
...
@@ -162,7 +174,7 @@ def vgg_16(inputs,
...
@@ -162,7 +174,7 @@ def vgg_16(inputs,
net
=
slim
.
repeat
(
net
,
3
,
slim
.
conv2d
,
512
,
[
3
,
3
],
scope
=
'conv5'
)
net
=
slim
.
repeat
(
net
,
3
,
slim
.
conv2d
,
512
,
[
3
,
3
],
scope
=
'conv5'
)
net
=
slim
.
max_pool2d
(
net
,
[
2
,
2
],
scope
=
'pool5'
)
net
=
slim
.
max_pool2d
(
net
,
[
2
,
2
],
scope
=
'pool5'
)
# Use conv2d instead of fully_connected layers.
# Use conv2d instead of fully_connected layers.
net
=
slim
.
conv2d
(
net
,
4096
,
[
7
,
7
],
padding
=
'VALID'
,
scope
=
'fc6'
)
net
=
slim
.
conv2d
(
net
,
4096
,
[
7
,
7
],
padding
=
fc_conv_padding
,
scope
=
'fc6'
)
net
=
slim
.
dropout
(
net
,
dropout_keep_prob
,
is_training
=
is_training
,
net
=
slim
.
dropout
(
net
,
dropout_keep_prob
,
is_training
=
is_training
,
scope
=
'dropout6'
)
scope
=
'dropout6'
)
net
=
slim
.
conv2d
(
net
,
4096
,
[
1
,
1
],
scope
=
'fc7'
)
net
=
slim
.
conv2d
(
net
,
4096
,
[
1
,
1
],
scope
=
'fc7'
)
...
@@ -186,7 +198,8 @@ def vgg_19(inputs,
...
@@ -186,7 +198,8 @@ def vgg_19(inputs,
is_training
=
True
,
is_training
=
True
,
dropout_keep_prob
=
0.5
,
dropout_keep_prob
=
0.5
,
spatial_squeeze
=
True
,
spatial_squeeze
=
True
,
scope
=
'vgg_19'
):
scope
=
'vgg_19'
,
fc_conv_padding
=
'VALID'
):
"""Oxford Net VGG 19-Layers version E Example.
"""Oxford Net VGG 19-Layers version E Example.
Note: All the fully_connected layers have been transformed to conv2d layers.
Note: All the fully_connected layers have been transformed to conv2d layers.
...
@@ -201,6 +214,11 @@ def vgg_19(inputs,
...
@@ -201,6 +214,11 @@ def vgg_19(inputs,
spatial_squeeze: whether or not should squeeze the spatial dimensions of the
spatial_squeeze: whether or not should squeeze the spatial dimensions of the
outputs. Useful to remove unnecessary dimensions for classification.
outputs. Useful to remove unnecessary dimensions for classification.
scope: Optional scope for the variables.
scope: Optional scope for the variables.
fc_conv_padding: the type of padding to use for the fully connected layer
that is implemented as a convolutional layer. Use 'SAME' padding if you
are applying the network in a fully convolutional manner and want to
get a prediction map downsampled by a factor of 32 as an output. Otherwise,
the output prediction map will be (input / 32) - 6 in case of 'VALID' padding.
Returns:
Returns:
the last op containing the log predictions and end_points dict.
the last op containing the log predictions and end_points dict.
...
@@ -221,7 +239,7 @@ def vgg_19(inputs,
...
@@ -221,7 +239,7 @@ def vgg_19(inputs,
net
=
slim
.
repeat
(
net
,
4
,
slim
.
conv2d
,
512
,
[
3
,
3
],
scope
=
'conv5'
)
net
=
slim
.
repeat
(
net
,
4
,
slim
.
conv2d
,
512
,
[
3
,
3
],
scope
=
'conv5'
)
net
=
slim
.
max_pool2d
(
net
,
[
2
,
2
],
scope
=
'pool5'
)
net
=
slim
.
max_pool2d
(
net
,
[
2
,
2
],
scope
=
'pool5'
)
# Use conv2d instead of fully_connected layers.
# Use conv2d instead of fully_connected layers.
net
=
slim
.
conv2d
(
net
,
4096
,
[
7
,
7
],
padding
=
'VALID'
,
scope
=
'fc6'
)
net
=
slim
.
conv2d
(
net
,
4096
,
[
7
,
7
],
padding
=
fc_conv_padding
,
scope
=
'fc6'
)
net
=
slim
.
dropout
(
net
,
dropout_keep_prob
,
is_training
=
is_training
,
net
=
slim
.
dropout
(
net
,
dropout_keep_prob
,
is_training
=
is_training
,
scope
=
'dropout6'
)
scope
=
'dropout6'
)
net
=
slim
.
conv2d
(
net
,
4096
,
[
1
,
1
],
scope
=
'fc7'
)
net
=
slim
.
conv2d
(
net
,
4096
,
[
1
,
1
],
scope
=
'fc7'
)
...
...
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