-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how ncnn support yolov8n? #4476
Comments
I'm also looking into this. So far, I'm seeing the following problem, when using the Inside This line is a problem: Mat weight_data_r2 = weight_data.reshape(maxk, num_input, num_output);
I can't figure out yet what the root cause is. |
can you share your param file? |
|
Here is my YOLOv8 small param file: |
@superbayes @apanand14 @bmharper I have great news 😃! I've recently added official support for Ultralytics YOLOv8 NCNN export ✅ in PR ultralytics/ultralytics#3529 with the help of @nihui which is part of You can now export with CLI:
or Python: from ultralytics import YOLO
# Create a model
model = YOLO('yolov8n.pt')
# Export the model to NCNN with arguments
model.export(format='ncnn', half=True, imgsz=640) Output is a To get this update:
Please let us know if NCNN export is working correctly for you, and don't hesitate to report any other issues you find or feature requests you may have. Happy training with YOLOv8 🚀! |
Thanks for taking the time to work on this @glenn-jocher. Here is a sample of the raw float32 output I'm seeing from layer "out0":
The steps I'm taking are:
The reason I say this is not working, is this:
I can confirm that running Do the numbers that I'm getting make any sense to you? Could it be that the model is tuned for int8 output, and hence the integer pixel coordinates? Even if that was the case, it still doesn't explain why I'm not getting any "person" detections. Thanks! |
I'm going to respond to my own question here, in case anybody else stumbles into this problem: The outputs from the YOLOv8 model are shaped like this:
The first candidate box is column 0. The second candidate box is column 1, etc. In my above example there are 2100 candidate boxes, but the exact number will depend on the The The p0..p79 are the probabilities of each class (assuming the regular 80 class YOLO pretrained models). If you have a custom model, then there could obviously be more or less classes. I don't know whether it makes sense to apply a sigmoid function to the probabilities, but so far I am not applying a sigmoid, but just using them out of the box. The example ncnn code for yolov7 is quite close to a working solution for YOLOv8. With YOLOv8 it's actually quite a bit simpler because there are no anchors. You just walk through all of the candidate boxes, picking out any box where max(p0..p79) is greater than some threshold probability (eg One more note: Before consuming the raw output of the YOLOv8 model, you'll want to transpose it. Each candidate box is 84 elements wide, so if your output is float32, that's a 336 byte stride between each element of the vector. |
针对onnx模型转换的各种问题,推荐使用最新的pnnx工具转换到ncnn pip install pnnx
pnnx model.onnx inputshape=[1,3,224,224] 详细参考文档 |
yolov8 example #5506 |
hi, yolov8 examples are updated with full support for detection, segmentation, classification, pose estimation and obb android demo detailed instruction (zh) |
detail | 详细描述 | 詳細な説明
1,下载官方yolov8n.pt
2,执行命令:
3,get yolov8n.onnx, convert to yolov8n.bin,yolov8.param
4,deploy failed,base on NCNN
希望nihui大佬能够在知乎写一篇教程,讲解如何使用yolov8n
@nihui
thanks a lot!
The text was updated successfully, but these errors were encountered: