turicreate.object_detector.ObjectDetector.predict¶
-
ObjectDetector.
predict
(dataset, confidence_threshold=0.25, iou_threshold=0.45, verbose=True)¶ Predict object instances in an SFrame of images.
Parameters: - dataset : SFrame | SArray | turicreate.Image
The images on which to perform object detection. If dataset is an SFrame, it must have a column with the same name as the feature column during training. Additional columns are ignored.
Returns: - out : SArray
An SArray with model predictions. Each element corresponds to an image and contains a list of dictionaries. Each dictionary describes an object instances that was found in the image. If dataset is a single image, the return value will be a single prediction.
See also
Examples
# Make predictions >>> pred = model.predict(data) # Stack predictions, for a better overview >>> turicreate.object_detector.util.stack_annotations(pred) 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] # Visualize predictions by generating a new column of marked up images >>> data['image_pred'] = turicreate.object_detector.util.draw_bounding_boxes(data['image'], data['predictions'])