We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在Mat中有一个成员变量:size_t cstep,看使用方式的话就是一个通道的像素个数,或者对齐了单通道的像素个数,但是为什么在squeezenet.cpp文件中代码中: for (int j=0; j<out.c; j++) { const float* prob = out.data + out.cstep * j; cls_scores[j] = prob[0]; } 取出out的数据的时候要这样取,out.data本身就是一个float的指针,而打印out的shape的话就是一个1x1x1000的Mat,相当于就是一个向量不能够直接进行out.data[j]这样取吗?为什么这样取的时候结果不一致,打印out.cstep为4,上面代码中这样取是想说out中的数据是按照行存储,然后每行4个float,只有第一个float有效,是这样吗?因为out.data为float指针,加上后面的数据就跳了后面指定个数的float个字节.不知道说的对不对,希望大神能够解答一下,谢谢
The text was updated successfully, but these errors were encountered:
同上。out里的数据想全取出来,需要做什么
Sorry, something went wrong.
每个channel的实际存储大小是4的倍数,所以1x1也占用了4个float 如果希望是数组连续访问可以调用 reshape
Mat array = out.reshape(out.w*out.h*out.c); float* arrayptr = array; // use your plain array
No branches or pull requests
在Mat中有一个成员变量:size_t cstep,看使用方式的话就是一个通道的像素个数,或者对齐了单通道的像素个数,但是为什么在squeezenet.cpp文件中代码中:
for (int j=0; j<out.c; j++)
{
const float* prob = out.data + out.cstep * j;
cls_scores[j] = prob[0];
}
取出out的数据的时候要这样取,out.data本身就是一个float的指针,而打印out的shape的话就是一个1x1x1000的Mat,相当于就是一个向量不能够直接进行out.data[j]这样取吗?为什么这样取的时候结果不一致,打印out.cstep为4,上面代码中这样取是想说out中的数据是按照行存储,然后每行4个float,只有第一个float有效,是这样吗?因为out.data为float指针,加上后面的数据就跳了后面指定个数的float个字节.不知道说的对不对,希望大神能够解答一下,谢谢
The text was updated successfully, but these errors were encountered: