Comments (3)
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.
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.
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)
- BUG: error happens while building the project using cmake, if without preinstall `gflags`. HOT 1
- Makefile
- import error: segment fault when import caffe
- Segmentation fault (core dumped) when creating imageset
- MSBuild Error
- DeleteMe
- Glib 3.4.30 not found HOT 1
- Error MSB6006: "cmd.exe" exited with code -1073741 515 HOT 2
- blob.hpp dimension check code problem
- Is it possible to use OpenCL on FreeBSD without using ROCm?
- How to build Caffe(OpenCL) on Linux from source code? HOT 1
- Caffe(OpenCL) Error: ordered comparison between pointer and zero ('int32_t *' (aka 'int *') and 'int') HOT 1
- Failed inference with nyud-fcn32s-hha
- ю
- caffe installation HOT 1
- Assessment of the difficulty in porting CPU architecture for caffe
- How to add new layer to caffe like HardSigmoid or Resize HOT 1
- module 'caffe' has no attribute 'set_mode_cpu'
- `GLOG_LIBRARYRARY_DIRS` appears to be in error HOT 1
- Could not find url for MSVC version = 1939 and Python version =
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caffe.