ncnn-yolov12-android

June 12, 2025 ยท View on GitHub

Yolov12 model supports android deployment. Yolov8 and Yolov11 can also be supported.

Please, have some stars for this repo. Thank you! ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ๐ŸŒŸ

Support the latest pnnx export

Download the latest pnnx and put it in the ultralytics directory.

pnnx_ultralytics.png

# -*- coding: UTF-8 -*-
"""
  @Author: mpj
  @Date  : 2025/2/20 18:44
  @version V1.0
"""
from ultralytics import YOLO

if __name__ == '__main__':
    model = YOLO("./weights/yolov12n.pt")
    model.export(**{
        'format': 'ncnn',
        'opset': 12,
        'simplify': True,
        'batch': 1,
        'imgsz': 320,  # This size should be consistent with the following code.
    })

file native-lib.cpp

const int target_sizes[] =
{
    320,
    320,
};

Visualization result

ๅ›พ1 ๅ›พ2 ๅ›พ3 ๅ›พ4