HOW TO CONVERT EXTRACTED LEVELDB DATABASE INTO MATLAB CONSUMABLE FILE
232 views
Skip to first unread message
lolale...@gmail.com
unread,
Mar 20, 2016, 10:41:21 AM3/20/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Caffe Users
hHey guys i am new for caffe, i want to extract feature for 1491 images but i couldn't convert extracted feature in the leveldb folder to matlab consumable file and also i don't know how to map the feature to the corresponding image . when i try to convert extracted feature for 6 images using the following script it always gives me 32.8kb file and when i read it i always got a vector (1x8192) regardless of number of image and batch size
import caffe import leveldb import numpy as np from caffe.proto import caffe_pb2
db = leveldb.LevelDB('/usr/lib/python2.7/caffe/examples/_temp/features') datum = caffe_pb2.Datum()
for key, value in db.RangeIter(): datum.ParseFromString(value)
label = datum.label data = caffe.io.datum_to_array(datum)
# image = np.transpose(data, (1,2,0))
np.save('feature.txt',image)
-is there any one who tell me where i made a misteke or what to do inorder to convert "leveldb" file into matlab consumable file? -and also is a single image represented by 4096 dimensional vector hence should i expect the number of image times 4096 for the total image i have extracted?
THANKS IN ADVANCE!
yeshwanth Napolean
unread,
Apr 4, 2017, 8:23:52 AM4/4/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Caffe Users
I am new to caffe as well, but from what I can see,
data = caffe.io.datum_to_array(datum)
basically rewrites previously saved arrays as the loop runs, I dont know if this is the best fix but you could try,
i = 0
data = np.zeros((128,4096))
db = leveldb.LevelDB('/usr/lib/python2.7/caffe/examples/_temp/features') datum = caffe_pb2.Datum()
for key, value in db.RangeIter(): datum.ParseFromString(value)