Implementation of Yolo using Facebook's Detectron2 (https://github.com/facebookresearch/detectron2) Framework with Quantization support based on AQD: Towards Accurate Quantized Object Detection (https://github.com/aim-uofa/model-quantization)
For anyone looking for pretrained weights, you can convert upstream yolov5 weights using something like the following. This assumes that you've checked out upstream yolov5 at tag v4.0 and downloaded the corresponding yolov5m.pt.
# load yolov5 weights
import sys
sys.path.append("yolov5")
m = torch.load(os.path.join("yolov5m.pt"), map_location=torch.device("cpu"), weights_only=False)
m = m["model"].state_dict()
n = dict()
# remap weights
for k, v in m.items():
if k.startswith("model.24."):
n[k.replace("model.24.", "head.").replace(".bn.", ".conv.norm.")] = v
elif k.startswith("model."):
n[k.replace("model.", "backbone.model.").replace(".bn.", ".conv.norm.")] = v
else:
raise RuntimeError(f"Unexpected key '{k}'")
# save detectron2 weights
torch.save(n, "yolov5m_detectron2.pt")
For anyone looking for pretrained weights, you can convert upstream yolov5 weights using something like the following. This assumes that you've checked out upstream yolov5 at tag v4.0 and downloaded the corresponding yolov5m.pt.