Open mabo1215 opened 1 year ago
@mabo1215 I have great news 😃! I've recently added official support for Ultralytics YOLOv8 NCNN export ✅ in PR https://github.com/ultralytics/ultralytics/pull/3529 with the help of @nihui which is part of ultralytics==8.0.129
. NCNN works for all tasks including Detect, Segment, Pose and Classify.
You can now export with CLI:
yolo export model=yolov8n.pt format=ncnn
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 yolov8n_ncnn_model/
directory containing model.bin
, model.param
and metadata.yaml
, along with extra PNNX files. For details see https://github.com/pnnx/pnnx README.
To get this update:
git pull
from within your ultralytics/
directory or run git clone https://github.com/ultralytics/ultralytics
againpip install -U ultralytics
sudo docker pull ultralytics/ultralytics:latest
to update your image 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 🚀!
针对onnx模型转换的各种问题,推荐使用最新的pnnx工具转换到ncnn In view of various problems in onnx model conversion, it is recommended to use the latest pnnx tool to convert your model to ncnn
pip install pnnx
pnnx model.onnx inputshape=[1,3,224,224]
详细参考文档 Detailed reference documentation https://github.com/pnnx/pnnx https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx#how-to-use-pnnx
error log | 日志或报错信息 | ログ
YOLOV8使用自定义数据集训练转化失败。
model | 模型 | モデル
how to reproduce | 复现步骤 | 再現方法
使用自定义数据训练yolov8模型,detect 调用 generate_proposals函数 最后在 generate_proposals函数报错。
其中param 部分内容如下:
7767517 211 256 Input images 0 1 images MemoryData /model.22/Constant_12_output_0 0 1 /model.22/Constant_12_output_0 0=1260 Interp /model.13/Resize 1 1 /model.12/cv2/act/Mul_output_0_splitncnn_1 /model.13/Resize_output_0 0=1 1=2.000000e+00 2=2.000000e+00 3=0 4=0 6=0 Concat /model.14/Concat 2 1 /model.13/Resize_output_0 /model.4/cv2/act/Mul_output_0_splitncnn_0 /model.14/Concat_output_0 0=0 Convolution /model.15/cv1/conv/Conv 1 1 /model.14/Concat_output_0 /model.15/cv1/conv/Conv_output_0 0=128 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 15=0 16=0 5=1 6=49152 Swish /model.15/cv1/act/Mul 1 1 /model.15/cv1/conv/Conv_output_0 /model.15/cv1/act/Mul_output_0 Convolution /model.18/cv1/conv/Conv 1 1 /model.17/Concat_output_0 /model.18/cv1/conv/Conv_output_0 0=256 1=1 11=1 2=1 12=1 3=1 13=1 4=0 14=0 15=0 16=0 5=1 6=98304 Swish /model.18/cv1/act/Mul 1 1 /model.18/cv1/conv/Conv_output_0 /model.18/cv1/act/Mul_output_0 Split splitncnn_26 1 2 /model.22/Add_1_output_0 /model.22/Add_1_output_0_splitncnn_0 /model.22/Add_1_output_0_splitncnn_1 BinaryOp /model.22/Add_2 2 1 /model.22/Sub_output_0_splitncnn_1 /model.22/Add_1_output_0_splitncnn_1 /model.22/Add_2_output_0 0=0 BinaryOp /model.22/Div_1 1 1 /model.22/Add_2_output_0 /model.22/Div_1_output_0 0=3 1=1 2=2.000000e+00 BinaryOp /model.22/Sub_1 2 1 /model.22/Add_1_output_0_splitncnn_0 /model.22/Sub_output_0_splitncnn_0 /model.22/Sub_1_output_0 0=1 Concat /model.22/Concat_4 2 1 /model.22/Div_1_output_0 /model.22/Sub_1_output_0 /model.22/Concat_4_output_0 0=0 BinaryOp /model.22/Mul_2 2 1 /model.22/Concat_4_output_0 /model.22/Constant_12_output_0 /model.22/Mul_2_output_0 0=2 Sigmoid /model.22/Sigmoid 1 1 /model.22/Split_output_1 /model.22/Sigmoid_output_0 Concat /model.22/Concat_5 2 1 /model.22/Mul_2_output_0 /model.22/Sigmoid_output_0 output0 0=0
generate_proposals部分函数如下: static void generate_proposals(std::vector grid_strides, const ncnn::Mat& pred, float prob_threshold, std::vector
//其中 scores数组中没有任何数据,scores[0]也没有数据。 float confidence = scores[k];
} }
scores 输出 为0.0000 , scores[0] 不存在
请问如果调整哪些数据来读取预测的 confidence score