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
20685639
Commit
20685639
authored
Jul 12, 2022
by
Liangzhe Yuan
Committed by
A. Unique TensorFlower
Jul 12, 2022
Browse files
Add freeze_backbone flag for image_classification.
PiperOrigin-RevId: 460570094
parent
ad83b2db
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
0 deletions
+5
-0
official/projects/vit/configs/image_classification.py
official/projects/vit/configs/image_classification.py
+1
-0
official/vision/configs/image_classification.py
official/vision/configs/image_classification.py
+1
-0
official/vision/tasks/image_classification.py
official/vision/tasks/image_classification.py
+3
-0
No files found.
official/projects/vit/configs/image_classification.py
View file @
20685639
...
...
@@ -63,6 +63,7 @@ class ImageClassificationTask(cfg.TaskConfig):
evaluation
:
Evaluation
=
Evaluation
()
init_checkpoint
:
Optional
[
str
]
=
None
init_checkpoint_modules
:
str
=
'all'
# all or backbone
freeze_backbone
:
bool
=
False
IMAGENET_TRAIN_EXAMPLES
=
1281167
...
...
official/vision/configs/image_classification.py
View file @
20685639
...
...
@@ -97,6 +97,7 @@ class ImageClassificationTask(cfg.TaskConfig):
init_checkpoint_modules
:
str
=
'all'
# all or backbone
model_output_keys
:
Optional
[
List
[
int
]]
=
dataclasses
.
field
(
default_factory
=
list
)
freeze_backbone
:
bool
=
False
@
exp_factory
.
register_config_factory
(
'image_classification'
)
...
...
official/vision/tasks/image_classification.py
View file @
20685639
...
...
@@ -49,6 +49,9 @@ class ImageClassificationTask(base_task.Task):
input_specs
=
input_specs
,
model_config
=
self
.
task_config
.
model
,
l2_regularizer
=
l2_regularizer
)
if
self
.
task_config
.
freeze_backbone
:
model
.
backbone
.
trainable
=
False
return
model
def
initialize
(
self
,
model
:
tf
.
keras
.
Model
):
...
...
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