model.yolox

Description

🔲 High performance anchor-free YOLO object detection model.

class Node(config=None, **kwargs)[source]

Initializes and uses YOLOX to infer from an image frame.

The YOLOX node is capable detecting objects from 80 categories. The table of object categories can be found here. The "yolox-tiny" model is used by default and can be changed to one of ("yolox-tiny", "yolox-s", "yolox-m", "yolox-l").

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_format (str) – {“pytorch”, “tensorrt”}, default=”pytorch”
    Defines the weights format of the model.

  • model_type (str) – {“yolox-tiny”, “yolox-s”, “yolox-m”, “yolox-l”}, default=”yolox-tiny”.
    Defines the type of YOLOX model to be used.

  • weights_parent_dir (Optional[str]) – default = null.
    Change the parent directory where weights will be stored by replacing null with an absolute path to the desired directory.

  • input_size (int) – default=416.
    Input image resolution of the YOLOX model.

  • 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.

  • iou_threshold (float) – [0, 1], default = 0.45.
    Overlapping bounding boxes with Intersection over Union (IoU) above the threshold will be discarded.

  • score_threshold (float) – [0, 1], default = 0.25.
    Bounding boxes with confidence score (product of objectness score and classification score) below the threshold will be discarded.

  • agnostic_nms (bool) – default = True.
    Flag to determine if class-agnostic NMS (torchvision.ops.nms) or class-aware NMS (torchvision.ops.batched_nms) should be used.

  • half (bool) – default = False.
    Flag to determine if half-precision floating-point should be used for inference.

  • fuse (bool) – default = False.
    Flag to determine if the convolution and batch normalization layers should be fused for inference.

References

YOLOX: Exceeding YOLO Series in 2021: https://arxiv.org/abs/2107.08430

Inference code and model weights: https://github.com/Megvii-BaseDetection/YOLOX