turicreate.object_detector.util.stack_annotations

turicreate.object_detector.util.stack_annotations(annotations_sarray)

Converts object detection annotations (ground truth or predictions) to stacked format (an SFrame where each row is one object instance).

Parameters:
annotations_sarray: SArray

An SArray with unstacked predictions, exactly formatted as the annotations column when training an object detector or when making predictions.

Returns:
annotations_sframe: An SFrame with stacked annotations.

Examples

Predictions are returned by the object detector in unstacked format:

>>> predictions = detector.predict(images)

By converting it to stacked format, it is easier to get an overview of object instances:

>>> turicreate.object_detector.util.stack_annotations(predictions)
Data:
+--------+------------+-------+-------+-------+-------+--------+
| row_id | confidence | label |   x   |   y   | width | height |
+--------+------------+-------+-------+-------+-------+--------+
|   0    |    0.98    |  dog  | 123.0 | 128.0 |  80.0 | 182.0  |
|   0    |    0.67    |  cat  | 150.0 | 183.0 | 129.0 | 101.0  |
|   1    |    0.8     |  dog  |  50.0 | 432.0 |  65.0 |  98.0  |
+--------+------------+-------+-------+-------+-------+--------+
[3 rows x 7 columns]