pixelobjectness
pixelobjectness copied to clipboard
After run demo.py, there are 4-dimensional .mat files generated?
Hi, I use this codes and run demo.py, there are 4-dimensional .mat files generated. But show_result.m just process 3-dimensional .mat files, what is wrong with me??
thanks!!
When I run show_result.m file, there is a error:
Error using permute ORDER must have at least N elements for an N-D array.
Error in show_results (line 23) raw_result = permute(raw_result, [2 1 3]);
I am not sure why are you getting 4d output, L414 in test_template, sets the num_output to 2 so you should only have 513x513x2 output from caffe.
Hi, I read the code which displays how to create .mat file(through the MAT_WRITE layer). I found that it is really that there are 4-dimensional .mat file to create. The original code in Deeplab is as follows:
template <typename Dtype> void Blob<Dtype>::ToMat(const char *fname, bool write_diff) { mat_t *matfp; matfp = Mat_Create(fname, 0); //matfp = Mat_CreateVer(fname, 0, MAT_FT_MAT73); CHECK(matfp) << "Error creating MAT file " << fname; size_t dims[4]; dims[0] = width_; dims[1] = height_; dims[2] = channels_; dims[3] = num_; matvar_t *matvar; // save data { matvar = Mat_VarCreate("data", matio_class_map<Dtype>(), matio_type_map<Dtype>(), 4, dims, mutable_cpu_data(), 0); CHECK(matvar) << "Error creating 'data' variable"; CHECK_EQ(Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_NONE), 0) << "Error saving array 'data' into MAT file " << fname; Mat_VarFree(matvar); } // save diff if (write_diff) { matvar = Mat_VarCreate("diff", matio_class_map<Dtype>(), matio_type_map<Dtype>(), 4, dims, mutable_cpu_diff(), 0); CHECK(matvar) << "Error creating 'diff' variable"; CHECK_EQ(Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_NONE), 0) << "Error saving array 'diff' into MAT file " << fname; Mat_VarFree(matvar); } Mat_Close(matfp); }
size_t dims[4]; dims[0] = width_; dims[1] = height_; dims[2] = channels_; dims[3] = num_;
The above code means there are 4-d .mat file to create.
so that is a code bug?
Actually I do not know. Have you run this code and do you have the same question?