【问题标题】:Matio performance马蒂奥表演
【发布时间】:2014-02-06 11:27:55
【问题描述】:

我正在尝试读取 MNIST 数据集(大小为 784*60000)我读取 MNIST 二进制格式的实现大约需要 20 秒,但我尝试使用 Matio 库以 .mat 格式读取相同的数据集并且它需要更长的时间大约 4~5 分钟。这就是我尝试读取 mat 文件的方式。难道我做错了什么?

矩阵结构

struct Matrix {
size_t col;
size_t row;
float *members;

Matrix() {
  members = NULL;
  col = 0;
  row = 0;
}
};

读取mat文件

mat_t *openmatfp;
matvar_t *mymat;
Matrix matrix;
openmatfp = Mat_Open("trainingdata.mat",MAT_ACC_RDONLY);
matrix.row = mymat->dims[0];
matrix.col = mymat->dims[1];
matrix.elements = new float[matrix.row * matrix.col];
memcpy(matrix.members, mymat->data,mymat->nbytes);//problem should be here!

【问题讨论】:

    标签: mat-file mnist


    【解决方案1】:

    您显示的代码没有设置 mymat。

    你需要这样的东西: mymat = Mat_VarRead(openmatfp, "MatrixName");

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-04
      • 1970-01-01
      • 1970-01-01
      • 2019-05-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多