All Projects → zlthinker → Kfnet

zlthinker / Kfnet

Licence: mit
KFNet: Learning Temporal Camera Relocalization using Kalman Filtering (CVPR 2020 Oral)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Kfnet

Dl Vision Papers
深度学习和三维视觉相关的论文
Stars: ✭ 123 (-23.6%)
Mutual labels:  localization
Punic
PHP translation and localization made easy!
Stars: ✭ 133 (-17.39%)
Mutual labels:  localization
Awesome Audio Visual
A curated list of different papers and datasets in various areas of audio-visual processing
Stars: ✭ 151 (-6.21%)
Mutual labels:  localization
Roenglishre
An unofficial english translation project for Korea Ragnarok Online (kRO).
Stars: ✭ 121 (-24.84%)
Mutual labels:  localization
Autolocalization
iOS Auto Localization for xib and storyboard
Stars: ✭ 128 (-20.5%)
Mutual labels:  localization
Google Play Badge Svg
Hosting for localized versions of Google Play badges in SVG format.
Stars: ✭ 137 (-14.91%)
Mutual labels:  localization
Polypoint
Indoor localization based on the DecaWave DW1000.
Stars: ✭ 119 (-26.09%)
Mutual labels:  localization
Tossi
Chooses correct Korean particle morphs for arbitrary words.
Stars: ✭ 160 (-0.62%)
Mutual labels:  localization
Hierarchical loc
Deep image retrieval for efficient 6-DoF localization
Stars: ✭ 131 (-18.63%)
Mutual labels:  localization
I18n Extract
Manage localization with static analysis. 🔍
Stars: ✭ 152 (-5.59%)
Mutual labels:  localization
Dom I18n
Provides a very basic HTML multilingual support using JavaScript
Stars: ✭ 125 (-22.36%)
Mutual labels:  localization
Openibl
[ECCV-2020 (spotlight)] Self-supervising Fine-grained Region Similarities for Large-scale Image Localization. 🌏 PyTorch open-source toolbox for image-based localization (place recognition).
Stars: ✭ 128 (-20.5%)
Mutual labels:  localization
Localization
🌐 Localization package for Laravel
Stars: ✭ 142 (-11.8%)
Mutual labels:  localization
React I18nify
Simple i18n translation and localization components and helpers for React.
Stars: ✭ 123 (-23.6%)
Mutual labels:  localization
Uwb Localization
Accurate 3D Localization for MAV Swarms by UWB and IMU Fusion.
Stars: ✭ 155 (-3.73%)
Mutual labels:  localization
Ov2slam
OV²SLAM is a Fully Online and Versatile Visual SLAM for Real-Time Applications
Stars: ✭ 119 (-26.09%)
Mutual labels:  localization
Toolbelt.blazor.i18ntext
The class library that provides the ability to localize texts on your Blazor app!
Stars: ✭ 134 (-16.77%)
Mutual labels:  localization
Laravel Nova Localizations
🌎 Localization files for Laravel Nova
Stars: ✭ 161 (+0%)
Mutual labels:  localization
Pythonrobotics
Python sample codes for robotics algorithms.
Stars: ✭ 13,934 (+8554.66%)
Mutual labels:  localization
Jquery.ime
jQuery based input methods library
Stars: ✭ 145 (-9.94%)
Mutual labels:  localization

KFNet

This is a Tensorflow implementation of our CVPR 2020 Oral paper - "KFNet: Learning Temporal Camera Relocalization using Kalman Filtering" by Lei Zhou, Zixin Luo, Tianwei Shen, Jiahui Zhang, Mingmin Zhen, Yao Yao, Tian Fang, Long Quan.

This paper addresses the temporal camera relocalization of time-series image data by folding the scene coordinate regression problem into the principled Kalman filter framework.

If you find this project useful, please cite:

@inproceedings{zhou2020kfnet,
  title={KFNet: Learning Temporal Camera Relocalization using Kalman Filtering},
  author={Zhou, Lei and Luo, Zixin and Shen, Tianwei and Zhang, Jiahui and Zhen, Mingmin and Yao, Yao and Fang, Tian and Quan, Long},
  booktitle={Computer Vision and Pattern Recognition (CVPR)},
  year={2020}
}

Contents

About

Network architecture

drawing

Sample results on 7scenes and 12scenes

KFNet simultaneously predicts the mapping points and camera poses in a temporal fashion within the coordinate system defined by a known scene.

DSAC++ KFNet
7scenes-fire Alt Text Alt Text
12scenes-office2-5a Alt Text Alt Text
Description Blue - ground truth poses Red - estimated poses

Intermediate uncertainty predictions

Below we visualize the measurement and process noise.

Data Measurement noise Process noise
7scenes-fire Alt Text Alt Text
12scenes-office2-5a Alt Text Alt Text
Description The brighter color means smaller noise. The figure bar measures the inverse of the covariances (in centimeters)

Intermediate optical flow results on 7scenes, 12scenes, Cambridge and DeepLoc

