core.processors package

Submodules

core.processors.category_list module

A dictionary object representing the drawing category list.

This dictionary object maps the category ID to the category name.

core.processors.postprocessor module

A Postprocessor module.

This module provides an object-oriented design for postprocessing the outputs of machine learning models.

Classes:

Postprocessor: An abstract base class for creating custom postprocessing implementations. ObjectDetectionPostprocessor: A concrete class implementing the Postprocessor for object

detection model outputs.

FaceRecognitionPostprocessor: A concrete class implementing the Postprocessor for face

recognition model outputs.

class core.processors.postprocessor.FaceRecognitionPostprocessor(drawing: dict)

Bases: core.processors.postprocessor.Postprocessor

A concrete class implementing the Postprocessor for face recognition model outputs.

This class implement postprocess method defined in Postprocessor abstract base class for face recognition model outputs.

Variables

_drawing (dict) – A dict object representing the drawing configuration.

postprocess(frame: numpy.ndarray, outputs: dict) numpy.ndarray

Implement the postprocess method for face recognition model outputs.

The method overrides the postprocess method defined in Postprocessor abstract base class. Postprocess the output by drawing boxes and labels on the input frame for object detection.

class core.processors.postprocessor.ObjectDetectionPostprocessor(drawing: dict)

Bases: core.processors.postprocessor.Postprocessor

A concrete class implementing the Postprocessor for object detection model outputs.

This class implement postprocess method defined in Postprocessor abstract base class for object detection model outputs.

Variables

_drawing (dict) – A dict object representing the drawing configuration.

postprocess(frame: numpy.ndarray, outputs: dict) numpy.ndarray

Implement the postprocess method for object detection model outputs.

The method overrides the postprocess method defined in Postprocessor abstract base class. Postprocess the output by drawing boxes and labels on the input frame for object detection.

class core.processors.postprocessor.Postprocessor

Bases: abc.ABC

An abstract base class for creating custom postprocessing implementations.

This class serves as a blueprint for subclasses that need to implement postprocess method for different types of postprocessing tasks.

abstract postprocess(frame: numpy.ndarray, outputs: dict) numpy.ndarray

Postprocess the output by applying specific operations on the input frame.

Parameters
  • frame (np.ndarray) – An np.ndarray object representing the input frame.

  • outputs (dict) – A dictionary object representing the output from the model.

Returns

An np.ndarray object representing the postprocessed frame.

Return type

np.ndarray

Raises
  • NotImplementedError – If the subclasses don’t implement the method.

  • KeyError – If missing key in outputs.

  • RuntimeError – If any errors during postprocessing.

core.processors.preprocessor module

A Preprocessor module.

This module provides an object-oriented design for preprocessing the input data for machine learning models.

Classes:

Preprocessor: An abstract base class for creating custom preprocessoring implementations.

class core.processors.preprocessor.Preprocessor

Bases: abc.ABC

An abstract base class for creating custom preprocessoring implementations.

This class serves as a blueprint for subclasses that need to implement preprocess method for different types of preprocessing tasks.

abstract preprocess(frame: numpy.ndarray) numpy.ndarray

Preprocess the input frame before feeding it to the model.

Parameters

frame (np.ndarray) – An np.ndarray object representing the input frame.

Returns

An np.ndarray object representing the preprocessed frame.

Return type

np.ndarray

Raises

NotImplementedError – If the subclasses don’t implement the method.

Module contents

The core.processors package.

This package contains the implementations of processors, which are used to process the output from model inference.