CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

How can read matlab data file

Open civilman628 opened this issue 10 years ago • 4 comments

If my image data are saved in Matlab format, such as each data batch file contains 256 images with 256 labels, How can I read them? Is there any plugin support this?

civilman628 avatar Feb 19 '16 04:02 civilman628

As far as i know (from my previous question here) CNTK does not yet support multi classification.

snapo avatar Feb 19 '16 12:02 snapo

What do you mean by “multi classification”?

CNTK does support multi-class classification problems which is a must in majority of the tasks we care about. You can use CrossEntropyWithSoftmax criterion to train such models.

If you mean “multi-label classification” in which each sample may have multiple labels, then yes, it does not have native support. However, if your multi-label classification problem can be converted into single-label classification, or if you know the exact criterion for that, it may be able to build a special criterion node using NDL macro.

dongyu888 avatar Feb 19 '16 17:02 dongyu888

To answer @civilmanxx's original question - CNTK currently does not support reading Matlab (.mat) format data. You have several options:

  1. Consider implementing and contributing back a CNTK reader for this purpose.
  2. Convert your input data to one of the CNTK readers' supported formats (ImageReader or UCIFastReader).
  3. The CNTK team is currently working on creating python interfaces for constructing and executing computation networks from python code - this feature when available will allow users to read the input data in python code and feed data into the CNTK computation graph execution engine. Note that currently there is no ETA for this facility.

amitaga avatar Feb 22 '16 21:02 amitaga

Matlab seems to have a built-in function imwrite() to write out images: http://www.mathworks.com/help/matlab/ref/imwrite.html?requestedDomain=www.mathworks.com

This should allow you to save the images in a format that ImageReader can read.

frankseide avatar Feb 22 '16 21:02 frankseide