Content-Based Image Retrieval Using Transfer Learning and Vector Database

Shuo Li, Lilly Suriani Affendey, Fatimah SidiInternational Journal of Advanced Computer Science and Applications 2024

Abstract

Content-based image retrieval (CBIR) systems are essential for efficiently searching large image datasets using image features instead of text annotations. Major challenges include extracting effective feature representations to improve accuracy, as well as indexing them to improve the retrieval speed. The use of pre-trained deep learning models to extract features has elicited interest from researchers. In addition, the emergence of open-source vector databases allows efficient vector indexing which significantly increases the speed of similarity search. This paper introduces a novel CBIR system that combines transfer learning with vector databases to improve retrieval speed and accuracy. Using a pre-trained VGG-16 model, we extract high-dimensional feature vectors from images, which are stored and retrieved using the Milvus vector database. Our approach significantly reduces retrieval time, achieving real-time responses while maintaining high precision and recall. Experiments conducted on ImageClef, ImageNet, and Corel-1k datasets demonstrate the system’s effectiveness in large-scale image retrieval tasks, outperforming traditional methods in both speed and accuracy.

Introduction

As digital multimedia content continues to grow exponentially, the challenge of efficiently retrieving specific images from massive datasets becomes increasingly critical. Traditional text-based retrieval methods, which rely on manual tagging or metadata, are often subjective, labor-intensive, and unable to capture the complex visual nuances of images. Content-Based Image Retrieval (CBIR) addresses these limitations by searching for images based on their inherent visual features such as color, texture, and shape.

However, CBIR systems face a significant "double bind": high-accuracy feature extraction is computationally expensive, and searching through high-dimensional vectors in large datasets often results in substantial retrieval lag. This paper proposes a Vector-based CBIR (VCBIR) architecture that leverages transfer learning and a dedicated vector database to achieve real-time performance without the complexity of traditional big data infrastructure.

Methodology

The proposed VCBIR architecture decouples feature extraction from the retrieval mechanism to optimize both accuracy and speed.

Feature Extraction via Transfer Learning

Instead of training a deep learning model from scratch, the system utilizes a pre-trained VGG-16 convolutional neural network. By removing the final classification layers, the network functions as a robust feature extractor, transforming raw images into high-dimensional feature vectors that represent their visual essence.

Vector Indexing and Retrieval

The core innovation lies in the use of Milvus, an open-source vector database designed for unstructured data. Milvus efficiently indexes the high-dimensional vectors and performs similarity searches using Euclidean distance (L2). This specialized indexing allows the system to scale horizontally and handle massive datasets far more efficiently than general-purpose relational databases or custom scripts.

System architecture of the VCBIR system, illustrating the flow from application input through the VGG model to the Milvus-backed retrieval engine.

Experimental Setup and Datasets

The system was evaluated using three benchmark datasets to test different performance aspects:

  • ImageClef (20,000 images): Used to evaluate indexing and retrieval times across varying data scales.
  • ImageNet (~1.46 million images): Employed for large-scale stress testing of retrieval performance.
  • Corel-1k (1,000 images): Used to calculate precision and recall across 10 distinct categories.

Results and Discussion

The VCBIR system demonstrated significant performance gains over traditional methods. On the ImageNet dataset, the system achieved a retrieval time of just 0.5 seconds for over a million images. In comparison to traditional parallel k-NN methods on the ImageClef dataset, retrieval time was reduced from hundreds of seconds to approximately 0.3 seconds.

Comparison of retrieval times across various CBIR methods, highlighting the efficiency of the VCBIR approach compared to centralized and distributed methods.

Beyond speed, the system maintained high accuracy. On the Corel-1k dataset, it achieved 100% precision in categories such as "dinosaurs" and "elephants," with recall remaining above 60% even in the most challenging categories. While the authors noted that indexing speed is slightly slower compared to some big data solutions, the trade-off is justified by the vastly superior online retrieval performance shown in comparative benchmarks.

Conclusion

The combination of transfer learning and specialized vector databases provides a powerful framework for real-time CBIR. By using pre-trained models like VGG-16 and purpose-built tools like Milvus, developers can build high-performance retrieval systems that are simpler to deploy than traditional big data stacks. Future work will focus on optimizing the indexing phase by utilizing GPU acceleration and transitioning to a fully distributed architecture to support higher concurrency.

Summary updated

BibTeX
@article{li2024content,
  author = {Shuo Li and Lilly Suriani Affendey and Fatimah Sidi},
  title = {{Content-Based Image Retrieval Using Transfer Learning and Vector Database}},
  journal = {International Journal of Advanced Computer Science and Applications},
  year = {2024},
  doi = {10.14569/ijacsa.2024.0150985},
}
Figure