With the vector storage and retrieval capabilities of OceanBase, we can build an image search application. The application will embed images into vectors and store them in the database. Users can upload images, and the application will search and return the most similar images in the database.
Note: You need to prepare some images yourself and update the Image Base configuration to the open UI. If you don't have any images available locally, you can download datasets online, such as the Animals-10 dataset on Kaggle.
- Install uv as a dependency management tool.
curl -LsSf https://astral.sh/uv/install.sh | sh- Make sure
makeis available on your system.
Copy the .env.example file to .env and modify the configuration as needed.
cp .env.example .envThis command will start the OceanBase database container and install all dependencies.
make initmake startAfter opening the application interface, you can see the input box of "Image Base" in the left sidebar. Fill in the absolute path of the image directory you prepared in it, and then click the "Load Images" button. The application will process and store these image data, and you will see the image processing progress on the interface.
After the image processing is completed, you will see the image upload operation bar at the top of the interface. You can upload an image to search for similar images. Once the image is uploaded, the application will search and return some of the most similar images in the database, and by default, the top 10 most similar images will be returned.
make stopmake cleanIf you encounter the error message ImportError: libGL.so.1: cannot open shared object file when running the application UI, you can refer to this post to resolve it.
If you are using the CentOS/RedHat operating system, execute the following command,
sudo yum install mesa-libGL -yAnd if you are using the Ubuntu/Debian operating system, execute the following command,
sudo apt-get install libgl1If you encounter any issues during Docker installation or when starting the OceanBase container, you can visit OceanBase OBI for assistance.
