This repository contains Python code to match representation vectors, using cosine similarity.
- Install the latest version of Python 3.X.
- Install the required packages:
pip install -r requirements.txt
Run:
!python match_fts.py \
--input_dir features \
--feature_filename fts.npy \
--output_dir matches \
--numpy_matches matches.npy \
--numpy_similarity_scores scores.npy \
--num_neighbors 10
The following files will be saved in the --output_dir
folder:
matches.npy
: the matched indices (asnp.uint32
) in a NumPy file,scores.npy
: the similarity scores (asnp.float16
) in a NumPy file.
For instance, to match features for images in the balloon
dataset:
%cd /content
!git clone https://github.com/woctezuma/feature-extractor.git
%cd feature-extractor
%pip install --quiet -r requirements.txt
!wget https://github.com/matterport/Mask_RCNN/releases/download/v2.1/balloon_dataset.zip
!unzip -q balloon_dataset.zip
!python extract_fts.py --data_dir balloon
%cd /content
!git clone https://github.com/woctezuma/feature-matcher.git
%cd feature-matcher
%pip install --quiet -r requirements.txt
!python match_fts.py --input_dir /content/feature-extractor/features
- A feature extractor for Github repositories which include a
hubconf.py
file. match-steam-banners
: retrieve games with similar store banners.steam-DINOv2
: retrieve games with similar store banners, using Meta AI's DINOv2.