The six scripts under the tools/model_converters
directory can help users convert the keys in the official pre-trained model of YOLO to the format of MMYOLO, and use MMYOLO to fine-tune the model.
Take conversion yolov5s.pt
as an example:
- Clone the official YOLOv5 code to the local (currently the maximum supported version is
v6.1
):
git clone -b v6.1 https://github.com/ultralytics/yolov5.git
cd yolov5
- Download official weight file:
wget https://github.com/ultralytics/yolov5/releases/download/v6.1/yolov5s.pt
- Copy file
tools/model_converters/yolov5_to_mmyolo.py
to the path of YOLOv5 official code clone:
cp ${MMDET_YOLO_PATH}/tools/model_converters/yolov5_to_mmyolo.py yolov5_to_mmyolo.py
- Conversion
python yolov5_to_mmyolo.py --src ${WEIGHT_FILE_PATH} --dst mmyolov5.pt
The converted mmyolov5.pt
can be used by MMYOLO. The official weight conversion of YOLOv6 is also used in the same way.
The conversion of YOLOX model does not need to download the official YOLOX code, just download the weight.
Take conversion yolox_s.pth
as an example:
- Download official weight file:
wget https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_s.pth
- Conversion
python tools/model_converters/yolox_to_mmyolo.py --src yolox_s.pth --dst mmyolox.pt
The converted mmyolox.pt
can be used by MMYOLO.