Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
ResNet50_tensorflow
Commits
4d053deb
Commit
4d053deb
authored
Feb 07, 2018
by
Neal Wu
Browse files
Allow users to pass in num_classes to ResNet
parent
7cb653fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
official/resnet/cifar10_main.py
official/resnet/cifar10_main.py
+4
-4
official/resnet/imagenet_main.py
official/resnet/imagenet_main.py
+4
-4
No files found.
official/resnet/cifar10_main.py
View file @
4d053deb
...
...
@@ -129,9 +129,9 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1,
# Running the model
###############################################################################
class
Cifar10Model
(
resnet
.
Model
):
def
__init__
(
self
,
resnet_size
,
data_format
=
None
):
"""These are the parameters that work for CIFAR-10 data.
"""
def
__init__
(
self
,
resnet_size
,
data_format
=
None
,
num_classes
=
_NUM_CLASSES
):
"""
These are the parameters that work for CIFAR-10 data."""
if
resnet_size
%
6
!=
2
:
raise
ValueError
(
'resnet_size must be 6n + 2:'
,
resnet_size
)
...
...
@@ -139,7 +139,7 @@ class Cifar10Model(resnet.Model):
super
(
Cifar10Model
,
self
).
__init__
(
resnet_size
=
resnet_size
,
num_classes
=
_NUM_CLASSES
,
num_classes
=
num_classes
,
num_filters
=
16
,
kernel_size
=
3
,
conv_stride
=
1
,
...
...
official/resnet/imagenet_main.py
View file @
4d053deb
...
...
@@ -132,9 +132,9 @@ def input_fn(is_training, data_dir, batch_size, num_epochs=1,
# Running the model
###############################################################################
class
ImagenetModel
(
resnet
.
Model
):
def
__init__
(
self
,
resnet_size
,
data_format
=
None
):
"""These are the parameters that work for Imagenet data.
"""
def
__init__
(
self
,
resnet_size
,
data_format
=
None
,
num_classes
=
_NUM_CLASSES
):
"""
These are the parameters that work for Imagenet data."""
# For bigger models, we want to use "bottleneck" layers
if
resnet_size
<
50
:
...
...
@@ -146,7 +146,7 @@ class ImagenetModel(resnet.Model):
super
(
ImagenetModel
,
self
).
__init__
(
resnet_size
=
resnet_size
,
num_classes
=
_NUM_CLASSES
,
num_classes
=
num_classes
,
num_filters
=
64
,
kernel_size
=
7
,
conv_stride
=
2
,
...
...
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