ponponon / iv2

Convert images into vectors, which can be used for image search and image similarity comparison

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iv2

简体中文 | English

Introduction

Convert images into vectors, which can be used for image search and image similarity comparison

vector latitude is 512

Install

Python interpreter:

  • CPython: 3.8 and above

Installation method:

pip install iv2

Running the model, needing the weights file.

Download at: http://cmp.felk.cvut.cz/cnnimageretrieval/data/networks/gl18/

Download the gl18-tl-resnet50-gem-w-83fdc30.pth file from this address

Example of use

from typing import List
from iv2 import ResNet, l2


# Initialize a residual neural network
# download: http://cmp.felk.cvut.cz/cnnimageretrieval/data/networks/gl18/
resnet: ResNet = ResNet(
    runtime_model='gl18-tl-resnet50-gem-w-83fdc30.pth',
    device='cpu'
)


vector_1: List[float] = resnet.gen_vector('p1.png')
vector_2: List[float] = resnet.gen_vector('p.png')

print(l2(vector_1, vector_2, sqrt=False))

reference project

About

Convert images into vectors, which can be used for image search and image similarity comparison


Languages

Language:Python 100.0%