decoders.py 1.6 KB
Newer Older
A. Unique TensorFlower's avatar
A. Unique TensorFlower committed
1
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
Vishnu Banna's avatar
Vishnu Banna committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
# 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.

"""Decoders configurations."""
Vishnu Banna's avatar
Vishnu Banna committed
16
import dataclasses
17
from typing import Optional
Vishnu Banna's avatar
Vishnu Banna committed
18
from official.modeling import hyperparams
Abdullah Rashwan's avatar
Abdullah Rashwan committed
19
from official.vision.configs import decoders
Vishnu Banna's avatar
Vishnu Banna committed
20

21

Vishnu Banna's avatar
Vishnu Banna committed
22
23
@dataclasses.dataclass
class YoloDecoder(hyperparams.Config):
24
25
26
27
28
  """Builds Yolo decoder.

  If the name is specified, or version is specified we ignore input parameters
  and use version and name defaults.
  """
Vishnu Banna's avatar
Vishnu Banna committed
29
30
31
32
33
34
35
  version: Optional[str] = None
  type: Optional[str] = None
  use_fpn: Optional[bool] = None
  use_spatial_attention: bool = False
  use_separable_conv: bool = False
  csp_stack: Optional[bool] = None
  fpn_depth: Optional[int] = None
36
37
  max_fpn_depth: Optional[int] = None
  max_csp_stack: Optional[int] = None
Vishnu Banna's avatar
Vishnu Banna committed
38
39
40
41
42
43
  fpn_filter_scale: Optional[int] = None
  path_process_len: Optional[int] = None
  max_level_process_len: Optional[int] = None
  embed_spp: Optional[bool] = None
  activation: Optional[str] = 'same'

44

Vishnu Banna's avatar
Vishnu Banna committed
45
46
47
48
@dataclasses.dataclass
class Decoder(decoders.Decoder):
  type: Optional[str] = 'yolo_decoder'
  yolo_decoder: YoloDecoder = YoloDecoder()