• Stars
    star
    128
  • Rank 281,044 (Top 6 %)
  • Language
    Python
  • License
    Other
  • Created almost 3 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Learning Super-Features for Image Retrieval

This repository contains the code for running our FIRe model presented in our ICLR'22 paper:

@inproceedings{superfeatures,
  title={{Learning Super-Features for Image Retrieval}},
  author={{Weinzaepfel, Philippe and Lucas, Thomas and Larlus, Diane and Kalantidis, Yannis}},
  booktitle={{ICLR}},
  year={2022}
}

License

The code is distributed under the CC BY-NC-SA 4.0 License. See LICENSE for more information. It is based on code from HOW, cirtorch and ASMK that are released under their own license, the MIT license.

Preparation

After cloning this repository, you must also have HOW, cirtorch and ASMK and have them in your PYTHONPATH.

  1. install HOW
git clone https://github.com/gtolias/how
export PYTHONPATH=${PYTHONPATH}:$(realpath how)
  1. install cirtorch
wget "https://github.com/filipradenovic/cnnimageretrieval-pytorch/archive/v1.2.zip"
unzip v1.2.zip
rm v1.2.zip
export PYTHONPATH=${PYTHONPATH}:$(realpath cnnimageretrieval-pytorch-1.2)
  1. install ASMK
git clone https://github.com/jenicek/asmk.git
pip3 install pyaml numpy faiss-gpu
cd asmk
python3 setup.py build_ext --inplace
rm -r build
cd ..
export PYTHONPATH=${PYTHONPATH}:$(realpath asmk)
  1. install dependencies by running:
pip3 install -r how/requirements.txt
  1. data/experiments folders

All data will be stored under a folder fire_data that will be created when running the code; similarly, results and models from all experiments will be stored under folder fire_experiments

Evaluating our ICLR'22 FIRe model

To evaluate on ROxford/RParis our model trained on SfM-120k, simply run

python evaluate.py eval_fire.yml

With the released model and the parameters found in eval_fire.yml, we obtain 90.3 on the validation set, 82.6 and 62.2 on ROxford medium and hard respectively, 85.2 and 70.0 on RParis medium and hard respectively.

Training a FIRe model

Simply run

python train.py train_fire.yml -e train_fire

All training outputs will be saved to fire_experiments/train_fire.

To evaluate the trained model that was saved in fire_experiments/train_fire, simply run:

python evaluate.py eval_fire.yml -e train_fire -ml train_fire

Pretrained models

For reproducibility, we provide the following model weights for the architecture we use in the paper (ResNet50 without the last block + LIT):

  • Model pre-trained on ImageNet-1K (with Cross-Entropy, the pre-trained model we use for training FIRe) (link)
  • Model trained on SfM-120k trained with FIRe (link)

They will be automatically downloaded when running the training / testing script.

Dockerfile

For convenience, we provide a dockerfile. You can build it with

docker build --tag naver/fire .

It does not contain the fire_data nor fire_experiments so these need to be stored outside.
In evaluate.py, the options --data-folder and --exp-folder can be used to overwrite these paths.

example:

docker run --gpus all --rm -it --ipc=host --mount type=bind,source=/local/fire,target=/local/fire --entrypoint bash naver/fire
python evaluate.py eval_fire.yml --data-folder /local/fire/fire_data --exp-folder /local/fire/fire_experiments

kapture integration

With kapture_compute_pairs.py you can compute pairs from datasets that are provided in kapture format (link to kapture github) using FIRe or HOW. These pairs can be used to, e.g., run the kapture visual localization pipeline (link to kapture-localization github). --codebook-cache-path can be used to cache the codebook. It only needs to be computed once per model.
--ivf-cache-path can be used to cache the ivf database. It needs to be computed once per model per dataset (mapping images).
--model-load, --data-folder can be used to overwrite demo_eval.net_path and demo_eval.fire_data. Note that demo_eval.exp_folder and evaluation.local_descriptor.datasets are ignored.

example: extracting top50 FIRe pairs, and top50 HOW pairs for GangnamStation_B2

docker run --gpus all --rm -it --ipc=host --mount type=bind,source=/local/fire,target=/local/fire --entrypoint bash naver/fire

