• Stars
    star
    196
  • Rank 192,439 (Top 4 %)
  • Language
    Python
  • Created over 6 years ago
  • Updated over 3 years ago

Reviews

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

Repository Details

Tensorflow port of LIFT (ECCV 2016), with training code.

TF-LIFT: Tensorflow Implmentation for Learned Invariant Feature Transform

Basic Usage

Setting the environment

Python Version : 3 OpenCV Version : 3

You'll need to install the dependencies, something like the following:

pip install numpy h5py tensorflow tensorflow-gpu

We will later provide a requirements.txt for you to use with pip.

Also, you need to setup your work directories. Edit the config.py for a convenient default argument setting. See help for more information on what the configurations do.

Training

main.py is the entry point for all your needs. Simply define the task you want to do, the where to save the results (logs) and the training subtask you want to perform.

For example, to train the descriptor

python main.py --task=train --subtask=desc

Note: this will save the logs at logs/main.py---task=train---subtask=desc. If you don't want this behavior, you can also add --logdir=logs/test in the command line argument, for example.

Testing

Testing is even more simple, just provide the input image location, the output file name, keypoint file name (for ori and desc). For example, the following command will run the entire pipeline for image1.jpg, using the model at logs/test.

python main.py --task=test --subtask=kp --logdir=logs/test --test_img_file=image1.jpg \
  --test_out_file=image1_kp.txt
python main.py --task=test --subtask=ori --logdir=logs/test --test_img_file=image1.jpg \
  --test_out_file=image1_ori.txt --test_kp_file=image1_kp.txt
python main.py --task=test --subtask=desc --logdir=logs/test --test_img_file=image1.jpg \
  --test_out_file=image1_desc.h5 --test_kp_file=image1_ori.txt

Note: when trying to load the model, it will always look for the joint trained model first, and fall back to the subtask it is trying to test for.

More notes on training

Saving the network

When training, the network is automatically saved in the logdir. If you don't set this manually, it defaults to logs/{concatenation-of-all-arguments}. The things that are saved are:

  • Tensorflow checkpoint
  • Tensorflow graph metadata
  • mean and std used for input data normalization
  • best validation loss
  • best validation iteration

All these are loaded back when we want to continue.

Loading the network

On all runs, the framework automatically resumes from where it left. In other words, it will always try to load network weights and resume. If the framework cannot find the expected weights, it will just tell you that it could not find weights in the expected locations, and will try to go on its merry way. Note that this is something that you want to keep in mind. For example, if you run the subtask ori, with a typo in logdir pointing you to a directory without the pretrained descriptor weights, the framework will simply try to learn the orientation estimator with random descriptors. This is intended, as this might be something that you actually want to try.

Network loading is performed in the following order, overwriting the previously loaded weights:

  1. Loads the pretrained weights, in the old framework format, from directories defined in pretrained_{subtask} in the configuration. This feature is deprecated and should not be used

  2. Loads the pretrained weights, in the new framework format, from directories defined in pretrained_{subtask} in the configuration.

  3. Loads the weights from the logdir, which is either automatically determined by the command line arguments, or can be given manually.

Differences from the original version

Batch normalization

In the original version, we did not apply batch normalization. In the new version, bach normalization is applied to all layers. This significantly speeds-up the learning process, and makes learning stable. This also eliminates the need for us to normalize the dataset when training, and we can instead simply put the data range in a reasonable range, say -1 to 1 and be done with it. Note that since we do this, we also perform batch normalization on the input.

L2-pooling and Spatial subtractive normalization

We found that these layers can be replaced with normal relus and spatial pooling without significant difference. They are removed.

Pretrained models

