Merge two LMDB databases for feeding to the network (caffe)

时光怂恿深爱的人放手 提交于 2019-12-06 11:06:23

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)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!