Comments (3)
I just submitted a pull request for yolov8 example #5506
I hope it can be helpful to you.
from ncnn.
Thanks for the reply. I seem to have a problem running the code.
I tried to print the highest confidence level for the value of out, but the output did not seem to be correct. These confidence levels felt too high.Below is the result and code I printed
ncnn::Mat out;
ex.extract("out0", out);
cv::Mat a(out.h, out.w, CV_32FC1);
memcpy((uchar*)a.data, out.data, out.w * out.h * sizeof(float));
for (int col = 0; col < a.cols; ++col) {
float maxVal = std::numeric_limits::lowest(); // 初始化为可能的最小浮点数
for (int row = 4; row < 84; ++row) { // 从第 4 行到第 83 行(索引从 0 开始)
float value = a.at(row, col);
if (value > maxVal) {
maxVal = value; // 更新最大值
}
}
std::cout << "Column " << col << " max value from row 4 to 84 is: " << maxVal << std::endl;
}
![aed0ff9ba1dc19a003a991696c95244](https://private-user-images.githubusercontent.com/107382486/339487508-2a805d3f-86d1-4ad8-956f-8c6b50a2d2f4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxMjQ5NzIsIm5iZiI6MTcyMjEyNDY3MiwicGF0aCI6Ii8xMDczODI0ODYvMzM5NDg3NTA4LTJhODA1ZDNmLTg2ZDEtNGFkOC05NTZmLThjNmI1MGEyZDJmNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzI3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcyN1QyMzU3NTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02MDY2OGM3YmVjZWMyZjRmMDkzOTJlYjNmNGJlMjljZTgyMzJlZGFlMjIyYjNhNGJhYjQ5Y2UxZDQ2OTE0MWE5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.HpvMNrn9KcW3kb6_ScHiLIY0U_TUequeer7k8a7c8h8)
from ncnn.
Thanks for the reply. I seem to have a problem running the code.
I tried to print the highest confidence level for the value of out, but the output did not seem to be correct. These confidence levels felt too high.Below is the result and code I printed
ncnn::Mat out; ex.extract("out0", out); cv::Mat a(out.h, out.w, CV_32FC1); memcpy((uchar*)a.data, out.data, out.w * out.h * sizeof(float)); for (int col = 0; col < a.cols; ++col) { float maxVal = std::numeric_limits::lowest(); // 初始化为可能的最小浮点数 for (int row = 4; row < 84; ++row) { // 从第 4 行到第 83 行(索引从 0 开始) float value = a.at(row, col); if (value > maxVal) { maxVal = value; // 更新最大值 } } std::cout << "Column " << col << " max value from row 4 to 84 is: " << maxVal << std::endl; }
我知道这个问题,这个原因不是因为我这边的原因,而是您导出的yolov8.ncnn.* 模型是仅固定支持[1,3,640,640]的模型,并不支持动态shape输入造成的。
这个错误的模型会导致输入进去的数据为了保持图像原比例缩放,并不符合模型要求的[1,3,640,640],实际上有可能是[1,3,640,540],所以模型内部会错位读取图像,对结果造成严重偏差。
只是要尝试效果的话,您可以直接把输入的图片用画图工具或者cv::resize() 修改成640x640的尺寸。
pnnx本身是支持动态shape输入的,您可以去参考 https://github.com/pnnx/pnnx?tab=readme-ov-file#------detailed-options
导出正确的支持动态shape输入的模型,期待您的好消息~🤣
from ncnn.
Related Issues (20)
- layer `torch.roll` not exists or registered, with pnnx to ncnn
- 开启多线程后运行变慢 HOT 3
- 人脸检测点位的模型无法在60pro上推理正确,在之前安卓上是正常的 HOT 2
- windows ncnn::create_gpu_instance”: dll 链接不一致 HOT 1
- Harmony OS Next Build shared lib failed when enable vulkan HOT 1
- Inference Issues with YOLOv8 Model Converted to NCNN HOT 2
- How do you set Vulkan allocators for an extractor in python?
- CPU推理没问题GPU 推理报错 HOT 3
- efficientvit onnx转换为ncnn后出现无参数的LayerNorm,推理时ex.extract()返回-100
- ios非调试中ruapu_init异常 HOT 2
- Upgrade cmake_minimum_required version for ndk r27? HOT 3
- 安卓上ncnn开启Vulkan compute推理后,GPU没有被调用? HOT 2
- logaddexp转换失败 HOT 1
- please help getting an error on latest git clone
- Is there an example of yolov8n-segn Android split
- 使用onnx2ncnn转换模型,部分权重变为-nan HOT 2
- Camera ID does not exist
- how to do matrix product in a parallel way?
- 最近想在sm84xx的armv9-a上部署,如何支持armv9-a的sve,sme? HOT 2
- is it possible to adjust scale in ncnn ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ncnn.