# Postprocessor Module

{% hint style="info" %}
This API Reference is based on PySDK 0.20.0.
{% endhint %}

## degirum.postprocessor.InferenceResults

Inference results container class.

This class is a base class for a set of classes designed to handle inference results of particular model types such as classification, detection etc.

{% hint style="info" %}
You never construct model objects yourself. Objects of those classes are returned by various predict methods of [degirum.model.Model](https://docs.degirum.com/pysdk/user-guide-pysdk/api-ref/pages/GfBG9YuP1z73SsOm25XD#degirum.model.model) class.
{% endhint %}

## image <a href="#degirum.postprocessor.inferenceresults.image" id="degirum.postprocessor.inferenceresults.image"></a>

`degirum.postprocessor.InferenceResults.image`

`property`

Original image.

Returned image object type is defined by the selected graphical backend (see [degirum.model.Model.image\_backend](https://docs.degirum.com/pysdk/user-guide-pysdk/api-ref/pages/GfBG9YuP1z73SsOm25XD#degirum.model.model.image_backend)).

## image\_model <a href="#degirum.postprocessor.inferenceresults.image_model" id="degirum.postprocessor.inferenceresults.image_model"></a>

`degirum.postprocessor.InferenceResults.image_model`

`property`

Model input image data: image converted to AI model input specifications.

Image type is raw binary array.

## image\_overlay <a href="#degirum.postprocessor.inferenceresults.image_overlay" id="degirum.postprocessor.inferenceresults.image_overlay"></a>

`degirum.postprocessor.InferenceResults.image_overlay`

`property`

Image with AI inference results drawn on a top of original image.

Drawing details depend on the inference result type:

* For classification models the list of class labels with probabilities is printed below the original image.
* For object detection models bounding boxes of detected object are drawn on the original image.
* For pose detection models detected keypoints and keypoint connections are drawn on the original image.
* For segmentation models detected segments are drawn on the original image.

Returned image object type is defined by the selected graphical backend (see [degirum.model.Model.image\_backend](https://docs.degirum.com/pysdk/user-guide-pysdk/api-ref/pages/GfBG9YuP1z73SsOm25XD#degirum.model.model.image_backend)).

## info <a href="#degirum.postprocessor.inferenceresults.info" id="degirum.postprocessor.inferenceresults.info"></a>

`degirum.postprocessor.InferenceResults.info`

`property`

Input data frame information object.

## overlay\_alpha <a href="#degirum.postprocessor.inferenceresults.overlay_alpha" id="degirum.postprocessor.inferenceresults.overlay_alpha"></a>

`degirum.postprocessor.InferenceResults.overlay_alpha`

`property` `writable`

Alpha-blend weight for overlay details.

## overlay\_blur <a href="#degirum.postprocessor.inferenceresults.overlay_blur" id="degirum.postprocessor.inferenceresults.overlay_blur"></a>

`degirum.postprocessor.InferenceResults.overlay_blur`

`property` `writable`

Overlay blur option. None for no blur, "all" to blur all objects, a class label or list of class labels to blur specific objects.

## overlay\_color <a href="#degirum.postprocessor.inferenceresults.overlay_color" id="degirum.postprocessor.inferenceresults.overlay_color"></a>

`degirum.postprocessor.InferenceResults.overlay_color`

`property` `writable`

Color for inference results drawing on overlay image.

3-element RGB tuple or list of 3-element RGB tuples.

## overlay\_fill\_color <a href="#degirum.postprocessor.inferenceresults.overlay_fill_color" id="degirum.postprocessor.inferenceresults.overlay_fill_color"></a>

`degirum.postprocessor.InferenceResults.overlay_fill_color`

`property` `writable`

Image fill color in case of image padding.

3-element RGB tuple.

## overlay\_font\_scale <a href="#degirum.postprocessor.inferenceresults.overlay_font_scale" id="degirum.postprocessor.inferenceresults.overlay_font_scale"></a>

`degirum.postprocessor.InferenceResults.overlay_font_scale`

`property` `writable`

Font scale to use for overlay text.

## overlay\_line\_width <a href="#degirum.postprocessor.inferenceresults.overlay_line_width" id="degirum.postprocessor.inferenceresults.overlay_line_width"></a>

`degirum.postprocessor.InferenceResults.overlay_line_width`

`property` `writable`

Line width in pixels for inference results drawing on overlay image.

## overlay\_show\_labels <a href="#degirum.postprocessor.inferenceresults.overlay_show_labels" id="degirum.postprocessor.inferenceresults.overlay_show_labels"></a>

`degirum.postprocessor.InferenceResults.overlay_show_labels`

`property` `writable`

Specifies if class labels should be drawn on overlay image.

## overlay\_show\_probabilities <a href="#degirum.postprocessor.inferenceresults.overlay_show_probabilities" id="degirum.postprocessor.inferenceresults.overlay_show_probabilities"></a>

`degirum.postprocessor.InferenceResults.overlay_show_probabilities`

`property` `writable`

Specifies if class probabilities should be drawn on overlay image.

## results <a href="#degirum.postprocessor.inferenceresults.results" id="degirum.postprocessor.inferenceresults.results"></a>

`degirum.postprocessor.InferenceResults.results`

`property`

Inference results list.

Each element of the list is a dictionary containing information about one inference result. The dictionary contents depends on the AI model.

**For classification models** each inference result dictionary contains the following keys:

* `category_id`: class numeric ID.
* `label`: class label string.
* `score`: class probability.

Example

{% code overflow="wrap" %}

```
[
    {'category_id': 0, 'label': 'cat', 'score': 0.99},
    {'category_id': 1, 'label': 'dog', 'score': 0.01}
]

```

{% endcode %}

**For multi-label classification models** each inference result dictionary contains the following keys:

* `classifier`: object class string.
* `results`: list of class labels and its scores. Scores are optional.

The `results` list element is a dictionary with the following keys:

* `label`: class label string.
* `score`: optional class label probability.

Example

{% code overflow="wrap" %}

```
[
    {
        'classifier': 'vehicle color',
        'results': [
            {'label': 'red', 'score': 0.99},
            {'label': 'blue', 'score': 0.01}
         ]
    },
    {
        'classifier': 'vehicle type',
        'results': [
            {'label': 'car', 'score': 0.99},
            {'label': 'truck', 'score': 0.01}
        ]
    }
]

```

{% endcode %}

**For object detection models** each inference result dictionary may contain the following keys:

* `category_id`: detected object class numeric ID.
* `label`: detected object class label string.
* `score`: detected object probability.
* `bbox`: detected object bounding box list `[xtop, ytop, xbot, ybot]`.
* `landmarks`: optional list of keypoints or landmarks. It is the list of dictionaries, one per each keypoint/landmark.
* `mask`: optinal dictionary of run-length encoded (RLE) object segmentation mask array representation.
* `angle`: optional angle (in radians) for rotating bounding box around its center. This is used in the case of oriented bounding boxes.

The `landmarks` list is defined for special cases like pose detection of face points detection results. Each `landmarks` list element is a dictionary with the following keys:

* `category_id`: keypoint numeric ID.
* `label`: keypoint label string.
* `score`: keypoint detection probability.
* `landmark`: keypoint coordinate list `[x,y,visibility,a,b,...]`.
* `connect`: optional list of IDs of connected keypoints.

The `mask` dictionary is defined for the special case of object segmentation results, with the following keys:

* `x_min`: x-coordinate in the model input image at which the top-left corner of the box enclosing this mask should be placed.
* `y_min`: y-coordinate in the model input image at which the top-left corner of the box enclosing this mask should be placed.
* `height`: height of segmentation mask array
* `width`: width of segmentation mask array
* `data`: string representation of a buffer of unsigned 32-bit integers carrying the RLE segmentation mask array.

The object detection keys (`bbox`, `score`, `label`, and `category_id`) must be either all present or all absent. In the former case the result format is suitable to represent pure object detection results. In the later case, one of the following keys must be present:

* the `landmarks` key
* the `mask` key

The following statements are then true:

* If the `landmarks` key is present, the result format is suitable to represent pure landmark detection results, such as pose detection.
* If the `mask` key is present, the result format is suitable to represent pure segmentation results. If, optionally, the `category_id` key is also present, the result format is suitable to represent semantic segmentation results.

When both object detection keys and the `landmarks` key are present, the result format is suitable to represent mixed model results, when the model detects not only object bounding boxes, but also keypoints/landmarks within the bounding box.

When both object detection keys and the `mask` key are present, the result format is suitable to represent mixed model results, when the model detects not only object bounding boxes, but also segmentation masks within the bounding box (i.e. instance segmentation).

Example of pure object detection results:

Example

{% code overflow="wrap" %}

```
[
    {'category_id': 0, 'label': 'cat', 'score': 0.99, 'bbox': [10, 20, 100, 200]},
    {'category_id': 1, 'label': 'dog', 'score': 0.01, 'bbox': [200, 100, 300, 400]}
]

```

{% endcode %}

Example of oriented object detection results:

Example

{% code overflow="wrap" %}

```
[
    {'category_id': 0, 'label': 'car', 'score': 0.99, 'bbox': [10, 20, 100, 200], 'angle': 0.79}
]

```

{% endcode %}

Example of landmark object detection results:

Example

{% code overflow="wrap" %}

```
[
    {
        'landmarks': [
            {'category_id': 0, 'label': 'Nose', 'score': 0.99, 'landmark': [10, 20]},
            {'category_id': 1, 'label': 'LeftEye', 'score': 0.98, 'landmark': [15, 25]},
            {'category_id': 2, 'label': 'RightEye', 'score': 0.97, 'landmark': [18, 28]}
        ]
    }
]

```

{% endcode %}

Example of segmented object detection results:

Example

{% code overflow="wrap" %}

```
[
    {
        'mask': {'x_min': 1, 'y_min': 1, 'height': 2, 'width': 2, 'data': 'AAAAAAEAAAAAAAAAAQAAAAIAAAABAAAA'}
    }
]

```

{% endcode %}

**For hand palm detection** models each inference result dictionary contains the following keys:

* `score`: probability of detected hand.
* `handedness`: probability of right hand.
* `landmarks`: list of dictionaries, one per each hand keypoint.

Each `landmarks` list element is a dictionary with the following keys:

* `label`: classified object class label.
* `category_id`: classified object class index.
* `landmark`: landmark point coordinate list `[x, y, z]`.
* `world_landmark`: metric world landmark point coordinate list `[x, y, z]`.
* `connect`: list of adjacent landmarks indexes.

Example

{% code overflow="wrap" %}

```
[
    {
        'score': 0.99,
        'handedness': 0.98,
        'landmarks': [
            {
                'label': 'Wrist',
                'category_id': 0,
                'landmark': [10, 20, 30],
                'world_landmark': [10, 20, 30],
                'connect': [1]
            },
            {
                'label': 'Thumb',
                'category_id': 1,
                'landmark': [15, 25, 35],
                'world_landmark': [15, 25, 35],
                'connect': [0]
            }
        ]
    }
]

```

{% endcode %}

**For segmentation models** inference result is a single-element list. That single element is a dictionary, containing single key `data`. The value of this key is 2D numpy array of integers, where each integer value represents a class ID of the corresponding pixel. The class IDs are defined by the model label dictionary.

Example

{% code overflow="wrap" %}

```
[
    {
        'data': numpy.array([
            [0, 0, 0, 1, 1, 1],
            [0, 0, 0, 1, 1, 1],
            [0, 0, 0, 1, 1, 1],
            [2, 2, 2, 3, 3, 3],
            [2, 2, 2, 3, 3, 3],
            [2, 2, 2, 3, 3, 3],
        ])
    }
]

```

{% endcode %}

## generate\_colors <a href="#degirum.postprocessor.inferenceresults.generate_colors" id="degirum.postprocessor.inferenceresults.generate_colors"></a>

`degirum.postprocessor.InferenceResults.generate_colors()`

`staticmethod`

Generate a list of unique RGB color tuples.

## generate\_overlay\_color(num\_classes, ...) <a href="#degirum.postprocessor.inferenceresults.generate_overlay_color" id="degirum.postprocessor.inferenceresults.generate_overlay_color"></a>

`degirum.postprocessor.InferenceResults.generate_overlay_color(num_classes, label_dict)`

`staticmethod`

Overlay colors generator.

Parameters:

| Name          | Type   | Description                 | Default    |
| ------------- | ------ | --------------------------- | ---------- |
| `num_classes` | `int`  | number of class categories. | *required* |
| `label_dict`  | `dict` | Model labels dictionary.    | *required* |

Returns:

| Type                 | Description                            |
| -------------------- | -------------------------------------- |
| `Union[list, tuple]` | Overlay color tuple or list of tuples. |

## supported\_types <a href="#degirum.postprocessor.inferenceresults.supported_types" id="degirum.postprocessor.inferenceresults.supported_types"></a>

`degirum.postprocessor.InferenceResults.supported_types()`

`staticmethod`

List supported result types for this postprocessor.

## degirum.postprocessor.\_InferenceResults.InferenceResults

Inference results container class.

This class is a base class for a set of classes designed to handle inference results of particular model types such as classification, detection etc.

{% hint style="info" %}
You never construct model objects yourself. Objects of those classes are returned by various predict methods of [degirum.model.Model](https://docs.degirum.com/pysdk/user-guide-pysdk/api-ref/pages/GfBG9YuP1z73SsOm25XD#degirum.model.model) class.
{% endhint %}

## image <a href="#degirum.postprocessor._inferenceresults.inferenceresults.image" id="degirum.postprocessor._inferenceresults.inferenceresults.image"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.image`

`property`

Original image.

Returned image object type is defined by the selected graphical backend (see [degirum.model.Model.image\_backend](https://docs.degirum.com/pysdk/user-guide-pysdk/api-ref/pages/GfBG9YuP1z73SsOm25XD#degirum.model.model.image_backend)).

## image\_model <a href="#degirum.postprocessor._inferenceresults.inferenceresults.image_model" id="degirum.postprocessor._inferenceresults.inferenceresults.image_model"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.image_model`

`property`

Model input image data: image converted to AI model input specifications.

Image type is raw binary array.

## image\_overlay <a href="#degirum.postprocessor._inferenceresults.inferenceresults.image_overlay" id="degirum.postprocessor._inferenceresults.inferenceresults.image_overlay"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.image_overlay`

`property`

Image with AI inference results drawn on a top of original image.

Drawing details depend on the inference result type:

* For classification models the list of class labels with probabilities is printed below the original image.
* For object detection models bounding boxes of detected object are drawn on the original image.
* For pose detection models detected keypoints and keypoint connections are drawn on the original image.
* For segmentation models detected segments are drawn on the original image.

Returned image object type is defined by the selected graphical backend (see [degirum.model.Model.image\_backend](https://docs.degirum.com/pysdk/user-guide-pysdk/api-ref/pages/GfBG9YuP1z73SsOm25XD#degirum.model.model.image_backend)).

## info <a href="#degirum.postprocessor._inferenceresults.inferenceresults.info" id="degirum.postprocessor._inferenceresults.inferenceresults.info"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.info`

`property`

Input data frame information object.

## overlay\_alpha <a href="#degirum.postprocessor._inferenceresults.inferenceresults.overlay_alpha" id="degirum.postprocessor._inferenceresults.inferenceresults.overlay_alpha"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.overlay_alpha`

`property` `writable`

Alpha-blend weight for overlay details.

## overlay\_blur <a href="#degirum.postprocessor._inferenceresults.inferenceresults.overlay_blur" id="degirum.postprocessor._inferenceresults.inferenceresults.overlay_blur"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.overlay_blur`

`property` `writable`

Overlay blur option. None for no blur, "all" to blur all objects, a class label or list of class labels to blur specific objects.

## overlay\_color <a href="#degirum.postprocessor._inferenceresults.inferenceresults.overlay_color" id="degirum.postprocessor._inferenceresults.inferenceresults.overlay_color"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.overlay_color`

`property` `writable`

Color for inference results drawing on overlay image.

3-element RGB tuple or list of 3-element RGB tuples.

## overlay\_fill\_color <a href="#degirum.postprocessor._inferenceresults.inferenceresults.overlay_fill_color" id="degirum.postprocessor._inferenceresults.inferenceresults.overlay_fill_color"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.overlay_fill_color`

`property` `writable`

Image fill color in case of image padding.

3-element RGB tuple.

## overlay\_font\_scale <a href="#degirum.postprocessor._inferenceresults.inferenceresults.overlay_font_scale" id="degirum.postprocessor._inferenceresults.inferenceresults.overlay_font_scale"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.overlay_font_scale`

`property` `writable`

Font scale to use for overlay text.

## overlay\_line\_width <a href="#degirum.postprocessor._inferenceresults.inferenceresults.overlay_line_width" id="degirum.postprocessor._inferenceresults.inferenceresults.overlay_line_width"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.overlay_line_width`

`property` `writable`

Line width in pixels for inference results drawing on overlay image.

## overlay\_show\_labels <a href="#degirum.postprocessor._inferenceresults.inferenceresults.overlay_show_labels" id="degirum.postprocessor._inferenceresults.inferenceresults.overlay_show_labels"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.overlay_show_labels`

`property` `writable`

Specifies if class labels should be drawn on overlay image.

## overlay\_show\_probabilities <a href="#degirum.postprocessor._inferenceresults.inferenceresults.overlay_show_probabilities" id="degirum.postprocessor._inferenceresults.inferenceresults.overlay_show_probabilities"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.overlay_show_probabilities`

`property` `writable`

Specifies if class probabilities should be drawn on overlay image.

## results <a href="#degirum.postprocessor._inferenceresults.inferenceresults.results" id="degirum.postprocessor._inferenceresults.inferenceresults.results"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.results`

`property`

Inference results list.

Each element of the list is a dictionary containing information about one inference result. The dictionary contents depends on the AI model.

**For classification models** each inference result dictionary contains the following keys:

* `category_id`: class numeric ID.
* `label`: class label string.
* `score`: class probability.

Example

{% code overflow="wrap" %}

```
[
    {'category_id': 0, 'label': 'cat', 'score': 0.99},
    {'category_id': 1, 'label': 'dog', 'score': 0.01}
]

```

{% endcode %}

**For multi-label classification models** each inference result dictionary contains the following keys:

* `classifier`: object class string.
* `results`: list of class labels and its scores. Scores are optional.

The `results` list element is a dictionary with the following keys:

* `label`: class label string.
* `score`: optional class label probability.

Example

{% code overflow="wrap" %}

```
[
    {
        'classifier': 'vehicle color',
        'results': [
            {'label': 'red', 'score': 0.99},
            {'label': 'blue', 'score': 0.01}
         ]
    },
    {
        'classifier': 'vehicle type',
        'results': [
            {'label': 'car', 'score': 0.99},
            {'label': 'truck', 'score': 0.01}
        ]
    }
]

```

{% endcode %}

**For object detection models** each inference result dictionary may contain the following keys:

* `category_id`: detected object class numeric ID.
* `label`: detected object class label string.
* `score`: detected object probability.
* `bbox`: detected object bounding box list `[xtop, ytop, xbot, ybot]`.
* `landmarks`: optional list of keypoints or landmarks. It is the list of dictionaries, one per each keypoint/landmark.
* `mask`: optinal dictionary of run-length encoded (RLE) object segmentation mask array representation.
* `angle`: optional angle (in radians) for rotating bounding box around its center. This is used in the case of oriented bounding boxes.

The `landmarks` list is defined for special cases like pose detection of face points detection results. Each `landmarks` list element is a dictionary with the following keys:

* `category_id`: keypoint numeric ID.
* `label`: keypoint label string.
* `score`: keypoint detection probability.
* `landmark`: keypoint coordinate list `[x,y,visibility,a,b,...]`.
* `connect`: optional list of IDs of connected keypoints.

The `mask` dictionary is defined for the special case of object segmentation results, with the following keys:

* `x_min`: x-coordinate in the model input image at which the top-left corner of the box enclosing this mask should be placed.
* `y_min`: y-coordinate in the model input image at which the top-left corner of the box enclosing this mask should be placed.
* `height`: height of segmentation mask array
* `width`: width of segmentation mask array
* `data`: string representation of a buffer of unsigned 32-bit integers carrying the RLE segmentation mask array.

The object detection keys (`bbox`, `score`, `label`, and `category_id`) must be either all present or all absent. In the former case the result format is suitable to represent pure object detection results. In the later case, one of the following keys must be present:

* the `landmarks` key
* the `mask` key

The following statements are then true:

* If the `landmarks` key is present, the result format is suitable to represent pure landmark detection results, such as pose detection.
* If the `mask` key is present, the result format is suitable to represent pure segmentation results. If, optionally, the `category_id` key is also present, the result format is suitable to represent semantic segmentation results.

When both object detection keys and the `landmarks` key are present, the result format is suitable to represent mixed model results, when the model detects not only object bounding boxes, but also keypoints/landmarks within the bounding box.

When both object detection keys and the `mask` key are present, the result format is suitable to represent mixed model results, when the model detects not only object bounding boxes, but also segmentation masks within the bounding box (i.e. instance segmentation).

Example of pure object detection results:

Example

{% code overflow="wrap" %}

```
[
    {'category_id': 0, 'label': 'cat', 'score': 0.99, 'bbox': [10, 20, 100, 200]},
    {'category_id': 1, 'label': 'dog', 'score': 0.01, 'bbox': [200, 100, 300, 400]}
]

```

{% endcode %}

Example of oriented object detection results:

Example

{% code overflow="wrap" %}

```
[
    {'category_id': 0, 'label': 'car', 'score': 0.99, 'bbox': [10, 20, 100, 200], 'angle': 0.79}
]

```

{% endcode %}

Example of landmark object detection results:

Example

{% code overflow="wrap" %}

```
[
    {
        'landmarks': [
            {'category_id': 0, 'label': 'Nose', 'score': 0.99, 'landmark': [10, 20]},
            {'category_id': 1, 'label': 'LeftEye', 'score': 0.98, 'landmark': [15, 25]},
            {'category_id': 2, 'label': 'RightEye', 'score': 0.97, 'landmark': [18, 28]}
        ]
    }
]

```

{% endcode %}

Example of segmented object detection results:

Example

{% code overflow="wrap" %}

```
[
    {
        'mask': {'x_min': 1, 'y_min': 1, 'height': 2, 'width': 2, 'data': 'AAAAAAEAAAAAAAAAAQAAAAIAAAABAAAA'}
    }
]

```

{% endcode %}

**For hand palm detection** models each inference result dictionary contains the following keys:

* `score`: probability of detected hand.
* `handedness`: probability of right hand.
* `landmarks`: list of dictionaries, one per each hand keypoint.

Each `landmarks` list element is a dictionary with the following keys:

* `label`: classified object class label.
* `category_id`: classified object class index.
* `landmark`: landmark point coordinate list `[x, y, z]`.
* `world_landmark`: metric world landmark point coordinate list `[x, y, z]`.
* `connect`: list of adjacent landmarks indexes.

Example

{% code overflow="wrap" %}

```
[
    {
        'score': 0.99,
        'handedness': 0.98,
        'landmarks': [
            {
                'label': 'Wrist',
                'category_id': 0,
                'landmark': [10, 20, 30],
                'world_landmark': [10, 20, 30],
                'connect': [1]
            },
            {
                'label': 'Thumb',
                'category_id': 1,
                'landmark': [15, 25, 35],
                'world_landmark': [15, 25, 35],
                'connect': [0]
            }
        ]
    }
]

```

{% endcode %}

**For segmentation models** inference result is a single-element list. That single element is a dictionary, containing single key `data`. The value of this key is 2D numpy array of integers, where each integer value represents a class ID of the corresponding pixel. The class IDs are defined by the model label dictionary.

Example

{% code overflow="wrap" %}

```
[
    {
        'data': numpy.array([
            [0, 0, 0, 1, 1, 1],
            [0, 0, 0, 1, 1, 1],
            [0, 0, 0, 1, 1, 1],
            [2, 2, 2, 3, 3, 3],
            [2, 2, 2, 3, 3, 3],
            [2, 2, 2, 3, 3, 3],
        ])
    }
]

```

{% endcode %}

## \_\_init\_\_(\*, ...) <a href="#degirum.postprocessor._inferenceresults.inferenceresults.__init" id="degirum.postprocessor._inferenceresults.inferenceresults.__init"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.__init__(*, inference_results, conversion, input_image=None, model_image=None, draw_color=(255, 255, 128), line_width=3, show_labels=True, show_probabilities=False, alpha='auto', font_scale=1.0, fill_color=(0, 0, 0), blur=None, frame_info=None, label_dictionary={}, input_shape=None)`

Constructor.

{% hint style="info" %}
You never construct [InferenceResults](#degirum.postprocessor._inferenceresults.inferenceresults) objects yourself -- the ancestors of this class are returned as results of AI inferences from [degirum.model.Model.predict](https://docs.degirum.com/pysdk/user-guide-pysdk/api-ref/pages/GfBG9YuP1z73SsOm25XD#degirum.model.model.predict), [degirum.model.Model.predict\_batch](https://docs.degirum.com/pysdk/user-guide-pysdk/api-ref/pages/GfBG9YuP1z73SsOm25XD#degirum.model.model.predict_batch), and [degirum.model.Model.predict\_dir](https://docs.degirum.com/pysdk/user-guide-pysdk/api-ref/pages/GfBG9YuP1z73SsOm25XD#degirum.model.model.predict_dir) methods.
{% endhint %}

Parameters:

| Name                 | Type                     | Description                                                                                                                                                                                                               | Default           |
| -------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| `inference_results`  | `list`                   | Inference results data.                                                                                                                                                                                                   | *required*        |
| `conversion`         | `Callable`               | Coordinate conversion function accepting two arguments `(x,y)` and returning two-element tuple. This function should convert model-based coordinates to input image coordinates.                                          | *required*        |
| `input_image`        | `any`                    | Original input data.                                                                                                                                                                                                      | `None`            |
| `model_image`        | `any`                    | Input data converted per AI model input specifications.                                                                                                                                                                   | `None`            |
| `draw_color`         | `tuple`                  | Color for inference results drawing on overlay image.                                                                                                                                                                     | `(255, 255, 128)` |
| `line_width`         | `int`                    | Line width in pixels for inference results drawing on overlay image.                                                                                                                                                      | `3`               |
| `show_labels`        | `bool`                   | True to draw class labels on overlay image.                                                                                                                                                                               | `True`            |
| `show_probabilities` | `bool`                   | True to draw class probabilities on overlay image.                                                                                                                                                                        | `False`           |
| `alpha`              | `Union[float, str]`      | Alpha-blend weight for overlay details.                                                                                                                                                                                   | `'auto'`          |
| `font_scale`         | `float`                  | Font scale to use for overlay text.                                                                                                                                                                                       | `1.0`             |
| `fill_color`         | `tuple`                  | RGB color tuple to use for filling if any form of padding is used.                                                                                                                                                        | `(0, 0, 0)`       |
| `blur`               | `Union[str, list, None]` | Optional blur parameter to apply to the overlay image. If None, no blur is applied. If "all" all objects are blurred. If a class label or a list of class labels is provided, only objects with those labels are blurred. | `None`            |
| `frame_info`         | `any`                    | Input data frame information object.                                                                                                                                                                                      | `None`            |
| `label_dictionary`   | `dict[str, str]`         | Model label dictionary.                                                                                                                                                                                                   | `{}`              |
| `input_shape(list)`  |                          | Model input shape. Mandatory for image-type postprocessing.                                                                                                                                                               | *required*        |

## \_\_str\_\_ <a href="#degirum.postprocessor._inferenceresults.inferenceresults.__str" id="degirum.postprocessor._inferenceresults.inferenceresults.__str"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.__str__()`

Conversion to string

## generate\_colors <a href="#degirum.postprocessor._inferenceresults.inferenceresults.generate_colors" id="degirum.postprocessor._inferenceresults.inferenceresults.generate_colors"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.generate_colors()`

`staticmethod`

Generate a list of unique RGB color tuples.

## generate\_overlay\_color(num\_classes, ...) <a href="#degirum.postprocessor._inferenceresults.inferenceresults.generate_overlay_color" id="degirum.postprocessor._inferenceresults.inferenceresults.generate_overlay_color"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.generate_overlay_color(num_classes, label_dict)`

`staticmethod`

Overlay colors generator.

Parameters:

| Name          | Type   | Description                 | Default    |
| ------------- | ------ | --------------------------- | ---------- |
| `num_classes` | `int`  | number of class categories. | *required* |
| `label_dict`  | `dict` | Model labels dictionary.    | *required* |

Returns:

| Type                 | Description                            |
| -------------------- | -------------------------------------- |
| `Union[list, tuple]` | Overlay color tuple or list of tuples. |

## supported\_types <a href="#degirum.postprocessor._inferenceresults.inferenceresults.supported_types" id="degirum.postprocessor._inferenceresults.inferenceresults.supported_types"></a>

`degirum.postprocessor._InferenceResults.InferenceResults.supported_types()`

`staticmethod`

List supported result types for this postprocessor.

## degirum.postprocessor.\_DetectionResults.DetectionResults

Bases: [InferenceResults](#degirum.postprocessor._inferenceresults.inferenceresults)

InferenceResult class implementation for detection results type

## image\_overlay <a href="#degirum.postprocessor._detectionresults.detectionresults.image_overlay" id="degirum.postprocessor._detectionresults.detectionresults.image_overlay"></a>

`degirum.postprocessor._DetectionResults.DetectionResults.image_overlay`

`property`

Image with AI inference results drawn. Image type is defined by the selected graphical backend.

## \_\_str\_\_ <a href="#degirum.postprocessor._detectionresults.detectionresults.__str" id="degirum.postprocessor._detectionresults.detectionresults.__str"></a>

`degirum.postprocessor._DetectionResults.DetectionResults.__str__()`

Convert inference results to string

## generate\_overlay\_color(num\_classes, ...) <a href="#degirum.postprocessor._detectionresults.detectionresults.generate_overlay_color" id="degirum.postprocessor._detectionresults.detectionresults.generate_overlay_color"></a>

`degirum.postprocessor._DetectionResults.DetectionResults.generate_overlay_color(num_classes, label_dict)`

`staticmethod`

Overlay colors generator.

Parameters:

| Name          | Type   | Description                 | Default    |
| ------------- | ------ | --------------------------- | ---------- |
| `num_classes` | `int`  | number of class categories. | *required* |
| `label_dict`  | `dict` | Model labels dictionary.    | *required* |

Returns:

| Type   | Description                                         |
| ------ | --------------------------------------------------- |
| `list` | general overlay color data for segmentation results |

## supported\_types <a href="#degirum.postprocessor._detectionresults.detectionresults.supported_types" id="degirum.postprocessor._detectionresults.detectionresults.supported_types"></a>

`degirum.postprocessor._DetectionResults.DetectionResults.supported_types()`

`staticmethod`

List supported result types for this postprocessor.

## degirum.postprocessor.\_ClassificationResults.ClassificationResults

Bases: [InferenceResults](#degirum.postprocessor._inferenceresults.inferenceresults)

InferenceResult class implementation for classification results type

## image\_overlay <a href="#degirum.postprocessor._classificationresults.classificationresults.image_overlay" id="degirum.postprocessor._classificationresults.classificationresults.image_overlay"></a>

`degirum.postprocessor._ClassificationResults.ClassificationResults.image_overlay`

`property`

Image with AI inference results drawn. Image type is defined by the selected graphical backend. Each time this property is accessed, new overlay image object is created and all overlay details are redrawn according to the current settings of overlay\_\*\*\* properties.

## overlay\_show\_labels\_below <a href="#degirum.postprocessor._classificationresults.classificationresults.overlay_show_labels_below" id="degirum.postprocessor._classificationresults.classificationresults.overlay_show_labels_below"></a>

`degirum.postprocessor._ClassificationResults.ClassificationResults.overlay_show_labels_below`

`property` `writable`

Specifies if overlay labels should be drawn below the image or on image itself

## \_\_str\_\_ <a href="#degirum.postprocessor._classificationresults.classificationresults.__str" id="degirum.postprocessor._classificationresults.classificationresults.__str"></a>

`degirum.postprocessor._ClassificationResults.ClassificationResults.__str__()`

Convert inference results to string

## supported\_types <a href="#degirum.postprocessor._classificationresults.classificationresults.supported_types" id="degirum.postprocessor._classificationresults.classificationresults.supported_types"></a>

`degirum.postprocessor._ClassificationResults.ClassificationResults.supported_types()`

`staticmethod`

List supported result types for this postprocessor.

## degirum.postprocessor.\_MultiLabelClassificationResults.MultiLabelClassificationResults

Bases: [InferenceResults](#degirum.postprocessor._inferenceresults.inferenceresults)

InferenceResult class implementation for multi-label classification results type

## image\_overlay <a href="#degirum.postprocessor._multilabelclassificationresults.multilabelclassificationresults.image_overlay" id="degirum.postprocessor._multilabelclassificationresults.multilabelclassificationresults.image_overlay"></a>

`degirum.postprocessor._MultiLabelClassificationResults.MultiLabelClassificationResults.image_overlay`

`property`

Image with AI inference results drawn. Image type is defined by the selected graphical backend. Each time this property is accessed, new overlay image object is created and all overlay details are redrawn according to the current settings of overlay\_\*\*\* properties.

## overlay\_show\_labels\_below <a href="#degirum.postprocessor._multilabelclassificationresults.multilabelclassificationresults.overlay_show" id="degirum.postprocessor._multilabelclassificationresults.multilabelclassificationresults.overlay_show"></a>

`degirum.postprocessor._MultiLabelClassificationResults.MultiLabelClassificationResults.overlay_show_labels_below`

`property` `writable`

Specifies if overlay labels should be drawn below the image or on image itself

## \_\_str\_\_ <a href="#degirum.postprocessor._multilabelclassificationresults.multilabelclassificationresults.__str" id="degirum.postprocessor._multilabelclassificationresults.multilabelclassificationresults.__str"></a>

`degirum.postprocessor._MultiLabelClassificationResults.MultiLabelClassificationResults.__str__()`

Convert inference results to string

## supported\_types <a href="#degirum.postprocessor._multilabelclassificationresults.multilabelclassificationresults.supported_typ" id="degirum.postprocessor._multilabelclassificationresults.multilabelclassificationresults.supported_typ"></a>

`degirum.postprocessor._MultiLabelClassificationResults.MultiLabelClassificationResults.supported_types()`

`staticmethod`

List supported result types for this postprocessor.

## degirum.postprocessor.\_SegmentationResults.SegmentationResults

Bases: [InferenceResults](#degirum.postprocessor._inferenceresults.inferenceresults)

InferenceResult class implementation for segmentation results type

## image\_overlay <a href="#degirum.postprocessor._segmentationresults.segmentationresults.image_overlay" id="degirum.postprocessor._segmentationresults.segmentationresults.image_overlay"></a>

`degirum.postprocessor._SegmentationResults.SegmentationResults.image_overlay`

`property`

Image with AI inference results drawn. Image type is defined by the selected graphical backend.

## \_\_str\_\_ <a href="#degirum.postprocessor._segmentationresults.segmentationresults.__str" id="degirum.postprocessor._segmentationresults.segmentationresults.__str"></a>

`degirum.postprocessor._SegmentationResults.SegmentationResults.__str__()`

Convert inference results to string

## generate\_overlay\_color(num\_classes, ...) <a href="#degirum.postprocessor._segmentationresults.segmentationresults.generate_overlay_color" id="degirum.postprocessor._segmentationresults.segmentationresults.generate_overlay_color"></a>

`degirum.postprocessor._SegmentationResults.SegmentationResults.generate_overlay_color(num_classes, label_dict)`

`staticmethod`

Overlay colors generator.

Parameters:

| Name          | Type   | Description                 | Default    |
| ------------- | ------ | --------------------------- | ---------- |
| `num_classes` | `int`  | number of class categories. | *required* |
| `label_dict`  | `dict` | Model labels dictionary.    | *required* |

Returns:

| Type   | Description                                         |
| ------ | --------------------------------------------------- |
| `list` | general overlay color data for segmentation results |

## supported\_types <a href="#degirum.postprocessor._segmentationresults.segmentationresults.supported_types" id="degirum.postprocessor._segmentationresults.segmentationresults.supported_types"></a>

`degirum.postprocessor._SegmentationResults.SegmentationResults.supported_types()`

`staticmethod`

List supported result types for this postprocessor.

## degirum.postprocessor.\_Hand\_DetectionResults.Hand\_DetectionResults

Bases: [InferenceResults](#degirum.postprocessor._inferenceresults.inferenceresults)

InferenceResult class implementation for pose detection results type

## image\_overlay <a href="#degirum.postprocessor._hand_detectionresults.hand_detectionresults.image_overlay" id="degirum.postprocessor._hand_detectionresults.hand_detectionresults.image_overlay"></a>

`degirum.postprocessor._Hand_DetectionResults.Hand_DetectionResults.image_overlay`

`property`

Image with AI inference results drawn. Image type is defined by the selected graphical backend.

## \_\_str\_\_ <a href="#degirum.postprocessor._hand_detectionresults.hand_detectionresults.__str" id="degirum.postprocessor._hand_detectionresults.hand_detectionresults.__str"></a>

`degirum.postprocessor._Hand_DetectionResults.Hand_DetectionResults.__str__()`

Convert inference results to string

## supported\_types <a href="#degirum.postprocessor._hand_detectionresults.hand_detectionresults.supported_types" id="degirum.postprocessor._hand_detectionresults.hand_detectionresults.supported_types"></a>

`degirum.postprocessor._Hand_DetectionResults.Hand_DetectionResults.supported_types()`

`staticmethod`

List supported result types for this postprocessor.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.degirum.com/pysdk/user-guide-pysdk/api-ref/postprocessor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
