Comments (8)
- ios 用 opencl 推理无效。应该是回退到了 CPU 单线程,检查一下是否 pytorch 是用的多线程。opencl 建议换成 metal 或 CPU
- 第一次推理时包括 resize 过程,可能会做权重重排、autotuning 等耗时工作,从第二次推理开始计时,或者创建 module 时,设置 config.shapeMutable = false
from mnn.
图片的resize是在预处理阶段用opencv resize的。mnn也会默认在resize一次吗。config.shapeMutable = false这行代码已添加。连着调用两次mdule->onForward(inputs);方法打印时间感觉没有太多改善。为什么呢?。MNN第一次推断耗时: 1.92365 seconds。MNN第二次推断耗时: 1.91053 seconds
from mnn.
pytorch也没有用多线程。在手机上跑的。也是cpu推断的。
from mnn.
你现在的测试代码是什么?是否用多线程要看下 cpu 占用率
from mnn.
另外你运行的 ios 设备是什么? mnn 是怎么编译的,最好用 release 的 framework
from mnn.
是我的问题。我直接下载的release2.8.1。跑的demo。默认mnn库是debug模式。我改成release就比pytorch快很多了。
from mnn.
新的模型mnn推断耗时比pytorch推断耗时长。pytorch耗时:1.65418 seconds.mnn耗时:1.7395 seconds.为什么呢?代码如下:
std::vector<MNN::Express::VARP> _mnnInputs;
_mnnInputs.emplace_back(mnnOutput0[2]);
_mnnInputs.emplace_back(mnn0);
_mnnInputs.emplace_back(mnnOutput1[2]);
_mnnInputs.emplace_back(mnn1);
MNN::ScheduleConfig sConfig;
sConfig.type = MNN_FORWARD_CPU;
std::shared_ptr<MNN::Express::Executor::RuntimeManager> rtmgr(MNN::Express::Executor::RuntimeManager::createRuntimeManager(sConfig), MNN::Express::Executor::RuntimeManager::destroy);
rtmgr->setCache(".cachefile");
MNN::Express::Module::Config mdconfig; // default module config
mdconfig.shapeMutable = false;
std::unique_ptr<MNN::Express::Module> mnnGlueMdule(MNN::Express::Module::load({ "desc0", "kpts0", "desc1", "kpts1"}, {"matches0", "mscores0"}, model_file.c_str(), nullptr, &mdconfig));
auto begin = std::chrono::high_resolution_clock::now();
auto mnnGlueOutputs = mnnGlueMdule->onForward(_mnnInputs);
std::chrono::duration<double> end = std::chrono::high_resolution_clock::now() - begin;
// 打印耗时(以秒为单位)
std::cout << "MNN匹配推断耗时: " << end.count() << " seconds" << std::endl;
from mnn.
新的模型重新提 issue 。这个看上去10%差距像是波动原因。多跑几遍再看性能
from mnn.
Related Issues (20)
- 求助!!!!!!!!打印 input_tensor内容全部都是0 HOT 1
- fastOnnxTest 成功 但使用时输出不一致 HOT 2
- 编译示例工程代码报错
- 编译测试工具报错阻塞 HOT 3
- 问一下, 在armv8.2 cpu 手机上, 是否已支持fp16 进行卷积的推理阿? HOT 1
- c++ 链接MNN后,编译报错,无法解析的外部符号 _std_init_once_link_alternate_names_and_abort和_std_min_element_4 HOT 6
- mnncompress量化模型以后大小没有变化 HOT 3
- MNN.cv has the rotation issue in loading some photos from the phone HOT 1
- 求教 expr 中_Fill 的正确用法 HOT 3
- 鸿蒙系统编译失败 HOT 1
- Facing issue with version incapitability between protobuffer library and MNN library while performing mnnquant quantization process using python API of mnn HOT 4
- 多输入模型转换时添加--optimizePrefer 2选项 并基于此使用MNNPythonOfflineQuant离线量化,在arm cpu后端推理输出异常,与x86 cpu推理不对齐 HOT 1
- 请问MNN如何实现使用同一模型做并行推理? HOT 4
- Invalidate buffer to create MNN Module HOT 5
- MNNConvert onnx转mnn 错误,nn.ConvTranspose1d forward 中 pad 会出问题 HOT 7
- How to get SD mnn model used in transformers/diffussion/diffussion_demo
- Android 编译DEMO 出现 Target "MNN_CL_WRAP" of type OBJECT_LIBRARY may not be linked into another target
- 问问MNN的兼容方式 HOT 1
- ios平台 没有getTensor方法 HOT 1
- linux x86_64 平台, 多线程情况下, mnn 和推理速度不如 onnx,有可能是什么原因? HOT 1
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 mnn.