# prepare dataset
mkdir /local/fire/kapture_datasets
cd /local/fire/kapture_datasets
kapture_download_dataset.py update
kapture_download_dataset.py install  "GangnamStation_B2*"
# read license terms and type y [enter] to agree
cd GangnamStation/B2/release
kapture_merge.py -v info \
                 -i test validation \
                 -o query_all \
                 --image_transfer link_relative

# extract FIRe pairs
cd /opt/src/fire
# map -> map pairs
python3 kapture_compute_pairs.py -v debug \
    --parameters eval_fire.yml \
    --model fire \
    --data-folder /local/fire/fire_data \
    --codebook-cache-path /local/fire/fire_codebook \
    --ivf-cache-path /local/fire/kapture_datasets/GangnamStation/B2/release/fire_ivf \
    --map /local/fire/kapture_datasets/GangnamStation/B2/release/mapping/ \
    -o /local/fire/kapture_datasets/GangnamStation/B2/release/pairsfile/mapping/fire_top50.txt \
    --topk 50
# query -> map pairs
python3 kapture_compute_pairs.py -v debug \
    --parameters eval_fire.yml \
    --model fire \
    --data-folder /local/fire/fire_data \
    --codebook-cache-path /local/fire/fire_codebook \
    --ivf-cache-path /local/fire/kapture_datasets/GangnamStation/B2/release/fire_ivf \
    --map /local/fire/kapture_datasets/GangnamStation/B2/release/mapping/ \
    --query /local/fire/kapture_datasets/GangnamStation/B2/release/query_all \
    -o /local/fire/kapture_datasets/GangnamStation/B2/release/pairsfile/query/fire_top50.txt \
    --topk 50

# extract HOW pairs
cd /opt/src/fire
# you can use the same data-folder as for fire
# map -> map pairs
python3 kapture_compute_pairs.py -v debug \
    --parameters ../how/examples/params/eccv20/eval_how_r50-_1000.yml \
    --model how \
    --data-folder /local/fire/fire_data \
    --codebook-cache-path /local/fire/how_codebook \
    --ivf-cache-path /local/fire/kapture_datasets/GangnamStation/B2/release/how_ivf \
    --map /local/fire/kapture_datasets/GangnamStation/B2/release/mapping/ \
    -o /local/fire/kapture_datasets/GangnamStation/B2/release/pairsfile/mapping/how_top50.txt \
    --topk 50
# query -> map pairs
python3 kapture_compute_pairs.py -v debug \
    --parameters ../how/examples/params/eccv20/eval_how_r50-_1000.yml --model fire \
    --data-folder /local/fire/fire_data \
    --codebook-cache-path /local/fire/how_codebook \
    --ivf-cache-path /local/fire/kapture_datasets/GangnamStation/B2/release/how_ivf \
    --map /local/fire/kapture_datasets/GangnamStation/B2/release/mapping/ \
    --query /local/fire/kapture_datasets/GangnamStation/B2/release/query_all \
    -o /local/fire/kapture_datasets/GangnamStation/B2/release/pairsfile/query/how_top50.txt \
    --topk 50

More Repositories

1

billboard.js

๐Ÿ“Š Re-usable, easy interface JavaScript chart library based on D3.js
TypeScript
5,812
star
2

fe-news

FE ๊ธฐ์ˆ  ์†Œ์‹ ํ๋ ˆ์ด์…˜ ๋‰ด์Šค๋ ˆํ„ฐ
5,635
star
3

dust3r

DUSt3R: Geometric 3D Vision Made Easy
Python
4,919
star
4

egjs-flicking

๐ŸŽ  โ™ป๏ธ Everyday 30 million people experience. It's reliable, flexible and extendable carousel.
TypeScript
2,551
star
5

egjs-infinitegrid

A module used to arrange card elements including content infinitely on a grid layout.
TypeScript
2,187
star
6

ngrinder

enterprise level performance testing solution
Java
1,788
star
7

d2codingfont

D2 Coding ๊ธ€๊ผด
1,774
star
8

egjs

Javascript components group that brings easiest and fastest way to build a web application in your way.
JavaScript
922
star
9

splade

SPLADE: sparse neural search (SIGIR21, SIGIR22)
Python
748
star
10

mast3r

Grounding Image Matching in 3D with MASt3R
Python
731
star
11

biobert-pretrained

