Comments (6)
这个看着是 dest 为空,检查下 convert 的目标指针是否为空吧
from mnn.
from mnn.
from mnn.
已经对dest指针做判空处理,但还是出现。
if(NULL == kv.second)
return NCE_FAILED;
MNN::Tensor *pTensor = kv.second;
NCE_S32 pWidth = pTensor->width();
NCE_S32 pHeight = pTensor->height();
NCE_S32 pChn = pTensor->channel();
NCE_S32 imgSz = pWidth * pHeight;
NCE_U8 * data = (NCE_U8*)pTensor->host<void>();
if (data == NULL)
{
return NCE_FAILED;
}
...
pprocessors->convert(image_datas.image,
image_datas.image_attr.u32Width,
image_datas[count].image_attr.u32Height,
0,
kv.second);
from mnn.
ErrorCode CPUImageProcess::onExecute(const std::vector<Tensor > &inputs, const std::vector<Tensor > &outputs) {
if (0 == mStride) {
mStride = iw * ic;
}
auto source = inputs[0]->host<uint8_t>();
void dest = nullptr;
CV::Point points[2];
auto destBytes = dtype.bytes();
int tileCount = UP_DIV(ow, CACHE_SIZE);
const int regions = nullptr;
if (draw) {
// change input to output
dest = source;
oh = inputs[1]->length(0);
ow = iw;
oc = ic;
destBytes = inputs[0]->getType().bytes();
// draw one
tileCount = 1;
// src is color
samplerDest = inputs[2]->host<uint8_t>();
// get region info ptr
regions = inputs[1]->host();
} else {
dest = outputs[0]->host();
}
if (nullptr == dest)
return INPUT_DATA_ERROR;
for (int i = 0; i < oh; ++i) {
int dy = draw ? regions[3 * i] : i;
auto dstY = (uint8_t*)dest + dy * destBytes * ow * oc;
for (int tIndex = 0; tIndex < tileCount; ++tIndex) {
int xStart = tIndex * CACHE_SIZE;
int count = std::min(CACHE_SIZE, ow - xStart);
if (draw) {
xStart = regions[3 * i + 1];
count = regions[3 * i + 2] - xStart + 1;
}
auto dstStart = dstY + destBytes * oc * xStart;
if (!blitFloat) {
blitDest = dstStart;
}
if (!blitter) {
samplerDest = blitDest;
}
// Sample
if (!draw) {
// Compute position
points[0].fX = xStart;
points[0].fY = dy;
points[1].fX = xStart + count;
points[1].fY = dy;
transform.mapPoints(points, 2);
float deltaY = points[1].fY - points[0].fY;
float deltaX = points[1].fX - points[0].fX;
int sta = 0;
int end = count;
// FUNC_PRINT(sta);
if (wrap == WrapType_ZERO) {
// Clip: Cohen-Sutherland
auto clip = _computeClip(points, iw, ih, transformInvert, xStart, count);
sta = clip.first;
end = clip.second;
points[0].fX = sta + xStart;
points[0].fY = dy;
transform.mapPoints(points, 1);
if (sta != 0 || end < count) {
if (ic > 0) {
if (sta > 0) {
::memset(samplerDest, paddingValue, ic * sta);
}
if (end < count) {
::memset(samplerDest + end * ic, paddingValue, (count - end) * ic);
}
} else {
// TODO, Only support NV12 / NV21
::memset(samplerDest, paddingValue, count);
::memset(samplerDest + count, 128, UP_DIV(count, 2) * 2);
}
}
}
points[1].fX = (deltaX) / (float)(count);
points[1].fY = (deltaY) / (float)(count);
sampler(source, samplerDest, points, sta, end - sta, count, iw, ih, mStride);
}
// Convert format
if (blitter) {
blitter(samplerDest, blitDest, count);
}
// Turn float
if (blitFloat) {
blitFloat(blitDest, (float*)dstStart, mean, normal, count);
上面是onExecute函数的代码,函数void MNNC3ToFloatRGBA(const unsigned char* source, float* dest, const float* mean, const float* normal, size_t count)中的dest指针是通过for循环遍历指针指代进行的,如果在convert中的dest为空,这在onExecute函数中就出现异常了。
from mnn.
Marking as stale. No activity in 60 days.
from mnn.
Related Issues (20)
- 鸿蒙系统编译失败 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 3
- 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 2
- linux x86_64 平台, 多线程情况下, mnn 和推理速度不如 onnx,有可能是什么原因? HOT 4
- 手机端vulkan特性 image_write_without_format这个特性影响大吗?
- mnn 模型,Android 平台 benchmark 测试,推理使用 openCL, vulkan 都比 CPU 慢,可能是什么原因?
- 鸿蒙32位 推理速度异常缓慢 HOT 2
- demo. exec segment.cpp推理为纯黑图,改变后处理后,推理结果正常 HOT 4
- 可以出一个详细的在android平台训练模型的教程吗?
- ModuleBasic.out 测试 mnn 模型,load 模型阶段,报错 “PipelineModule:: Can't find enough output from the model, finded is” HOT 2
- opencl ssd 量化
- Python 多次推理会有结果不一致的情况
- 编译android release的libMNN.so的时候怎样可以保留带symbol的so,方便上线定位crash
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.