As an essential component of KFNet, the process system of KFNet (i.e., OFlowNet) delineates pixel transitions across frames through optical flow reasoning yet without recourse to grourd truth optical flow labelling. We visualize the predicted optical flow fields below while suppressing the predictions with too large uncertainties.

Data Description Optical flow
7scenes-fire Indoor; hand-held; small shaky motions
12scenes-office2-5a Indoor; hand-held; larger movements
Cambridge-KingsCollege Outdoor; hand-held; large random motions
DeepLoc Outdoor; vehicle-mounted; forward motions

Remark For DeepLoc, since OFlowNet is trained only on one scene included in DeepLoc, the flow predictions appear somewhat messy due to the lack of training data. Training with a larger amount and variety of data would improve the results.

Usage

File format

  • Input: The input folder of a project should contain the files below.

    • image_list.txt comprising the sequential full image paths in lines. Please go to the 7scenes dataset to download the source images.
    • label_list.txt comprising the full label paths in lines corresponding to the images. The label files are generated by the tofile() function of numpy matrices. They have a channel number of 4, with 3 for scene coordinates and 1 for binary masks of pixels. The mask for one pixel is 1 if its label scene coordinates are valid and 0 otherwise. Their resolutions are 8 times lower than the images. For example, for the 7scenes dataset, the images have a resolution of 480x640, while the label maps have a resolution of 60x80.
    • transform.txt recording the 4x4 Euclidean transformation matrix which decorrelates the scene point cloud to give zero mean and correlations.
    • You can download the prepared input label map files of 7scenes from the Google drive links below.
    chess(13G) fire(9G) heads(4G) office(22G) pumpkin(13G) redkitchen(27G) stairs(7G)
  • Output: The testing program (to be introduced below) outputs a 3-d scene coordinate map (in meters) and a 1-d confidence map into a 4-channel numpy matrix for each input image. And then you can run the provided PnP program (in PnP.zip) or your own algorithms to compute the camera poses from them.

    • The confidences are the inverse of predicted Gaussian variances / uncertainties. Thus, the larger the confidences, the smaller the variances are.
    • You can visualize a scene coordinate map as a point cloud via Open3d by running python vis/vis_scene_coordinate_map.py <path_to_npy_file>.
    • Or you can visualize a streaming scene coordinate map list by running python vis/vis_scene_coordinate_map_list.py <path_to_npy_list>.

Environment

  • The codes are tested along with

    • python 2.7,
    • tensorflow-gpu 1.10~1.13 (inclusive),
    • corresponding versions of CUDA and CUDNN to enable tensorflow-gpu (see link for reference of the version combinations),
    • other python packages including numpy, matplotlib and open3d.
  • To directly install tensorflow and other python packages, run

sudo pip install -r requirements.txt
  • If you are familiar with Conda, you can create the environment for KFNet by running
conda create -f environment.yml
conda activate KFNet

Testing

  • Download

You can download the trained models of 7scenes from the Google drive link (3G).

  • Test SCoordNet
git checkout SCoordNet
python SCoordnet/eval.py --input_folder <input_folder> --output_folder <output_folder> --model_folder <model_folder> --scene <scene>
# <scene> = chess/fire/heads/office/pumpkin/redkitchen/stairs, i.e., one of the scene names of 7scenes dataset
  • Test OFlowNet
git checkout OFlowNet
python OFlowNet/eval --input_folder <input_folder> --output_folder <output_folder> --model_folder <model_folder>

The testing program of OFlowNet will save the 2-d optical flows and 1-d uncertainties of consecutive image pairs as npy files of the dimension 60x80x3. You can visualize the flow results by running scripts vis/vis_optical_flow.py and vis/vis_optical_flow_list.py.

  • Test KFNet
git checkout master
python KFNet/eval.py --input_folder <input_folder> --output_folder <output_folder> --model_folder <model_folder> --scene <scene>
  • Run PnP to compute camera poses
unzip PnP.zip && cd PnP
python main.py <path_to_output_file_list> <output_folder> --gt <path_to_ground_truth_pose_list> --thread_num <32>
// Please note that you need to install git-lfs before cloning to get PnP.zip, since the zip file is stored via LFS.

Training

The training procedure has 3 stages.

  1. Train SCoordNet for each scene independently.
git checkout SCoordnet
python SCoordNet/train.py --input_folder <input_folder> --model_folder <scoordnet_model_folder> --scene <scene>
  1. Train OFlowNet using all the image sequences that are not limited to any specific scenes, for example, concatenating all the image_list.txt and label_list.txt of 7scenes for training.
git checkout OFlowNet
python OFlowNet/train.py --input_folder <input_folder> --model_folder <oflownet_model_folder>
  1. Train KFNet for each scene from the pre-trained SCoordNet and OFlowNet models to jointly finetune their parameters.
git checkout master
python KFNet/train.py --input_folder <input_folder> --model_folder <model_folder> --scoordnet <scoordnet_model_folder> --oflownet <oflownet_model_folder> --scene <scene>

Credit

This implementation was developed by Lei Zhou. Feel free to contact Lei for any enquiry.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].