BioBERT: a pre-trained biomedical language representation model for biomedical text mining
651
star
12

deep-image-retrieval

End-to-end learning of deep visual representations for image retrieval
Python
643
star
13

sqlova

Python
631
star
14

fixture-monkey

Let Fixture Monkey generate test instances including edge cases automatically
Java
549
star
15

roma

RoMa: A lightweight library to deal with 3D rotations in PyTorch.
Python
493
star
16

r2d2

Python
468
star
17

kapture

kapture is a file format as well as a set of tools for manipulating datasets, and in particular Visual Localization and Structure from Motion data.
Python
466
star
18

egjs-view360

360 integrated viewing solution
TypeScript
438
star
19

scavenger

A runtime dead code analysis tool
Java
400
star
20

yobi

Project hosting software - Deprecated
Java
379
star
21

lispe

An implementation of a full fledged Lisp interpreter with Data Structure, Pattern Programming and High level Functions with Lazy Evaluation ร  la Haskell.
C
369
star
22

lucy-xss-filter

HTML
319
star
23

arcus

ARCUS is the NAVER memcached with lists, sets, maps and b+trees. http://naver.github.io/arcus
Shell
302
star
24

egjs-grid

A component that can arrange items according to the type of grids
TypeScript
275
star
25

spring-jdbc-plus

Spring JDBC Plus
Java
274
star
26

kapture-localization

Provide mapping and localization pipelines based on kapture format
Python
266
star
27

android-imagecropview

android image crop library
Java
250
star
28

croco

Python
249
star
29

smarteditor2

Javascript WYSIWYG HTML editor
JavaScript
241
star
30

lucy-xss-servlet-filter

Java
237
star
31

kor2vec

OOV์—†์ด ๋น ๋ฅด๊ณ  ์ •ํ™•ํ•œ ํ•œ๊ตญ์–ด Embedding ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ
Python
219
star
32

claf

CLaF: Open-Source Clova Language Framework
Python
215
star
33

eslint-config-naver

Naver JavaScript Coding Conventions rules for eslint
JavaScript
205
star
34

tamgu

Tamgu (ํƒ๊ตฌ), a FIL programming language: Functional, Imperative, Logical all in one for annotation and data augmentation
C++
199
star
35

egjs-view3d

Fast & customizable 3D model viewer for everyone
TypeScript
192
star
36

multi-hmr

Pytorch demo code and models for Multi-HMR
Python
178
star
37

nlp-challenge

NLP Shared tasks (NER, SRL) using NSML
Python
177
star
38

hackday-conventions-java

์บ ํผ์Šค ํ•ต๋ฐ์ด Java ์ฝ”๋”ฉ ์ปจ๋ฒค์…˜
173
star
39

nbase-arc

nbase-arc is an open source distributed memory store based on Redis
C
171
star
40

nanumfont

170
star
41

egjs-axes

A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates.
TypeScript
150
star
42

cgd

Combination of Multiple Global Descriptors for Image Retrieval
Python
147
star
43

naver-openapi-guide

CSS
135
star
44

volley-extensions

Volley Extensions v2.0.0. ( Volleyer, Volley requests, Volley caches, Volley custom views )
Java
134
star
45

tldr

TLDR is an unsupervised dimensionality reduction method that combines neighborhood embedding learning with the simplicity and effectiveness of recent self-supervised learning losses
Python
123
star
46

pr-stats

PR์— ๋Œ€ํ•œ ์œ ์šฉํ•œ ํ†ต๊ณ„๋ฅผ ์‚ฐ์ถœํ•˜๋Š” GitHub Actions
TypeScript
122
star
47

PoseGPT

Python
119
star
48

grabcutios

Image segmentation using GrabCut algorithm for iOS
C++
118
star
49

sling

C++
117
star
50

gdc

Code accompanying our papers on the "Generative Distributional Control" framework
Python
116
star
51

naveridlogin-sdk-android

๋„ค์ด๋ฒ„ ์•„์ด๋””๋กœ ๋กœ๊ทธ์ธ SDK (์•ˆ๋“œ๋กœ์ด๋“œ)
Kotlin
114
star
52

posescript

Python
114
star
53

egjs-conveyer

Conveyer adds Drag gestures to your Native Scroll.
TypeScript
113
star
54

spring-batch-plus

