Here are two LMDB databases. Is there any way to merge these two databases and feed it to network using caffe?
Simply write a script using the python lmdb interface. Something like:
import lmdb
env = lmdb.open("path/to/lmdbFile")
txn = env.begin(write=True)
database1 = txn.cursor("db1Name")
database2 = txn.cursor("db2Name")
env.open_db(key="newDBName", txn=txn)
newDatabase = txt.cursor("newDBName")
for (key, value) in database1:
newDatabase.put(key, value)
for (key, value) in database2:
newDatabase.put(key, value)
or you could just as simply add one to the other by:
for (key, value) in database2:
database1.put(key, value)
来源:https://stackoverflow.com/questions/33443020/merge-two-lmdb-databases-for-feeding-to-the-network-caffe