"examples/roberta/vscode:/vscode.git/clone" did not exist on "a3882abfbd5e68c2d5d667be63fb670f3783a65b"
Commit b056d20c authored by Vishnu Banna's avatar Vishnu Banna
Browse files

param fix

parent 228ee2ad
...@@ -33,6 +33,8 @@ class YoloDecoder(hyperparams.Config): ...@@ -33,6 +33,8 @@ class YoloDecoder(hyperparams.Config):
use_separable_conv: bool = False use_separable_conv: bool = False
csp_stack: Optional[bool] = None csp_stack: Optional[bool] = None
fpn_depth: Optional[int] = None fpn_depth: Optional[int] = None
max_fpn_depth: Optional[int] = None
max_csp_stack: Optional[int] = None
fpn_filter_scale: Optional[int] = None fpn_filter_scale: Optional[int] = None
path_process_len: Optional[int] = None path_process_len: Optional[int] = None
max_level_process_len: Optional[int] = None max_level_process_len: Optional[int] = None
......
...@@ -4,6 +4,11 @@ runtime: ...@@ -4,6 +4,11 @@ runtime:
distribution_strategy: 'tpu' distribution_strategy: 'tpu'
mixed_precision_dtype: 'float32' mixed_precision_dtype: 'float32'
tpu_enable_xla_dynamic_padder: false tpu_enable_xla_dynamic_padder: false
runtime:
distribution_strategy: 'mirrored'
mixed_precision_dtype: 'float16'
tpu_enable_xla_dynamic_padder: false
num_gpus: 1
task: task:
model: model:
input_size: [640, 640, 3] input_size: [640, 640, 3]
......
...@@ -4,6 +4,11 @@ runtime: ...@@ -4,6 +4,11 @@ runtime:
distribution_strategy: 'tpu' distribution_strategy: 'tpu'
mixed_precision_dtype: 'float32' mixed_precision_dtype: 'float32'
tpu_enable_xla_dynamic_padder: false tpu_enable_xla_dynamic_padder: false
runtime:
distribution_strategy: 'mirrored'
mixed_precision_dtype: 'float16'
tpu_enable_xla_dynamic_padder: false
num_gpus: 1
task: task:
model: model:
input_size: [1280, 1280, 3] input_size: [1280, 1280, 3]
......
...@@ -4,6 +4,11 @@ runtime: ...@@ -4,6 +4,11 @@ runtime:
distribution_strategy: 'tpu' distribution_strategy: 'tpu'
mixed_precision_dtype: 'float32' mixed_precision_dtype: 'float32'
tpu_enable_xla_dynamic_padder: false tpu_enable_xla_dynamic_padder: false
runtime:
distribution_strategy: 'mirrored'
mixed_precision_dtype: 'float16'
tpu_enable_xla_dynamic_padder: false
num_gpus: 1
task: task:
model: model:
input_size: [1536, 1536, 3] input_size: [1536, 1536, 3]
......
...@@ -50,6 +50,8 @@ YOLO_MODELS = { ...@@ -50,6 +50,8 @@ YOLO_MODELS = {
max_level_process_len=None, max_level_process_len=None,
csp_stack=7, csp_stack=7,
fpn_depth=7, fpn_depth=7,
max_fpn_depth=5,
max_csp_stack=5,
path_process_len=8, path_process_len=8,
fpn_filter_scale=1), fpn_filter_scale=1),
), ),
...@@ -87,6 +89,8 @@ class YoloFPN(tf.keras.layers.Layer): ...@@ -87,6 +89,8 @@ class YoloFPN(tf.keras.layers.Layer):
def __init__(self, def __init__(self,
fpn_depth=4, fpn_depth=4,
max_fpn_depth=None,
max_csp_stack=None,
use_spatial_attention=False, use_spatial_attention=False,
csp_stack=False, csp_stack=False,
activation='leaky', activation='leaky',
...@@ -104,8 +108,12 @@ class YoloFPN(tf.keras.layers.Layer): ...@@ -104,8 +108,12 @@ class YoloFPN(tf.keras.layers.Layer):
Args: Args:
fpn_depth: `int`, number of layers to use in each FPN path fpn_depth: `int`, number of layers to use in each FPN path
if you choose to use an FPN. if you choose to use an FPN.
max_fpn_depth: `int`, number of layers to use in each FPN path
if you choose to use an FPN along the largest FPN level.
use_spatial_attention: `bool`, use the spatial attention module. use_spatial_attention: `bool`, use the spatial attention module.
csp_stack: `bool`, CSPize the FPN. csp_stack: `bool`, CSPize the FPN.
max_csp_stack: `int`, number of layers to use for CSP on the largest_path
only.
activation: `str`, the activation function to use typically leaky or mish. activation: `str`, the activation function to use typically leaky or mish.
fpn_filter_scale: `int`, scaling factor for the FPN filters. fpn_filter_scale: `int`, scaling factor for the FPN filters.
use_sync_bn: if True, use synchronized batch normalization. use_sync_bn: if True, use synchronized batch normalization.
...@@ -121,6 +129,7 @@ class YoloFPN(tf.keras.layers.Layer): ...@@ -121,6 +129,7 @@ class YoloFPN(tf.keras.layers.Layer):
super().__init__(**kwargs) super().__init__(**kwargs)
self._fpn_depth = fpn_depth self._fpn_depth = fpn_depth
self._max_fpn_depth = max_fpn_depth or self._fpn_depth
self._activation = activation self._activation = activation
self._use_sync_bn = use_sync_bn self._use_sync_bn = use_sync_bn
...@@ -133,6 +142,7 @@ class YoloFPN(tf.keras.layers.Layer): ...@@ -133,6 +142,7 @@ class YoloFPN(tf.keras.layers.Layer):
self._use_spatial_attention = use_spatial_attention self._use_spatial_attention = use_spatial_attention
self._filter_scale = fpn_filter_scale self._filter_scale = fpn_filter_scale
self._csp_stack = csp_stack self._csp_stack = csp_stack
self._max_csp_stack = max_csp_stack or min(self._max_fpn_depth, csp_stack)
self._base_config = dict( self._base_config = dict(
activation=self._activation, activation=self._activation,
...@@ -184,6 +194,7 @@ class YoloFPN(tf.keras.layers.Layer): ...@@ -184,6 +194,7 @@ class YoloFPN(tf.keras.layers.Layer):
for level, depth in zip( for level, depth in zip(
reversed(range(self._min_level, self._max_level + 1)), self._depths): reversed(range(self._min_level, self._max_level + 1)), self._depths):
if level == self._min_level: if level == self._min_level:
self.resamples[str(level)] = nn_blocks.PathAggregationBlock( self.resamples[str(level)] = nn_blocks.PathAggregationBlock(
filters=depth // 2, filters=depth // 2,
...@@ -211,10 +222,10 @@ class YoloFPN(tf.keras.layers.Layer): ...@@ -211,10 +222,10 @@ class YoloFPN(tf.keras.layers.Layer):
else: else:
self.preprocessors[str(level)] = nn_blocks.DarkRouteProcess( self.preprocessors[str(level)] = nn_blocks.DarkRouteProcess(
filters=depth, filters=depth,
repetitions=self._fpn_depth + 1 * int(self._csp_stack == 0), repetitions=self._max_fpn_depth + 1 * int(self._csp_stack == 0),
insert_spp=True, insert_spp=True,
block_invert=False, block_invert=False,
csp_stack=self._csp_stack, csp_stack=min(self._csp_stack, self._max_fpn_depth),
**self._base_config) **self._base_config)
def call(self, inputs): def call(self, inputs):
...@@ -432,6 +443,8 @@ class YoloDecoder(tf.keras.Model): ...@@ -432,6 +443,8 @@ class YoloDecoder(tf.keras.Model):
use_spatial_attention=False, use_spatial_attention=False,
csp_stack=False, csp_stack=False,
fpn_depth=4, fpn_depth=4,
max_fpn_depth=None,
max_csp_stack=None,
fpn_filter_scale=1, fpn_filter_scale=1,
path_process_len=6, path_process_len=6,
max_level_process_len=None, max_level_process_len=None,
...@@ -478,6 +491,8 @@ class YoloDecoder(tf.keras.Model): ...@@ -478,6 +491,8 @@ class YoloDecoder(tf.keras.Model):
self._input_specs = input_specs self._input_specs = input_specs
self._use_fpn = use_fpn self._use_fpn = use_fpn
self._fpn_depth = fpn_depth self._fpn_depth = fpn_depth
self._max_fpn_depth = max_fpn_depth
self._max_csp_stack = max_csp_stack
self._path_process_len = path_process_len self._path_process_len = path_process_len
self._max_level_process_len = max_level_process_len self._max_level_process_len = max_level_process_len
self._embed_spp = embed_spp self._embed_spp = embed_spp
...@@ -517,8 +532,10 @@ class YoloDecoder(tf.keras.Model): ...@@ -517,8 +532,10 @@ class YoloDecoder(tf.keras.Model):
} }
if self._use_fpn: if self._use_fpn:
inter_outs = YoloFPN( inter_outs = YoloFPN(
fpn_depth=self._fpn_depth, **self._base_config)( fpn_depth=self._fpn_depth,
inputs) max_fpn_depth=self._max_fpn_depth,
max_csp_stack=self._max_csp_stack,
**self._base_config)(inputs)
outputs = YoloPAN(**self._decoder_config)(inter_outs) outputs = YoloPAN(**self._decoder_config)(inter_outs)
else: else:
inter_outs = None inter_outs = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment