Extract a feature vector for any image and find the cosine similarity for comparison using Pytorch. I have used ResNet-18 to extract the feature vector of images. Finally a Django app is developed to input two images and to find the cosine similarity.
- Pytorch
- Django 2.0
- Inspired from Medium post by Christian Safka
-
Clone repository
git clone https://github.com/MexsonFernandes/Img2VecCosSim-Django-Pytorch
-
Change directory
cd Img2VecCosSim-Django-Pytorch
-
Install virtual environment
pipenv install
-
Install all dependencies
pipenv install -r requirements.txt
orpip install -r requirements.txt
-
Start django server
python manage.py runserver