model.yoloο
Description
π² One-stage Object Detection model.
- class Node(config=None, **kwargs)[source]ο
Initializes and uses YOLO model to infer bboxes from image frame.
The yolo node is capable of detecting objects from 80 categories. It uses YOLOv4-tiny by default and can be changed to using YOLOv4. The table of categories can be found here.
- Inputs
img
(numpy.ndarray
): A NumPy array of shape \((height, width, channels)\) containing the image data in BGR format.- Outputs
bboxes
(numpy.ndarray
): A NumPy array of shape \((N, 4)\) containing normalized bounding box coordinates of \(N\) detected objects. Each bounding box is represented as \((x_1, y_1, x_2, y_2)\) where \((x_1, y_1)\) is the top-left corner and \((x_2, y_2)\) is the bottom-right corner. The order corresponds to bbox_labels and bbox_scores.bbox_labels
(numpy.ndarray
): A NumPy array of shape \((N)\) containing strings representing the labels of detected objects. The order corresponds to bboxes and bbox_scores.bbox_scores
(numpy.ndarray
): A NumPy array of shape \((N)\) containing confidence scores \([0, 1]\) of detected objects. The order corresponds to bboxes and bbox_labels.- Configs
model_type (
str
) β {βv4β, βv4tinyβ}, default=βv4tinyβ.
Defines the type of YOLO model to be used.weights_parent_dir (
Optional[str]
) β default = null.
Change the parent directory where weights will be stored by replacingnull
with an absolute path to the desired directory.num_classes (
int
) β default = 80.
Maximum number of objects to be detected.detect (
List[Union[int, str]]
) β default = [0].
List of object class names or IDs to be detected. To detect all classes, refer to the tech note.max_output_size_per_class (
int
) β default = 50.
Maximum number of detected instances for each class in an image.max_total_size (
int
) β default = 50.
Maximum total number of detected instances in an image.iou_threshold (
float
) β [0, 1], default = 0.5.
Overlapping bounding boxes above the specified IoU (Intersection over Union) threshold are discarded.score_threshold (
float
) β [0, 1], default = 0.2.
Bounding box with confidence score less than the specified confidence score threshold is discarded.
References
YOLOv4: Optimal Speed and Accuracy of Object Detection: https://arxiv.org/pdf/2004.10934v1.pdf
Model weights trained by https://github.com/hunglc007/tensorflow-yolov4-tflite
Inference code adapted from https://github.com/zzh8829/yolov3-tf2
Changed in version 1.2.0:
yolo_iou_threshold
is renamed toiou_threshold
.
yolo_score_threshold
is renamed toscore_threshold
.