We provide new models trained on the `Piccadilly' set from the ECCV paper. Note that they have been trained from scratch with the new framework (as opposed to the theano-based framework we used at the time of the ECCV submission), so there are some changes in the architecture and training procedure. Performance should be about on par.

The files can be downloaded here:

The models trained without rotation augmentation perform better on matching problems where the images are generally upright. For data with random rotations, use the models trained with rotation augmentation.

Data generation example

Several people have had issues generating the training data. We have uploaded an example of what these should look like into example, inclusing the scale histogram files, which you're free to re-use.

More Repositories

1

gaussian-splatting-web

TypeScript
510
star
2

LIFT

Code release for the ECCV 2016 paper
Python
479
star
3

disk

Disk code release
Python
272
star
4

EPnP

EPnP: Efficient Perspective-n-Point Camera Pose Estimation
MATLAB
247
star
5

MeshSDF

Code for "MeshSDF: Differentiable Iso-Surface Extraction", NeurIPS2020, SpotLight
Python
213
star
6

segmentation-driven-pose

Segmentation-driven 6D Object Pose Estimation. CVPR 2019.
Python
177
star
7

MeshUDF

Fast and Differentiable Meshing of Unsigned Distance Field Networks
Cython
114
star
8

voxel2mesh

Voxel2Mesh: 3D Mesh Model Generation from Volumetric Data
Python
113
star
9

single-stage-pose

Single-Stage 6D Object Pose Estimation, CVPR 2020
Python
102
star
10

Power-Iteration-SVD

Backpropagation-Friendly-Eigendecomposition
Python
71
star
11

sketch2mesh

Reconstructing and Editing 3D Shapes from Sketches
Python
68
star
12

pyKSP

This is a Python wrapper for the K-Shortest Path tracking algorithm.
C++
66
star
13

social-scene-understanding

Source code for the CVPR 2017 paper
Python
63
star
14

log-polar-descriptors

Public implementation of "Beyond Cartesian Representations for Local Descriptors", ICCV 2019
Jupyter Notebook
59
star
15

wide-depth-range-pose

Wide-Depth-Range 6D Object Pose Estimation in Space, CVPR 2021
Python
56
star
16

detecting-the-unexpected

Detecting the Unexpected via Image Resynthesis
Python
55
star
17

balltracking

Tracking of the ball and the players in team sports
MATLAB
46
star
18

perspective-flow-aggregation

Perspective Flow Aggregation for Data-Limited 6D Object Pose Estimation. ECCV 2022.
Python
34
star
19

LabelGrab

Annotation tool for semantic and instance segmentation, with automated help from the GrabCut implemented in OpenCV.
Python
28
star
20

densecrf

a fork of the densecrf package implementing alternative inference scheme
C++
27
star
21

multiview_calib

Single and multiple view camera calibration tool
Jupyter Notebook
26
star
22

deepdesc-release

Code for the ICCV 2015 paper "Discriminative Learning of Deep Convolutional Feature Point Descriptors"
Lua
24
star
23

adv_param_pose_prior

Adversarial Parametric Pose Prior
Python
23
star
24

multicam-gt

Our Webapp to annotate multi-camera pedestrian detection datasets.
JavaScript
19
star
25

diff-nrsfm

MATLAB
18
star
26

cvlab-kubernetes-guide

Instructions and utilities for use of EPFL's compute cluster.
Python
15
star
27

MVFlow

Python
13
star
28

PA-net

Probabilistic Atlases to Enforce Topological Constraints
Python
9
star
29

mot3d

Fast Single View and Multiview Multi Object Tracking Using Minimum Cost Maximum Flow Formulation
Jupyter Notebook
7
star
30

MVAug

Python
7
star
31

gecco

Code release for GECCO: Geometrically-Conditioned Point Diffusion Models
Python
7
star
32

erasing-road-obstacles

Detecting Road Obstacles by Erasing Them
6
star
33

UCLID-Net

Implementation of UCLID-Net (NeurIPS 2020)
Python
5
star
34

n-queens-benchmark

C++
3
star
35

mf-mrf

Parallel mean-field inference web page
HTML
2
star
36

MARMOT

Multi-Aspect Reconstruction and Multi-Object Tracking
Jupyter Notebook
1
star
37

MAGE

Multi-Aspect Groundplane Estimation
Python
1
star
38

UDA-Hand-Object

Unsupervised Domain Adaptation with Temporal Consistency for 3D Joint Hand-Object Reconstruction
Python
1
star