In [1]:
import numpy as np

import matplotlib.pyplot as plt
%matplotlib inline

from eval import Eval
from eval import Pairwise
from eval import Mode

print("Done importing")


Done importing

Count no. of samples


In [9]:
import lmdb
import os

paths = [os.path.expanduser('~/data/PASCAL-Context/context_imgs_train_lmdb'),
         os.path.expanduser('~/data/PASCAL-Context/context_imgs_val_lmdb'),
         os.path.expanduser('~/data/PASCAL-Context/context_labels_59_train_lmdb'),
         os.path.expanduser('~/data/PASCAL-Context/context_labels_59_val_lmdb')
         ]
         
for p in paths:
    count = 0
    with lmdb.open(p, readonly=True).begin() as txn:
        for key, _ in txn.cursor():
            count += 1

    print("%d samples in %s" % (count, p))


4997 samples in /home/kashefy/data/PASCAL-Context/context_imgs_train_lmdb
5105 samples in /home/kashefy/data/PASCAL-Context/context_imgs_val_lmdb
4997 samples in /home/kashefy/data/PASCAL-Context/context_labels_59_train_lmdb
5105 samples in /home/kashefy/data/PASCAL-Context/context_labels_59_val_lmdb

list of image sizes


In [14]:
import lmdb
import os
import read_lmdb

paths = [os.path.expanduser('~/data/PASCAL-Context/context_imgs_train_lmdb'),
         os.path.expanduser('~/data/PASCAL-Context/context_labels_59_train_lmdb'),
         ]
       
shapes_db = []
for p in paths:
    shapes = []
    with lmdb.open(p, readonly=True).begin() as txn:
        for _, value in txn.cursor():
            _, x = read_lmdb.unpack_raw_datum(value)
            shapes.append(x.shape)
    shapes_db.append(shapes)
    
print len(shapes_db)


2

In [ ]: