xsran
Published

Large Scale Image Retrieval System Based on VCK5000

In this project, we use the VCK 5000 to build a large-scale image retrieval system, which is very useful in many online services.

140
Large Scale Image Retrieval System Based on VCK5000

Things used in this project

Story

Read more

Code

Search Engine with test data, README, third dependencies.

C/C++
This is the full codes, including dependent libraries, search engines, README, and test data
No preview (download only).

Readme

Markdown
# Usage

## Batch search engine

This program search image in batch.
```
cd batch_search_engine
./search_engine
```

If you meet the error: 
```
Cannot lock device 
```
You should run this command before you start the search engine
```
sudo chmod o=rw /dev/dri/render*
```


This program will first load all image in the database, which is located in images-database.

Then it will search images in the query directory, which is in images-query.

The search result will be printed on the screen.

An example output is listed in: `search_engine/output.txt`


## Search engine
This is in `search_engine` directory.

we provider images database to search, which is located in images-database.
we also provider some images to be used as query, which is located in images-query directory.

Then launch server with the image database to search.
```
cd search_engine/build

./async_search_engine --database-path ../../images-database/
```

Then search using the client tool: 
```
cd search_engine/build

./search_client --query ../../images-query/ILSVRC2012_val_00000001.JPEG
```

This will query the server and save result in current directory.

In this example, the input is a snake, and the search result is also snakes. The query and results is given in `search_example`



# Build from source


## launch docker
```
./docker_run.sh
```


## activate vck
```
source vck5000/setup.sh
```


## build dependency

You need enable source package in /etc/apt/sources.list first. And you need run apt-get update.

You can build those dependencies yourself as below. or you can first run `./install_deps.sh` to build those.


### install cmake
```
cd cmake-3.22
./bootstrap
make -j$(proc)
sudo make install
```

### build faiss

Install packages and build faiss:
```
sudo apt-get install -y swig libblas-dev liblapack-dev libgflags-dev golang-go

cd faiss

/usr/local/bin/cmake -B build . -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF

make -C build -j8 faiss

sudo make -C build install
```


## build batch search engine
```
cd search_engine/
./build.sh
```

## build serach engine
```
# build c-ares
cd c-ares
mkdir build && cd build
cmake ..
make
sudo make install


# build protobuf
cd protobuf
git checkout v3.4.0
mkdir build  && cd build
/usr/local/bin/cmake ../cmake/
make -j
sudo make install

# VART using protobuf 3.4. so we need grpc v1.6.0
# build grpc
cd grpc
git checkout v1.6.0
git submodule update --init


mkdir build && cd build
/usr/local/bin/cmake .. -DgRPC_ZLIB_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_SSL_PROVIDER=package

make -j
sudo make install

```

Credits

xsran

xsran

2 projects • 0 followers

Comments