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
790e49e5
Commit
790e49e5
authored
Mar 23, 2021
by
stephenwu
Browse files
Merge branch 'master' of
https://github.com/tensorflow/models
into run_superglue
parents
8ab018b0
5bb827c3
Changes
378
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
335 additions
and
49 deletions
+335
-49
official/vision/beta/__init__.py
official/vision/beta/__init__.py
+2
-2
official/vision/beta/configs/__init__.py
official/vision/beta/configs/__init__.py
+3
-3
official/vision/beta/configs/backbones.py
official/vision/beta/configs/backbones.py
+15
-4
official/vision/beta/configs/backbones_3d.py
official/vision/beta/configs/backbones_3d.py
+4
-4
official/vision/beta/configs/common.py
official/vision/beta/configs/common.py
+3
-3
official/vision/beta/configs/decoders.py
official/vision/beta/configs/decoders.py
+4
-4
official/vision/beta/configs/experiments/retinanet/coco_spinenet49_mobile_tpu.yaml
...igs/experiments/retinanet/coco_spinenet49_mobile_tpu.yaml
+59
-0
official/vision/beta/configs/experiments/retinanet/coco_spinenet49s_mobile_tpu.yaml
...gs/experiments/retinanet/coco_spinenet49s_mobile_tpu.yaml
+59
-0
official/vision/beta/configs/experiments/retinanet/coco_spinenet49xs_mobile_tpu.yaml
...s/experiments/retinanet/coco_spinenet49xs_mobile_tpu.yaml
+59
-0
official/vision/beta/configs/image_classification.py
official/vision/beta/configs/image_classification.py
+3
-3
official/vision/beta/configs/image_classification_test.py
official/vision/beta/configs/image_classification_test.py
+3
-3
official/vision/beta/configs/maskrcnn.py
official/vision/beta/configs/maskrcnn.py
+3
-3
official/vision/beta/configs/retinanet.py
official/vision/beta/configs/retinanet.py
+85
-3
official/vision/beta/configs/semantic_segmentation.py
official/vision/beta/configs/semantic_segmentation.py
+6
-4
official/vision/beta/configs/semantic_segmentation_test.py
official/vision/beta/configs/semantic_segmentation_test.py
+3
-3
official/vision/beta/configs/video_classification.py
official/vision/beta/configs/video_classification.py
+3
-3
official/vision/beta/configs/video_classification_test.py
official/vision/beta/configs/video_classification_test.py
+3
-3
official/vision/beta/data/__init__.py
official/vision/beta/data/__init__.py
+14
-0
official/vision/beta/data/create_coco_tf_record.py
official/vision/beta/data/create_coco_tf_record.py
+2
-2
official/vision/beta/data/tfrecord_lib.py
official/vision/beta/data/tfrecord_lib.py
+2
-2
No files found.
official/vision/beta/__init__.py
View file @
790e49e5
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Vision package definition."""
"""Vision package definition."""
# Lint as: python3
# Lint as: python3
# pylint: disable=unused-import
# pylint: disable=unused-import
...
...
official/vision/beta/configs/__init__.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Configs package definition."""
"""Configs package definition."""
from
official.vision.beta.configs
import
image_classification
from
official.vision.beta.configs
import
image_classification
...
...
official/vision/beta/configs/backbones.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Backbones configurations."""
"""Backbones configurations."""
from
typing
import
Optional
,
List
from
typing
import
Optional
,
List
...
@@ -69,6 +69,15 @@ class SpineNet(hyperparams.Config):
...
@@ -69,6 +69,15 @@ class SpineNet(hyperparams.Config):
stochastic_depth_drop_rate
:
float
=
0.0
stochastic_depth_drop_rate
:
float
=
0.0
@
dataclasses
.
dataclass
class
SpineNetMobile
(
hyperparams
.
Config
):
"""SpineNet config."""
model_id
:
str
=
'49'
stochastic_depth_drop_rate
:
float
=
0.0
se_ratio
:
float
=
0.2
expand_ratio
:
int
=
6
@
dataclasses
.
dataclass
@
dataclasses
.
dataclass
class
RevNet
(
hyperparams
.
Config
):
class
RevNet
(
hyperparams
.
Config
):
"""RevNet config."""
"""RevNet config."""
...
@@ -81,12 +90,13 @@ class Backbone(hyperparams.OneOfConfig):
...
@@ -81,12 +90,13 @@ class Backbone(hyperparams.OneOfConfig):
"""Configuration for backbones.
"""Configuration for backbones.
Attributes:
Attributes:
type: 'str', type of backbone be used, one the
of
fields below.
type: 'str', type of backbone be used, one
of
the fields below.
resnet: resnet backbone config.
resnet: resnet backbone config.
dilated_resnet: dilated resnet backbone for semantic segmentation config.
dilated_resnet: dilated resnet backbone for semantic segmentation config.
revnet: revnet backbone config.
revnet: revnet backbone config.
efficientnet: efficientnet backbone config.
efficientnet: efficientnet backbone config.
spinenet: spinenet backbone config.
spinenet: spinenet backbone config.
spinenet_mobile: mobile spinenet backbone config.
mobilenet: mobilenet backbone config.
mobilenet: mobilenet backbone config.
"""
"""
type
:
Optional
[
str
]
=
None
type
:
Optional
[
str
]
=
None
...
@@ -95,4 +105,5 @@ class Backbone(hyperparams.OneOfConfig):
...
@@ -95,4 +105,5 @@ class Backbone(hyperparams.OneOfConfig):
revnet
:
RevNet
=
RevNet
()
revnet
:
RevNet
=
RevNet
()
efficientnet
:
EfficientNet
=
EfficientNet
()
efficientnet
:
EfficientNet
=
EfficientNet
()
spinenet
:
SpineNet
=
SpineNet
()
spinenet
:
SpineNet
=
SpineNet
()
spinenet_mobile
:
SpineNetMobile
=
SpineNetMobile
()
mobilenet
:
MobileNet
=
MobileNet
()
mobilenet
:
MobileNet
=
MobileNet
()
official/vision/beta/configs/backbones_3d.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""3D Backbones configurations."""
"""3D Backbones configurations."""
from
typing
import
Optional
,
Tuple
from
typing
import
Optional
,
Tuple
...
@@ -65,7 +65,7 @@ class Backbone3D(hyperparams.OneOfConfig):
...
@@ -65,7 +65,7 @@ class Backbone3D(hyperparams.OneOfConfig):
"""Configuration for backbones.
"""Configuration for backbones.
Attributes:
Attributes:
type: 'str', type of backbone be used, on the
of
fields below.
type: 'str', type of backbone be used, on
e of
the fields below.
resnet: resnet3d backbone config.
resnet: resnet3d backbone config.
"""
"""
type
:
Optional
[
str
]
=
None
type
:
Optional
[
str
]
=
None
...
...
official/vision/beta/configs/common.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Common configurations."""
"""Common configurations."""
# Import libraries
# Import libraries
...
...
official/vision/beta/configs/decoders.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Decoders configurations."""
"""Decoders configurations."""
from
typing
import
Optional
,
List
from
typing
import
Optional
,
List
...
@@ -58,7 +58,7 @@ class Decoder(hyperparams.OneOfConfig):
...
@@ -58,7 +58,7 @@ class Decoder(hyperparams.OneOfConfig):
"""Configuration for decoders.
"""Configuration for decoders.
Attributes:
Attributes:
type: 'str', type of decoder be used, on the
of
fields below.
type: 'str', type of decoder be used, on
e of
the fields below.
fpn: fpn config.
fpn: fpn config.
"""
"""
type
:
Optional
[
str
]
=
None
type
:
Optional
[
str
]
=
None
...
...
official/vision/beta/configs/experiments/retinanet/coco_spinenet49_mobile_tpu.yaml
0 → 100644
View file @
790e49e5
runtime
:
distribution_strategy
:
'
tpu'
mixed_precision_dtype
:
'
bfloat16'
task
:
losses
:
l2_weight_decay
:
3.0e-05
model
:
anchor
:
anchor_size
:
3
aspect_ratios
:
[
0.5
,
1.0
,
2.0
]
num_scales
:
3
backbone
:
spinenet_mobile
:
stochastic_depth_drop_rate
:
0.2
model_id
:
'
49'
se_ratio
:
0.2
type
:
'
spinenet_mobile'
decoder
:
type
:
'
identity'
head
:
num_convs
:
4
num_filters
:
48
use_separable_conv
:
true
input_size
:
[
384
,
384
,
3
]
max_level
:
7
min_level
:
3
norm_activation
:
activation
:
'
swish'
norm_epsilon
:
0.001
norm_momentum
:
0.99
use_sync_bn
:
true
train_data
:
dtype
:
'
bfloat16'
global_batch_size
:
256
is_training
:
true
parser
:
aug_rand_hflip
:
true
aug_scale_max
:
2.0
aug_scale_min
:
0.1
validation_data
:
dtype
:
'
bfloat16'
global_batch_size
:
8
is_training
:
false
trainer
:
checkpoint_interval
:
462
optimizer_config
:
learning_rate
:
stepwise
:
boundaries
:
[
265650
,
272580
]
values
:
[
0.32
,
0.032
,
0.0032
]
type
:
'
stepwise'
warmup
:
linear
:
warmup_learning_rate
:
0.0067
warmup_steps
:
2000
steps_per_loop
:
462
train_steps
:
277200
validation_interval
:
462
validation_steps
:
625
official/vision/beta/configs/experiments/retinanet/coco_spinenet49s_mobile_tpu.yaml
0 → 100644
View file @
790e49e5
runtime
:
distribution_strategy
:
'
tpu'
mixed_precision_dtype
:
'
bfloat16'
task
:
losses
:
l2_weight_decay
:
3.0e-05
model
:
anchor
:
anchor_size
:
3
aspect_ratios
:
[
0.5
,
1.0
,
2.0
]
num_scales
:
3
backbone
:
spinenet_mobile
:
stochastic_depth_drop_rate
:
0.2
model_id
:
'
49S'
se_ratio
:
0.2
type
:
'
spinenet_mobile'
decoder
:
type
:
'
identity'
head
:
num_convs
:
4
num_filters
:
40
use_separable_conv
:
true
input_size
:
[
384
,
384
,
3
]
max_level
:
7
min_level
:
3
norm_activation
:
activation
:
'
swish'
norm_epsilon
:
0.001
norm_momentum
:
0.99
use_sync_bn
:
true
train_data
:
dtype
:
'
bfloat16'
global_batch_size
:
256
is_training
:
true
parser
:
aug_rand_hflip
:
true
aug_scale_max
:
2.0
aug_scale_min
:
0.1
validation_data
:
dtype
:
'
bfloat16'
global_batch_size
:
8
is_training
:
false
trainer
:
checkpoint_interval
:
462
optimizer_config
:
learning_rate
:
stepwise
:
boundaries
:
[
265650
,
272580
]
values
:
[
0.32
,
0.032
,
0.0032
]
type
:
'
stepwise'
warmup
:
linear
:
warmup_learning_rate
:
0.0067
warmup_steps
:
2000
steps_per_loop
:
462
train_steps
:
277200
validation_interval
:
462
validation_steps
:
625
official/vision/beta/configs/experiments/retinanet/coco_spinenet49xs_mobile_tpu.yaml
0 → 100644
View file @
790e49e5
runtime
:
distribution_strategy
:
'
tpu'
mixed_precision_dtype
:
'
bfloat16'
task
:
losses
:
l2_weight_decay
:
3.0e-05
model
:
anchor
:
anchor_size
:
3
aspect_ratios
:
[
0.5
,
1.0
,
2.0
]
num_scales
:
3
backbone
:
spinenet_mobile
:
stochastic_depth_drop_rate
:
0.2
model_id
:
'
49XS'
se_ratio
:
0.2
type
:
'
spinenet_mobile'
decoder
:
type
:
'
identity'
head
:
num_convs
:
4
num_filters
:
24
use_separable_conv
:
false
input_size
:
[
256
,
256
,
3
]
max_level
:
7
min_level
:
3
norm_activation
:
activation
:
'
swish'
norm_epsilon
:
0.001
norm_momentum
:
0.99
use_sync_bn
:
true
train_data
:
dtype
:
'
bfloat16'
global_batch_size
:
256
is_training
:
true
parser
:
aug_rand_hflip
:
true
aug_scale_max
:
2.0
aug_scale_min
:
0.1
validation_data
:
dtype
:
'
bfloat16'
global_batch_size
:
8
is_training
:
false
trainer
:
checkpoint_interval
:
462
optimizer_config
:
learning_rate
:
stepwise
:
boundaries
:
[
265650
,
272580
]
values
:
[
0.32
,
0.032
,
0.0032
]
type
:
'
stepwise'
warmup
:
linear
:
warmup_learning_rate
:
0.0067
warmup_steps
:
2000
steps_per_loop
:
462
train_steps
:
277200
validation_interval
:
462
validation_steps
:
625
official/vision/beta/configs/image_classification.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Image classification configuration definition."""
"""Image classification configuration definition."""
import
os
import
os
from
typing
import
List
,
Optional
from
typing
import
List
,
Optional
...
...
official/vision/beta/configs/image_classification_test.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Tests for image_classification."""
"""Tests for image_classification."""
# pylint: disable=unused-import
# pylint: disable=unused-import
from
absl.testing
import
parameterized
from
absl.testing
import
parameterized
...
...
official/vision/beta/configs/maskrcnn.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Mask R-CNN configuration definition."""
"""Mask R-CNN configuration definition."""
import
os
import
os
...
...
official/vision/beta/configs/retinanet.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""RetinaNet configuration definition."""
"""RetinaNet configuration definition."""
import
os
import
os
...
@@ -300,3 +300,85 @@ def retinanet_spinenet_coco() -> cfg.ExperimentConfig:
...
@@ -300,3 +300,85 @@ def retinanet_spinenet_coco() -> cfg.ExperimentConfig:
])
])
return
config
return
config
@
exp_factory
.
register_config_factory
(
'retinanet_spinenet_mobile_coco'
)
def
retinanet_spinenet_mobile_coco
()
->
cfg
.
ExperimentConfig
:
"""COCO object detection with RetinaNet using Mobile SpineNet backbone."""
train_batch_size
=
256
eval_batch_size
=
8
steps_per_epoch
=
COCO_TRAIN_EXAMPLES
//
train_batch_size
input_size
=
384
config
=
cfg
.
ExperimentConfig
(
runtime
=
cfg
.
RuntimeConfig
(
mixed_precision_dtype
=
'float32'
),
task
=
RetinaNetTask
(
annotation_file
=
os
.
path
.
join
(
COCO_INPUT_PATH_BASE
,
'instances_val2017.json'
),
model
=
RetinaNet
(
backbone
=
backbones
.
Backbone
(
type
=
'spinenet_mobile'
,
spinenet_mobile
=
backbones
.
SpineNetMobile
(
model_id
=
'49'
,
stochastic_depth_drop_rate
=
0.2
)),
decoder
=
decoders
.
Decoder
(
type
=
'identity'
,
identity
=
decoders
.
Identity
()),
head
=
RetinaNetHead
(
num_filters
=
48
,
use_separable_conv
=
True
),
anchor
=
Anchor
(
anchor_size
=
3
),
norm_activation
=
common
.
NormActivation
(
use_sync_bn
=
True
,
activation
=
'swish'
),
num_classes
=
91
,
input_size
=
[
input_size
,
input_size
,
3
],
min_level
=
3
,
max_level
=
7
),
losses
=
Losses
(
l2_weight_decay
=
3e-5
),
train_data
=
DataConfig
(
input_path
=
os
.
path
.
join
(
COCO_INPUT_PATH_BASE
,
'train*'
),
is_training
=
True
,
global_batch_size
=
train_batch_size
,
parser
=
Parser
(
aug_rand_hflip
=
True
,
aug_scale_min
=
0.1
,
aug_scale_max
=
2.0
)),
validation_data
=
DataConfig
(
input_path
=
os
.
path
.
join
(
COCO_INPUT_PATH_BASE
,
'val*'
),
is_training
=
False
,
global_batch_size
=
eval_batch_size
)),
trainer
=
cfg
.
TrainerConfig
(
train_steps
=
600
*
steps_per_epoch
,
validation_steps
=
COCO_VAL_EXAMPLES
//
eval_batch_size
,
validation_interval
=
steps_per_epoch
,
steps_per_loop
=
steps_per_epoch
,
summary_interval
=
steps_per_epoch
,
checkpoint_interval
=
steps_per_epoch
,
optimizer_config
=
optimization
.
OptimizationConfig
({
'optimizer'
:
{
'type'
:
'sgd'
,
'sgd'
:
{
'momentum'
:
0.9
}
},
'learning_rate'
:
{
'type'
:
'stepwise'
,
'stepwise'
:
{
'boundaries'
:
[
575
*
steps_per_epoch
,
590
*
steps_per_epoch
],
'values'
:
[
0.32
*
train_batch_size
/
256.0
,
0.032
*
train_batch_size
/
256.0
,
0.0032
*
train_batch_size
/
256.0
],
}
},
'warmup'
:
{
'type'
:
'linear'
,
'linear'
:
{
'warmup_steps'
:
2000
,
'warmup_learning_rate'
:
0.0067
}
}
})),
restrictions
=
[
'task.train_data.is_training != None'
,
'task.validation_data.is_training != None'
])
return
config
official/vision/beta/configs/semantic_segmentation.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Semantic segmentation configuration definition."""
"""Semantic segmentation configuration definition."""
import
os
import
os
from
typing
import
List
,
Optional
,
Union
from
typing
import
List
,
Optional
,
Union
...
@@ -405,7 +405,9 @@ def seg_deeplabv3plus_cityscapes() -> cfg.ExperimentConfig:
...
@@ -405,7 +405,9 @@ def seg_deeplabv3plus_cityscapes() -> cfg.ExperimentConfig:
config
=
cfg
.
ExperimentConfig
(
config
=
cfg
.
ExperimentConfig
(
task
=
SemanticSegmentationTask
(
task
=
SemanticSegmentationTask
(
model
=
SemanticSegmentationModel
(
model
=
SemanticSegmentationModel
(
num_classes
=
20
,
# Cityscapes uses only 19 semantic classes for train/evaluation.
# The void (background) class is ignored in train and evaluation.
num_classes
=
19
,
input_size
=
[
None
,
None
,
3
],
input_size
=
[
None
,
None
,
3
],
backbone
=
backbones
.
Backbone
(
backbone
=
backbones
.
Backbone
(
type
=
'dilated_resnet'
,
dilated_resnet
=
backbones
.
DilatedResNet
(
type
=
'dilated_resnet'
,
dilated_resnet
=
backbones
.
DilatedResNet
(
...
...
official/vision/beta/configs/semantic_segmentation_test.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Tests for semantic_segmentation."""
"""Tests for semantic_segmentation."""
# pylint: disable=unused-import
# pylint: disable=unused-import
...
...
official/vision/beta/configs/video_classification.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Video classification configuration definition."""
"""Video classification configuration definition."""
from
typing
import
Optional
,
Tuple
from
typing
import
Optional
,
Tuple
import
dataclasses
import
dataclasses
...
...
official/vision/beta/configs/video_classification_test.py
View file @
790e49e5
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -12,7 +11,8 @@
...
@@ -12,7 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
# Lint as: python3
"""Tests for video_classification."""
"""Tests for video_classification."""
# pylint: disable=unused-import
# pylint: disable=unused-import
...
...
official/vision/beta/data/__init__.py
View file @
790e49e5
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
official/vision/beta/data/create_coco_tf_record.py
View file @
790e49e5
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
r
"""Convert raw COCO dataset to TFRecord format.
r
"""Convert raw COCO dataset to TFRecord format.
This scripts follows the label map decoder format and supports detection
This scripts follows the label map decoder format and supports detection
...
...
official/vision/beta/data/tfrecord_lib.py
View file @
790e49e5
# Copyright 202
0
The TensorFlow Authors. All Rights Reserved.
# Copyright 202
1
The TensorFlow Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# ==============================================================================
"""Helper functions for creating TFRecord datasets."""
"""Helper functions for creating TFRecord datasets."""
import
hashlib
import
hashlib
...
...
Prev
1
2
3
4
5
6
7
8
…
19
Next
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