0

I am using lmdb python to load the data

def create_dataset():

    img_db_fn = 'data/image_train.lmdb'        
    img_env = lmdb.Environment(img_db_fn, map_size=1099511627776)
    img_txn = img_env.begin(write=True, buffers=True)
    keys = np.arange(100000)
    np.random.shuffle(keys)
    img_fns = glob.glob('data/positive/*.jpg')
    img_fns += glob.glob('data/negtive/*.jpg')
    print len(img_fns)  , len(jnt_fns)
    for i, img_fn in enumerate(  img_fns ):
        img_datum = get_img_datum(img_fn)
        key = '%06d' % keys[i]    
        img_txn.put(key, img_datum.SerializeToString())
        if i % 10000 == 0:
            print 'commit',i
            img_txn.commit()
            img_txn = img_env.begin(write=True, buffers=True)

    img_txn.commit()
    img_env.close()

I got a error saying 'img_env = lmdb.Environment(img_db_fn, map_size=1099511627776) AttributeError: 'module' object has no attribute 'Environment''

user824624
  • 7,077
  • 27
  • 106
  • 183

1 Answers1

3

I guess you might use lmdb as one of your personal module names and thus it conflicts with the standard lmdb module

ct.Liu
  • 139
  • 2
  • 9