Skip to content

Commit 474b296

Browse files
No public description
PiperOrigin-RevId: 570489626
1 parent bc5c5a3 commit 474b296

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

official/vision/serving/detection.py

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from absl import logging
2121
import tensorflow as tf
2222

23-
from official.core import config_definitions as cfg
2423
from official.vision import configs
2524
from official.vision.modeling import factory
2625
from official.vision.ops import anchor
@@ -32,33 +31,14 @@
3231
class DetectionModule(export_base.ExportModule):
3332
"""Detection Module."""
3433

35-
def __init__(
36-
self,
37-
params: cfg.ExperimentConfig,
38-
*,
39-
input_image_size: list[int],
40-
**kwargs,
41-
):
42-
"""Initializes a detection module for export.
43-
44-
Args:
45-
params: Experiment params.
46-
input_image_size: List or Tuple of size of the input image. For 2D image,
47-
it is [height, width].
48-
**kwargs: All other kwargs are passed to `export_base.ExportModule`; see
49-
the documentation on `export_base.ExportModule` for valid arguments.
50-
"""
51-
if params.task.train_data.parser.pad:
52-
self._padded_size = preprocess_ops.compute_padded_size(
53-
input_image_size, 2**params.task.model.max_level
34+
@property
35+
def _padded_size(self):
36+
if self.params.task.train_data.parser.pad:
37+
return preprocess_ops.compute_padded_size(
38+
self._input_image_size, 2**self.params.task.model.max_level
5439
)
5540
else:
56-
self._padded_size = input_image_size
57-
super().__init__(
58-
params=params,
59-
input_image_size=input_image_size,
60-
**kwargs,
61-
)
41+
return self._input_image_size
6242

6343
def _build_model(self):
6444

0 commit comments

Comments
 (0)