yolo_v4(pretrained: bool | str = False, weights: YOLOV4Weights | None = None, overrides: object = {})YOLOv4 — CSPDarknet-53 + SPP + PANet (Bochkovskiy et al., 2020).
Builds the paper-cited full-size YOLOv4 detector: CSPDarknet-53 backbone, SPP module on the final stage, PANet (top-down + bottom-up) neck, and 3-scale detection at strides 8 / 16 / 32 with 3 anchors / scale. Default 80 COCO classes; reaches COCO test-dev AP of 43.5% at 65 fps on Tesla V100 (paper Table 8).
Model Size
Parameters
pretrainedbool or str= FalseFalse → random init; True →
the DEFAULT tag (YOLOV4Weights.COCO_2017, converted
from the AlexeyAB darknet release's yolov4.weights); a tag
string → that specific checkpoint. Mutually exclusive with
weights (which wins if both are given).YOLOV4Weights.COCO_2017.
Takes precedence over pretrained.**overridesobject= {}YOLOV4Config.Returns
YOLOV4ForObjectDetectionDetector with the standard YOLOv4 configuration applied (or with
overrides merged on top of it).
Notes
See Bochkovskiy et al., "YOLOv4: Optimal Speed and Accuracy of Object Detection", arXiv 2020 (arXiv:2004.10934). The paper's "bag of specials" includes Mish activation, CIoU loss, DropBlock regularisation, Mosaic augmentation, and CmBN — all motivated by independent prior work that YOLOv4 aggregates and tunes together.
Examples
>>> import lucid
>>> from lucid.models.vision.yolo._v4 import yolo_v4
>>> model = yolo_v4()
>>> x = lucid.randn(1, 3, 608, 608)
>>> out = model(x)
>>> out.logits.shape[0]
1