nafilatur2724
nafilatur2724

Reputation: 35

Read LevelDB format from Matlab

I am working on Caffe. I already extract features using extract_features.bin, it will create a result as this figure below. It said that the feature will stored in LevelDB format. But, since I almost work in MATLAB, so I want to read this output on my MATLAB. But, I still cannot find a way how to do that. Anybody could help me?

Screenshot of my levelDB output

Upvotes: 1

Views: 721

Answers (2)

Shai
Shai

Reputation: 114866

Alternatively, you can use python to read the leveldb, save it to mat-file and process it in Matlab.

For this workaround to work, you'll need py-leveldb (and python...)

In python

import leveldb      # for reading leveldb
import numpy as np  # for manipulating the data
import scipy.io     # for writing to mat file

data = []
db = leveldb.LevelDB('/path/to/output400_flickr_fc7')
for key, value in db.RangeIter():
    data.append( np.array(value) )

scipy.io.savemat('/path/to/output400_flickr_fc7.mat', {'data': np.hstack(data)})

Now you should be able to load in Matlab (should be stored to data variable)

>> load('/path/to/output400_flickr_fc7.mat');

Upvotes: 3

Shai
Shai

Reputation: 114866

Have you looked at this git project?
This project seems to implement a wrapper for reading leveldb datasets into matlab.

Upvotes: 1

Related Questions