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
d5a8f2a8
Commit
d5a8f2a8
authored
Jan 28, 2021
by
Yeqing Li
Committed by
A. Unique TensorFlower
Jan 28, 2021
Browse files
Internal change
PiperOrigin-RevId: 354434423
parent
0d6ce602
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
46 additions
and
3 deletions
+46
-3
official/core/input_reader.py
official/core/input_reader.py
+2
-1
official/vision/beta/configs/experiments/video_classification/k400_3d-resnet50_tpu.yaml
...xperiments/video_classification/k400_3d-resnet50_tpu.yaml
+4
-0
official/vision/beta/configs/experiments/video_classification/k400_slowonly16x4_tpu.yaml
...periments/video_classification/k400_slowonly16x4_tpu.yaml
+4
-0
official/vision/beta/configs/experiments/video_classification/k400_slowonly8x8_tpu.yaml
...xperiments/video_classification/k400_slowonly8x8_tpu.yaml
+4
-0
official/vision/beta/configs/experiments/video_classification/k600_3d-resnet50_tpu.yaml
...xperiments/video_classification/k600_3d-resnet50_tpu.yaml
+4
-0
official/vision/beta/configs/experiments/video_classification/k600_slowonly8x8_tpu.yaml
...xperiments/video_classification/k600_slowonly8x8_tpu.yaml
+4
-0
official/vision/beta/configs/video_classification.py
official/vision/beta/configs/video_classification.py
+4
-0
official/vision/beta/dataloaders/video_input.py
official/vision/beta/dataloaders/video_input.py
+20
-2
No files found.
official/core/input_reader.py
View file @
d5a8f2a8
...
@@ -174,7 +174,8 @@ class InputReader:
...
@@ -174,7 +174,8 @@ class InputReader:
map_func
=
self
.
_dataset_fn
,
map_func
=
self
.
_dataset_fn
,
cycle_length
=
self
.
_cycle_length
,
cycle_length
=
self
.
_cycle_length
,
block_length
=
self
.
_block_length
,
block_length
=
self
.
_block_length
,
num_parallel_calls
=
tf
.
data
.
experimental
.
AUTOTUNE
,
num_parallel_calls
=
(
self
.
_cycle_length
if
self
.
_cycle_length
else
tf
.
data
.
experimental
.
AUTOTUNE
),
deterministic
=
self
.
_deterministic
)
deterministic
=
self
.
_deterministic
)
return
dataset
return
dataset
...
...
official/vision/beta/configs/experiments/video_classification/k400_3d-resnet50_tpu.yaml
View file @
d5a8f2a8
...
@@ -56,6 +56,10 @@ task:
...
@@ -56,6 +56,10 @@ task:
global_batch_size
:
1024
global_batch_size
:
1024
dtype
:
'
bfloat16'
dtype
:
'
bfloat16'
shuffle_buffer_size
:
1024
shuffle_buffer_size
:
1024
aug_max_area_ratio
:
1.0
aug_max_aspect_ratio
:
2.0
aug_min_area_ratio
:
0.08
aug_min_aspect_ratio
:
0.5
validation_data
:
validation_data
:
name
:
kinetics400
name
:
kinetics400
feature_shape
:
!!python/tuple
feature_shape
:
!!python/tuple
...
...
official/vision/beta/configs/experiments/video_classification/k400_slowonly16x4_tpu.yaml
View file @
d5a8f2a8
...
@@ -56,6 +56,10 @@ task:
...
@@ -56,6 +56,10 @@ task:
global_batch_size
:
1024
global_batch_size
:
1024
dtype
:
'
bfloat16'
dtype
:
'
bfloat16'
shuffle_buffer_size
:
1024
shuffle_buffer_size
:
1024
aug_max_area_ratio
:
1.0
aug_max_aspect_ratio
:
2.0
aug_min_area_ratio
:
0.08
aug_min_aspect_ratio
:
0.5
validation_data
:
validation_data
:
name
:
kinetics400
name
:
kinetics400
feature_shape
:
!!python/tuple
feature_shape
:
!!python/tuple
...
...
official/vision/beta/configs/experiments/video_classification/k400_slowonly8x8_tpu.yaml
View file @
d5a8f2a8
...
@@ -56,6 +56,10 @@ task:
...
@@ -56,6 +56,10 @@ task:
global_batch_size
:
1024
global_batch_size
:
1024
dtype
:
'
bfloat16'
dtype
:
'
bfloat16'
shuffle_buffer_size
:
1024
shuffle_buffer_size
:
1024
aug_max_area_ratio
:
1.0
aug_max_aspect_ratio
:
2.0
aug_min_area_ratio
:
0.08
aug_min_aspect_ratio
:
0.5
validation_data
:
validation_data
:
name
:
kinetics400
name
:
kinetics400
feature_shape
:
!!python/tuple
feature_shape
:
!!python/tuple
...
...
official/vision/beta/configs/experiments/video_classification/k600_3d-resnet50_tpu.yaml
View file @
d5a8f2a8
...
@@ -56,6 +56,10 @@ task:
...
@@ -56,6 +56,10 @@ task:
global_batch_size
:
1024
global_batch_size
:
1024
dtype
:
'
bfloat16'
dtype
:
'
bfloat16'
shuffle_buffer_size
:
1024
shuffle_buffer_size
:
1024
aug_max_area_ratio
:
1.0
aug_max_aspect_ratio
:
2.0
aug_min_area_ratio
:
0.08
aug_min_aspect_ratio
:
0.5
validation_data
:
validation_data
:
name
:
kinetics600
name
:
kinetics600
feature_shape
:
!!python/tuple
feature_shape
:
!!python/tuple
...
...
official/vision/beta/configs/experiments/video_classification/k600_slowonly8x8_tpu.yaml
View file @
d5a8f2a8
...
@@ -56,6 +56,10 @@ task:
...
@@ -56,6 +56,10 @@ task:
global_batch_size
:
1024
global_batch_size
:
1024
dtype
:
'
bfloat16'
dtype
:
'
bfloat16'
shuffle_buffer_size
:
1024
shuffle_buffer_size
:
1024
aug_max_area_ratio
:
1.0
aug_max_aspect_ratio
:
2.0
aug_min_area_ratio
:
0.08
aug_min_aspect_ratio
:
0.5
validation_data
:
validation_data
:
name
:
kinetics600
name
:
kinetics600
feature_shape
:
!!python/tuple
feature_shape
:
!!python/tuple
...
...
official/vision/beta/configs/video_classification.py
View file @
d5a8f2a8
...
@@ -54,6 +54,10 @@ class DataConfig(cfg.DataConfig):
...
@@ -54,6 +54,10 @@ class DataConfig(cfg.DataConfig):
output_audio
:
bool
=
False
output_audio
:
bool
=
False
audio_feature
:
str
=
''
audio_feature
:
str
=
''
audio_feature_shape
:
Tuple
[
int
,
...]
=
(
-
1
,)
audio_feature_shape
:
Tuple
[
int
,
...]
=
(
-
1
,)
aug_min_aspect_ratio
:
float
=
0.5
aug_max_aspect_ratio
:
float
=
2.0
aug_min_area_ratio
:
float
=
0.49
aug_max_area_ratio
:
float
=
1.0
def
kinetics400
(
is_training
):
def
kinetics400
(
is_training
):
...
...
official/vision/beta/dataloaders/video_input.py
View file @
d5a8f2a8
...
@@ -38,6 +38,10 @@ def _process_image(image: tf.Tensor,
...
@@ -38,6 +38,10 @@ def _process_image(image: tf.Tensor,
crop_size
:
int
=
224
,
crop_size
:
int
=
224
,
num_crops
:
int
=
1
,
num_crops
:
int
=
1
,
zero_centering_image
:
bool
=
False
,
zero_centering_image
:
bool
=
False
,
min_aspect_ratio
:
float
=
0.5
,
max_aspect_ratio
:
float
=
2
,
min_area_ratio
:
float
=
0.49
,
max_area_ratio
:
float
=
1.0
,
seed
:
Optional
[
int
]
=
None
)
->
tf
.
Tensor
:
seed
:
Optional
[
int
]
=
None
)
->
tf
.
Tensor
:
"""Processes a serialized image tensor.
"""Processes a serialized image tensor.
...
@@ -58,6 +62,10 @@ def _process_image(image: tf.Tensor,
...
@@ -58,6 +62,10 @@ def _process_image(image: tf.Tensor,
num_crops: Number of crops to perform on the resized frames.
num_crops: Number of crops to perform on the resized frames.
zero_centering_image: If True, frames are normalized to values in [-1, 1].
zero_centering_image: If True, frames are normalized to values in [-1, 1].
If False, values in [0, 1].
If False, values in [0, 1].
min_aspect_ratio: The minimum aspect range for cropping.
max_aspect_ratio: The maximum aspect range for cropping.
min_area_ratio: The minimum area range for cropping.
max_area_ratio: The maximum area range for cropping.
seed: A deterministic seed to use when sampling.
seed: A deterministic seed to use when sampling.
Returns:
Returns:
...
@@ -89,7 +97,9 @@ def _process_image(image: tf.Tensor,
...
@@ -89,7 +97,9 @@ def _process_image(image: tf.Tensor,
if
is_training
:
if
is_training
:
# Standard image data augmentation: random resized crop and random flip.
# Standard image data augmentation: random resized crop and random flip.
image
=
preprocess_ops_3d
.
random_crop_resize
(
image
=
preprocess_ops_3d
.
random_crop_resize
(
image
,
crop_size
,
crop_size
,
num_frames
,
3
,
(
0.5
,
2
),
(
0.08
,
1
))
image
,
crop_size
,
crop_size
,
num_frames
,
3
,
(
min_aspect_ratio
,
max_aspect_ratio
),
(
min_area_ratio
,
max_area_ratio
))
image
=
preprocess_ops_3d
.
random_flip_left_right
(
image
,
seed
)
image
=
preprocess_ops_3d
.
random_flip_left_right
(
image
,
seed
)
else
:
else
:
# Resize images (resize happens only if necessary to save compute).
# Resize images (resize happens only if necessary to save compute).
...
@@ -221,6 +231,10 @@ class Parser(parser.Parser):
...
@@ -221,6 +231,10 @@ class Parser(parser.Parser):
self
.
_label_key
=
label_key
self
.
_label_key
=
label_key
self
.
_dtype
=
tf
.
dtypes
.
as_dtype
(
input_params
.
dtype
)
self
.
_dtype
=
tf
.
dtypes
.
as_dtype
(
input_params
.
dtype
)
self
.
_output_audio
=
input_params
.
output_audio
self
.
_output_audio
=
input_params
.
output_audio
self
.
_min_aspect_ratio
=
input_params
.
aug_min_aspect_ratio
self
.
_max_aspect_ratio
=
input_params
.
aug_max_aspect_ratio
self
.
_min_area_ratio
=
input_params
.
aug_min_area_ratio
self
.
_max_area_ratio
=
input_params
.
aug_max_area_ratio
if
self
.
_output_audio
:
if
self
.
_output_audio
:
self
.
_audio_feature
=
input_params
.
audio_feature
self
.
_audio_feature
=
input_params
.
audio_feature
self
.
_audio_shape
=
input_params
.
audio_feature_shape
self
.
_audio_shape
=
input_params
.
audio_feature_shape
...
@@ -238,7 +252,11 @@ class Parser(parser.Parser):
...
@@ -238,7 +252,11 @@ class Parser(parser.Parser):
stride
=
self
.
_stride
,
stride
=
self
.
_stride
,
num_test_clips
=
self
.
_num_test_clips
,
num_test_clips
=
self
.
_num_test_clips
,
min_resize
=
self
.
_min_resize
,
min_resize
=
self
.
_min_resize
,
crop_size
=
self
.
_crop_size
)
crop_size
=
self
.
_crop_size
,
min_aspect_ratio
=
self
.
_min_aspect_ratio
,
max_aspect_ratio
=
self
.
_max_aspect_ratio
,
min_area_ratio
=
self
.
_min_area_ratio
,
max_area_ratio
=
self
.
_max_area_ratio
)
image
=
tf
.
cast
(
image
,
dtype
=
self
.
_dtype
)
image
=
tf
.
cast
(
image
,
dtype
=
self
.
_dtype
)
features
=
{
'image'
:
image
}
features
=
{
'image'
:
image
}
...
...
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