Search code examples
neural-networkprotocol-buffersdeep-learningcaffelmdb

Error reading lmdb file in caffe net


I am trying to use the LMDB file that I created to define the data layer in caffe net and I get below error

TypeError: 'LMDB' has type (type 'str'), but expected one of: (type 'int', type 'long')

I checked for labels in the text file that I passed to script that generates lmdb file (caffe/build/tools/convert_imageset).
Am I missing something here?

Edit -1: Here is my data layer definition:

n.data,n.labels = L.Data(batch_size = batch_size, 
                         source=lmdb_src, 
                         backend = "LMDB", 
                         transform_param = dict(mean_file = mean_file),
                         ntop=2)

Solution

  • You are trying to set

    backend: "LMDB"
    

    in your net definition, instead of

    backend: LMDB
    

    Note that LMDB is not passed as string, but rather as an enumerated integer.

    What you should do is set

    backend = caffe.Data.LMDB
    

    Use the enum value set by caffe protobuff definition.