neural-networkdeep-learningcaffelmdbpycaffe

How to get the dataset size of a Caffe net in python?


I look at the python example for Lenet and see that the number of iterations needed to run over the entire MNIST test dataset is hard-coded. However, can this value be not hard-coded at all? How to get the number of samples of the dataset pointed by a network in python?


Solution

  • You can use the lmdb library to access the lmdb directly

    import lmdb
    db = lmdb.open('/path/to/lmdb_folder')       //Needs lmdb - method
    num_examples = int( db.stat()['entries'] )
    

    Should do the trick for you.