vis4d.model.detect.yolox

YOLOX model implementation and runtime.

Classes

YOLOX(num_classes[, basemodel, fpn, ...])

YOLOX detector.

class YOLOX(num_classes, basemodel=None, fpn=None, yolox_head=None, postprocessor=None, weights=None)[source]

YOLOX detector.

Creates an instance of the class.

Parameters:
  • num_classes (int) – Number of classes.

  • basemodel (BaseModel, optional) – Base model. Defaults to None. If None, will use CSPDarknet.

  • fpn (FeaturePyramidProcessing, optional) – Feature Pyramid Processing. Defaults to None. If None, will use YOLOXPAFPN.

  • yolox_head (YOLOXHead, optional) – YOLOX head. Defaults to None. If None, will use YOLOXHead.

  • postprocessor (YOLOXPostprocess, optional) – Post processor. Defaults to None. If None, will use YOLOXPostprocess.

  • weights (None | str, optional) – Weights to load for model. If set to “mmdet”, will load MMDetection pre-trained weights. Defaults to None.

forward(images, input_hw=None, original_hw=None)[source]

Forward pass.

Parameters:
  • images (torch.Tensor) – Input images.

  • input_hw (None | list[tuple[int, int]], optional) – Input image resolutions. Defaults to None.

  • original_hw (None | list[tuple[int, int]], optional) – Original image resolutions (before padding and resizing). Required for testing. Defaults to None.

Returns:

Either raw model outputs (for training) or

predicted outputs (for testing).

Return type:

YOLOXOut | DetOut

forward_test(images, images_hw, original_hw)[source]

Forward testing stage.

Parameters:
  • images (torch.Tensor) – Input images.

  • images_hw (list[tuple[int, int]]) – Input image resolutions.

  • original_hw (list[tuple[int, int]]) – Original image resolutions (before padding and resizing).

Returns:

Predicted outputs.

Return type:

DetOut

forward_train(images)[source]

Forward training stage.

Parameters:

images (torch.Tensor) – Input images.

Returns:

Raw model outputs.

Return type:

YOLOXOut