Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/raj-pulapakura/image-search-engine

Upload an image and find similar images easily!
https://github.com/raj-pulapakura/image-search-engine

ai aws bentoml computer-vision image-processing machine-learning mobilenetv3 neural-network nextjs pytorch resnet50 responsive searchengine siamese-network vercel

Last synced: 1 day ago
JSON representation

Upload an image and find similar images easily!

Awesome Lists containing this project

README

        

# ๐Ÿ” Image Search Engine
![Screenshot 2023-06-24 182046](https://github.com/raj-pulapakura/Image-Search-Engine/assets/87762282/21702ad9-6cfe-4a5d-8385-cc65fad8eded)
- โŒ› **Project Duration**: June 12 to June 24
- โš™๏ธ **Main tech**: PyTorch, BentoML, NextJS, Vercel
- ๐Ÿฆ„ **Purpose**: Drag and drop (or upload) an image and find similar images
- ๐Ÿ’ป **Check it out**: https://image-search-pro.vercel.app/
- ๐Ÿ“ท **Video demonstration**: https://www.youtube.com/watch?v=loBZkPvn29c

# ๐Ÿค— Website
- ๐Ÿ’ช **Frontend framework**: NextJS
- ๐ŸŒง๏ธ **Deployment**: Vercel
- ๐Ÿ’ป **Check it out**: https://image-search-pro.vercel.app/
- ๐Ÿ“ท **Video demonstration**: https://www.youtube.com/watch?v=loBZkPvn29c

## Usage

1. Upload (or drag and drop) an image into the website

![Screenshot 2023-06-24 192730](https://github.com/raj-pulapakura/Image-Search-Engine/assets/87762282/8b220bec-a8e8-4972-af6c-bee80211b73c)

2. Find and download similar images

![Screenshot 2023-06-24 193050](https://github.com/raj-pulapakura/Image-Search-Engine/assets/87762282/46ac6e74-4c80-4285-86fa-558bd4461124)

# ๐Ÿค– Backend
- ๐ŸŽฐ **ML Framework**: PyTorch
- ๐Ÿˆ **Backend Framework**: BentoML
- ๐ŸŒง๏ธ **Deployment method**: BentoCTL, AWS and Terraform
- ๐Ÿ”— **API Link**: https://shzs1c1u45.execute-api.ap-southeast-2.amazonaws.com/predict

![Model Overview](https://github.com/raj-pulapakura/Image-Search-Engine/assets/87762282/a9d04a84-95cd-4aec-9123-725eeb1b66ea)

## ๐Ÿงช Test the API with Postman

1. Open up Postman and paste the aforementioned API Link
2. Make sure the request METHOD is set to "POST"
3. Go to "Body" and select "form-data"
4. Add a new file key named "image" and upload a file from your PC
5. Hit "Send"

![Screenshot 2023-06-24 183540](https://github.com/raj-pulapakura/Image-Search-Engine/assets/87762282/f91b628a-8e9a-40d3-8adc-55207cb4bd9b)

## ๐ŸŽฐ Backend: ML

I began my project with TensorFlow, but due to model size issues, I transitioned to PyTorch. MobileNetV3 architecture was utilized to reduce the model size and improve inference speed. I employed a MobileNetV3 model for classification and a Siamese MobileNetV3 network for similarity scoring. This combination of frameworks and architectures enabled me to achieve smaller models without compromising performance

- ๐Ÿถ **Classifier**:
- Architecture: MobileNetV3
- Purpose: Classify the input images. The output label (e.g. Labrador Retriever) is used to fetch 50 images from Unsplash.

- ๐Ÿ† **Siamese network**:
- Architecture: 2 MobileNetV3 models
- Purpose: Calculate similarity scores for each of the 50 images and the input image. The 20 most similar images, i.e. the images with the best similarity scores, are returned.

## ๐Ÿˆ Backend: server code

After experimenting with different backend frameworks such as FastAPI and Flask, I came across [BentoML](https://github.com/bentoml), which is a tool that makes ML API creation and deployment effortless.

## ๐ŸŒง๏ธ Backend: deployment
BentoML offers a tool called [bentoctl](https://github.com/bentoml/bentoctl), which is used to deploy BentoML services to production ready API endpoints in the cloud. It does this using [AWS Lambda](https://aws.amazon.com/lambda/), [AWS API Gateway](https://aws.amazon.com/api-gateway/), and [AWS ECR](https://aws.amazon.com/ecr/), whilst using [Terraform](https://www.terraform.io/) to automate the creation of this infrastructure.

# ๐Ÿ“œ Summary

## โš™๏ธ Technologies

This project exposed me to many different technologies involved in ML application deployment, as well full stack development.

Tech used:
- Frontend: NextJS, Vercel
- Backend: PyTorch, BentoML, AWS, Terraform

## ๐Ÿ’ก What I learnt

- ๐Ÿƒโ€โ™‚๏ธ **Model optimization**: In my quest to achieve lower inference times, I had to switch from Tensorflow to PyTorch and from ResNets to MobileNet. This process was painstaking, however it taught me the value of different model architectures and how some are better suited for application development.
- ๐ŸŒง๏ธ **Deployment**: I was exposed to different technologies involved in the deployment process including Docker and AWS.
- ๐Ÿซก **Never give up**: This may sound cliche, but it's a timeless mantra which applies no matter what field you are in. Many times throughout the project I was faced with a challenge or an error which made me want to give up. But through persistence and grit, I managed to overcome these challenges and eventually produce a functional ML application.