datumaro.plugins.openvino_plugin.samples.otx_custom_object_detection_gen3_atss_interp#
Classes
- class datumaro.plugins.openvino_plugin.samples.otx_custom_object_detection_gen3_atss_interp.OTXATSSModelInterpreter[source]#
Bases:
IModelInterpreter
- h_model = 736#
- w_model = 992#
- preprocess(inp: DatasetItem) Tuple[ndarray | Dict[str, ndarray], PrepInfo] [source]#
Preprocessing an dataset item input.
- Parameters:
img – DatasetItem input
- Returns:
It returns a tuple of preprocessed input and preprocessing information. The preprocessing information will be used in the postprocessing step. One use case for this would be an affine transformation of the output bounding box obtained by object detection models. Input images for those models are usually resized to fit the model input dimensions. As a result, the postprocessing step should refine the model output bounding box to match the original input image size.
- postprocess(pred: Dict[str, ndarray] | List[Dict[str, ndarray]], info: PrepInfo) List[Annotation] [source]#
Postprocess a model prediction.
- Parameters:
pred – Model prediction
info – Preprocessing information coming from the preprocessing step
- Returns:
A list of annotations which is created from the model predictions
- class datumaro.plugins.openvino_plugin.samples.otx_custom_object_detection_gen3_atss_interp.Annotation(*, id: int = 0, attributes: Dict[str, Any] = _Nothing.NOTHING, group: int = 0, object_id: int = -1)[source]#
Bases:
object
A base annotation class.
Derived classes must define the ‘_type’ class variable with a value from the AnnotationType enum.
Method generated by attrs for class Annotation.
- property type: AnnotationType#
- class datumaro.plugins.openvino_plugin.samples.otx_custom_object_detection_gen3_atss_interp.DatasetItem(id: str, *, subset: str | None = None, media: str | MediaElement | None = None, annotations: List[Annotation] | None = None, attributes: Dict[str, Any] | None = None)[source]#
Bases:
object
- media: MediaElement | None#
- annotations: Annotations#
- class datumaro.plugins.openvino_plugin.samples.otx_custom_object_detection_gen3_atss_interp.IModelInterpreter[source]#
Bases:
ABC
- abstract preprocess(inp: DatasetItem) Tuple[ndarray | Dict[str, ndarray], PrepInfo] [source]#
Preprocessing an dataset item input.
- Parameters:
img – DatasetItem input
- Returns:
It returns a tuple of preprocessed input and preprocessing information. The preprocessing information will be used in the postprocessing step. One use case for this would be an affine transformation of the output bounding box obtained by object detection models. Input images for those models are usually resized to fit the model input dimensions. As a result, the postprocessing step should refine the model output bounding box to match the original input image size.
- abstract postprocess(pred: Dict[str, ndarray] | List[Dict[str, ndarray]], info: PrepInfo) List[Annotation] [source]#
Postprocess a model prediction.
- Parameters:
pred – Model prediction
info – Preprocessing information coming from the preprocessing step
- Returns:
A list of annotations which is created from the model predictions
- class datumaro.plugins.openvino_plugin.samples.otx_custom_object_detection_gen3_atss_interp.Image(size: Tuple[int, int] | None = None, ext: str | None = None, *args, **kwargs)[source]#
Bases:
MediaElement
[ndarray
]
- datumaro.plugins.openvino_plugin.samples.otx_custom_object_detection_gen3_atss_interp.create_bboxes_with_rescaling(bboxes: ndarray, labels: ndarray, r_scale: float) List[Bbox] [source]#
- datumaro.plugins.openvino_plugin.samples.otx_custom_object_detection_gen3_atss_interp.rescale_img_keeping_aspect_ratio(img: ndarray, h_model: int, w_model: int, padding: bool = True) RescaledImage [source]#
Rescale image while maintaining its aspect ratio.
This function rescales the input image to fit the requirements of the model input. It also attempts to preserve the original aspect ratio of the input image. If the aspect ratio of the input image does not match the aspect ratio required by the model, the function applies zero padding to the image boundaries to maintain the aspect ratio if padding option is true.
- Parameters:
img – The image to be rescaled.
h_model – The desired height of the image required by the model.
w_model – The desired width of the image required by the model.
padding – If true, pad the output image boundaries to make the output image size (h_model, w_model). Otherwise, there is no pad, so that the output image size can be different with `(h_model, w_model).