lmdb

LMDB increase map_size

≡放荡痞女 提交于 2019-12-22 13:59:24
问题 I was working with LMDB++ (the C++ wrapper for LMDB) and I got this error: terminate called after throwing an instance of 'lmdb::map_full_error' what(): mdb_put: MDB_MAP_FULL: Environment mapsize limit reached Some googling told me that the default map_size is set low in LMDB. How do I go about increasing map_size? 回答1: The default LMDB map size is 10 MiB, which is indeed too small for most uses. To set the LMDB map size using the C++ wrapper, you ought to call lmdb::env#set_mapsize() right

Values that can be stored in LMDB

守給你的承諾、 提交于 2019-12-14 03:43:35
问题 LMDB is a key-value store. What types of keys and values can be stored here? Examples shows either int or char arrays .. Also I would like to know if it is possible to store related data in lmdb like we store all data related to a student in a table in RDBMS 回答1: It sounds like you're not a C programmer, but in the context of the C language, the data for keys and values in LMDB are both (void *) - that is, generic pointers to anything. That means any data type that can be expressed in the

Python操作SQLite/MySQL/LMDB

半世苍凉 提交于 2019-12-10 12:28:49
概述 1.1前言   最近在存储字模图像集的时候,需要学习LMDB,趁此机会复习了SQLite和MySQL的使用,一起整理在此。 1.2环境   使用win7,Python 3.5.2。 2.SQLite 2.1准备   SQLite是一种嵌入式数据库,它的数据库就是一个文件。Python 2.5x以上版本内置了SQLite3,使用时直接import sqlite3即可。 2.2操作流程   概括地讲,操作SQLite的流程是:     ·通过sqlite3.open()创建与数据库文件的连接对象connection     ·通过connection.cursor()创建光标对象cursor     ·通过cursor.execute()执行SQL语句     ·通过connection.commit()提交当前的事务,或者通过cursor.fetchall()获得查询结果     ·通过connection.close()关闭与数据库文件的连接   详细的sqlite3模块API可以看这里:SQLite - Python   总结起来就是用cursor.execute()执行SQL语句,改变数据(插入、删除、修改)时用connection.commit()提交变更,查询数据时用cursor.fetchall()得到查询结果。 2.3操作实例 2.3.1建立数据库与建立表

Multi-labels using two different LMDB

自古美人都是妖i 提交于 2019-12-09 18:27:31
问题 I am new in caffe framework and I would like to use caffe to implement the training with multi-label. I use two LMDB to save data and labels, respectively. The data LMDB is of dimension Nx1xHxW while the label LMDB is of dimension Nx1x1x3. Labels are float data. The text file is as follow: 5911 3 train/train_data/4224.bmp 13 0 12 train/train_data/3625.bmp 11 3 7 ... ... I use C++ to create LMDB. My main.cpp: #include <algorithm> #include <fstream> // NOLINT(readability/streams) #include

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

蓝咒 提交于 2019-12-07 22:02:43
问题 Here are two LMDB databases. Is there any way to merge these two databases and feed it to network using caffe? 回答1: 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:

What is special about internal design of LMDB?

回眸只為那壹抹淺笑 提交于 2019-12-07 17:20:40
问题 What would be the performance difference (reads/writes) between some C++ implementation of in-memory B-Tree (for example google btree) and the LMDB (without taking into consideration all the feacures of LMDB such as transactions, isolation, shared access etc.)? 回答1: This 2014 lmdb design presentation by its architect Howard Chu covers the design and tradeoffs of lmdb . To summarize: lmdb is a copy-on-write, bottom-up updated, double-buffered, b-tree where the implementation always favors

[转载]IMDB文件格式

試著忘記壹切 提交于 2019-12-06 17:00:30
[转载]IMDB文件格式 来源:LMDB的全称是 Lightning Memory-Mapped Database ,闪电般的内存映射数据库。它文件结构简单,一个文件夹,里面一个数据文件,一个锁文件。数据随意复制,随意传输。它的访问简单,不需要运行单独的数据库管理进程,只要在访问数据的代码里引用LMDB库,访问时给文件路径即可。 图像数据集归根究底从图像文件而来。既然有ImageDataLayer可以直接读取图像文件,为什么还要用数据库来放数据集,增加读写的麻烦呢?我认为,Caffe引入数据库存放数据集,是为了减少IO开销。读取大量小文件的开销是非常大的,尤其是在机械硬盘上。LMDB的整个数据库放在一个文件里,避免了文件系统寻址的开销。LMDB使用内存映射的方式访问文件,使得文件内寻址的开销非常小,使用指针运算就能实现。数据库单文件还能减少数据集复制/传输过程的开销。一个几万,几十万文件的数据集,不管是直接复制,还是打包再解包,过程都无比漫长而痛苦。LMDB数据库只有一个文件,你的介质有多块,就能复制多快,不会因为文件多而慢如蜗牛。 关于IMDB的底层实现,可以看这两篇博客: https://blog.csdn.net/weixin_38278334/article/details/96478405 https://www.jianshu.com/p/yzFf8j 来源:

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

时光怂恿深爱的人放手 提交于 2019-12-06 11:06:23
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

LMDB increase map_size

喜夏-厌秋 提交于 2019-12-06 04:14:52
I was working with LMDB++ (the C++ wrapper for LMDB) and I got this error: terminate called after throwing an instance of 'lmdb::map_full_error' what(): mdb_put: MDB_MAP_FULL: Environment mapsize limit reached Some googling told me that the default map_size is set low in LMDB. How do I go about increasing map_size? The default LMDB map size is 10 MiB, which is indeed too small for most uses. To set the LMDB map size using the C++ wrapper , you ought to call lmdb::env#set_mapsize() right after creating your LMDB environment and prior to opening the environment or creating your transaction. Here

python读写LMDB文件的方法

一世执手 提交于 2019-12-06 02:49:07
原文:https://www.jb51.net/article/142985.htm LMDB的全称是Lightning Memory-Mapped Database(快如闪电的内存映射数据库),它的文件结构简单,包含一个数据文件和一个锁文件: LMDB文件可以同时由多个进程打开,具有极高的数据存取速度,访问简单,不需要运行单独的数据库管理进程,只要在访问数据的代码里引用LMDB库,访问时给文件路径即可。 让系统访问大量小文件的开销很大,而LMDB使用内存映射的方式访问文件,使得文件内寻址的开销非常小,使用指针运算就能实现。数据库单文件还能减少数据集复制/传输过程的开销。 在python中使用lmdb: linux中,可以使用指令‘pip install lmdb' 安装lmdb包。 1. 生成一个空的lmdb数据库文件 1 # -*- coding: utf-8 -*- 2 import lmdb 3 4 # 如果train文件夹下没有data.mbd或lock.mdb文件,则会生成一个空的,如果有,不会覆盖 5 # map_size定义最大储存容量,单位是kb,以下定义1TB容量 6 env = lmdb.open("./train",map_size=1099511627776) 7 env.close() 2. LMDB数据的添加、修改、删除 1 # -*- coding: