Skip to content

In Research of Computer Vision, Converting Images into LMDB with protobuf is a frequent task. While the data scale is growing, some hope to speed up this process with multiprogress/multithreading.

License

Notifications You must be signed in to change notification settings

hyichao/protobuf-lmdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Play Around with Protobuf+LMDB

Try to use protobuf python wrapper to enhance daily working efficiency.

Installation

  • option 1. using pre-build
# Ubuntu
sudo apt-get install protobuf-compiler
# Mac
brew install protobuf

After Installation, check the protobuffer compiler

protoc --version

Then install its python library with pip

pip install protobuf
  • Option 2. Using source code.. which is not recommanded
git clone https://github.com/google/protobuf.git
# follow its README

Prepare .proto file

ProtoBuffer required a definition file of your own data structure. i.e. the definition.proto file in our example. FYI. this proto file contains a message named Datum, which is copied from CAFFE.

protoc --python_out=. definition.proto

with the 'compile' command, a file will be generated named with **_pb2.py, which will be used in your actual py script

Read & Write

As two scripts shows, reader.py and writer.py In order to apply the tech into daily working with CAFFE, lmdb support is added.

pip install lmdb

using lmdb in python is pretty easy, please ref to these two py scripts.

with all prerequest, all three steps to play around is as follows.

git clone https://github.com/hyichao/protobuf-lmdb.git
cd protobuf-lmdb
protoc --python_out=. definition.proto
python writer.py
python reader.py

About

In Research of Computer Vision, Converting Images into LMDB with protobuf is a frequent task. While the data scale is growing, some hope to speed up this process with multiprogress/multithreading.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages