Giter VIP home page Giter VIP logo

Comments (3)

ChenglongChen avatar ChenglongChen commented on April 27, 2024

I have the same question. Since I am not so familiar with the leveldb format, I simply try to look into the code in e.g., convert_cifar_data.cpp and figure out how it works. To convert .mat file to work with caffe, I first convert it to binary format (use fwrite in matlab) as the cifar-10 dataset did according to this description (http://www.cs.toronto.edu/~kriz/cifar.html). After that, I use the modified version of convert_cifar_data.cpp to convert it to leveldb format. This approach works well when my .mat file is some image data, i.e., they are stored in uint8. However, I have trouble when it comes to int16 or float format. (It seems that caffe assumes uint8 data.)
It would be helpful if there is another example like convert_cifar_data.cpp but deal with data in other format, like float.

from caffe.

shelhamer avatar shelhamer commented on April 27, 2024

Caffe accepts single/float image data. If you are testing, the matlab wrapper should be suitable for your needs as long as you pass images in the expected dimension order. For efficiency or for parceling up data for training, conversion to leveldb via the convert.py utility in caffe/python/convert.py might be simplest.

It could be helpful to take a look at the matlab wrapper and the python convert examples as well as the io utility code (although you could have to do an intermediate step of exporting your .mat to images).

from caffe.

peerajak avatar peerajak commented on April 27, 2024

Thanx ChenlongChen

I just follow what you say, and now can transform cifar10 .mat format to binary format, then just follow the cifar10 example and get the correct training accuracy.
Matlab code

for i=1:5
name_load= sprintf('data_batch_%d',i);
name_bin = sprintf('data_batch_%d.bin',i);
load(name_load);
dlabels = [labels data]';
fileID = fopen(name_bin,'w');
fwrite(fileID,dlabels,'uint8');
fclose(fileID);
end

from caffe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.