Add useful features to spring batch
Kotlin
111
star
55

cfcs

Write once, create framework components that supports React, Vue, Svelte, and more.
TypeScript
102
star
56

egjs-agent

Extracts browser and operating system information from the user agent string or user agent object(userAgentData).
TypeScript
100
star
57

searchad-apidoc

Java
98
star
58

dope

Python
92
star
59

bergen

Benchmarking library for RAG
Jupyter Notebook
88
star
60

imagestabilizer

C++
77
star
61

guitar

AutoIt
75
star
62

arcus-memcached

ARCUS memory cache server
C
71
star
63

disco

A Toolkit for Distributional Control of Generative Models
Python
68
star
64

prism-live-studio

C++
63
star
65

cover-checker

Check your pull request code coverage
Java
63
star
66

egjs-list-differ

โž•โž–๐Ÿ”„ A module that checks the diff when values are added, removed, or changed in an array.
TypeScript
63
star
67

storybook-addon-preview

Storybook Addon Preview can show user selected knobs in various framework code in Storybook
TypeScript
63
star
68

svc

Easy and intuitive pattern for Android
Kotlin
62
star
69

egjs-imready

I'm Ready to check if the images or videos are loaded!
TypeScript
60
star
70

egjs-flicking-plugins

Plugins for @egjs/flicking
TypeScript
60
star
71

naveridlogin-sdk-ios

Objective-C
59
star
72

garnet

Python
57
star
73

clova-face-kit

On-device lightweight face recognition. Available on Android, iOS, WASM, Python.
57
star
74

rye

RYE, Native Sharding RDBMS
C
54
star
75

hubblemon

Python
54
star
76

zeplin-flutter-gen

๐Ÿš€The Flutter dart code generator from zeplin. ex) Container, Text, Color, TextStyle, ... - Save your time.
JavaScript
53
star
77

egjs-visible

A class that checks if an element is visible in the base element or viewport.
HTML
52
star
78

arcus-java-client

ARCUS Java client
Java
50
star
79

aqm-plus

PyTorch code for Large-Scale Answerer in Questioner's Mind for Visual Dialog Question Generation (AQM+) (ICLR 2019)
Python
50
star
80

isometrizer

Isometrizer turns your DOM elements into isometric projection
TypeScript
48
star
81

artemis

Official code release for ARTEMIS: Attention-based Retrieval with Text-Explicit Matching and Implicit Similarity (published at ICLR 2022)
Python
46
star
82

jindojs-jindo

Jindo JavaScript Framework
JavaScript
44
star
83

covid19-nmt

Multi-lingual & multi-domain (specialisation for biomedical data) translation model
Python
40
star
84

react-sample-code

์ด ํ”„๋กœ์ ํŠธ๋Š” hello world์— ๊ณต๊ฐœํ•œ React ๊ฐœ๋ฐœ ๊ฐ€์ด๋“œ์— ํ•„์š”ํ•œ ์ƒ˜ํ”Œ ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค.
JavaScript
39
star
85

pump

Python
39
star
86

posebert

Python
39
star
87

passport-naver

A passport strategy for Naver OAuth 2.0
JavaScript
38
star
88

hadoop

Public hadoop release repository
Java
38
star
89

kaist-oss-course

Introduction to Open Source Software class @ KAIST 2016
38
star
90

egjs-component

A class used to manage events in a component like DOM
TypeScript
38
star
91

graphql-dataloader-mongoose

graphql-dataloader-mongoose is a DataLoader generator based on an existing Mongoose model
TypeScript
38
star
92

egjs-persist

Provide cache interface to handle persisted data among history navigation.
JavaScript
38
star
93

shine

[CVPR'24 Highlight] SHiNe: Semantic Hierarchy Nexus for Open-vocabulary Object Detection
Python
36
star
94

naver-spring-batch-ex

Java
33
star
95

naverspeech-sdk-ios

Swift
32
star
96

reflect

C++ class reflection library without RTTI.
C++
32
star
97

android-utilset

Utilset is collections of useful functions to save your valuable time.
Java
32
star
98

cafe-sdk-unity

31
star
99

image-maps

jquery plugin which can be partially linked to the image
JavaScript
31
star
100

mesh-simplifier

Collection of mesh simplification methods written in Typescript
TypeScript
30
star