在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):vislearn/esac开源软件地址(OpenSource Url):https://github.com/vislearn/esac开源编程语言(OpenSource Language):C++ 49.9%开源软件介绍(OpenSource Introduction):ESAC - Expert Sample Consensus Applied To Camera Re-Localization
IntroductionExpert Sample Consensus (ESAC) is a method to fit a parametric model to an observation. In particular, this code fits the absolute 6D camera pose (the parametric model) to an RGB image (the observation). ESAC can be trained for a large, complex environment, and is then able to re-localize within this environment given a single image. ESAC relies on ensemble of expert networks where each expert specializes to one part of the environment. A gating network decides which expert is responsible for a given input image. ESAC builds upon Scene Coordinate Regression and differentiable RANSAC (DSAC), in particular it extends our previous re-localization pipeline, DSAC++, and makes it scalable. Please refer to the ESAC paper for a detailed, and formal description of the method. You find a bibtex reference of the paper at the end of this readme. The ESAC project page collects pointers to additional resources. InstallationESAC is based on PyTorch, and includes a custom C++ extension which you have to compile and install (but it's easy). The main ESAC framework is implemented in Python, including data processing and setting parameters. The C++ extension encapsulates robust pose optimization and the respective gradient calculation for efficiency reasons. ESAC requires the following python packages, and we tested it with the package version in brackets.
You compile and install the C++ extension by executing: cd code/esac
python setup.py install Compilation requires access to OpenCV header files and libraries. If you are using Conda, the setup script will look for the OpenCV package in the current Conda environment. Otherwise (or if that fails), you have to set the OpenCV library directory and include directory yourself by editing the setup.py file. If compilation succeeds, you can Code StructureThis repository contains:
The core of the code are the scripts Data StructureThe Each sub-folder of
Training and test folders contain the following sub-folders:
Correspondences of files across the different sub-folders will be established by alphabetical ordering. Details for image files: Any format supported by Details for pose files: Text file. Contains 4x4 matrix following the 7Scenes/12Scenes coordinate convention. Details for calibration files: Text file. At the moment we only support the camera focal length (one value shared for x- and y-direction, in px). The principal point is assumed to lie in the image center. Details for init files: (3xHxW) tensor (standard PyTorch file format via EnvironmentsAn environment is a combination of individual dataset scenes, e.g. in the paper we combine all individual scenes from the 7Scenes and 12Scenes datasets to the 19Scenes environment.
We use a simple text file called
The center coordinate specifies the center coordinate of the local scene coordinate system which we use for normalization, moving the center to (0,0,0).
You can omit the center coordinate specification, in which case we assume (0,0,0) for the center.
The environments folder in this repository contains environment configurations for all experiments conducted in our paper.
We also provide pre-trained models for each environment which you can access using the Dataset ClassesThe ESAC code supports two types of environments, implemented by two distinct dataset classes: Room Dataset ( Note: Running Cluster Dataset ( Currently, a combination of room dataset and cluster dataset is not possible.
Whenever the number of cluster is > 1, the cluster dataset will be used, and the Emulating DSAC++When you provide an Supported DatasetsWe support the following datasets that have been used in the paper: We provide scripts to download and transform each dataset into the format required by ESAC. Note that for the Dubrovnik dataset, the original images are not freely available. See details below. 7/12/19 Scenes7Scenes (MSR) and 12Scenes (Stanford) are two small-scale indoor re-localization datasets.
Normally, camera re-localization for both datasets is performed per scene.
To evaluate ESAC, we map all scenes of both datasets to a common coordinate space using the We also provide pre-trained models of ESAC for all these scenarios, see the download scripts in the respective environment folders. After downloading, you can evaluate our pre-trained models by calling: environments/7scenes> python ../../code/test_esac.py -sid pretrained
environments/12cenes> python ../../code/test_esac.py -sid pretrained
environments/19scenes> python ../../code/test_esac.py -sid pretrained Note: Running DubrovnikDubrovnik6k (cornell) is a large-scale outdoor re-localization dataset.
We apply ESAC using the We provide pre-trained models of ESAC for Dubrovnik, see the download script in the respective environment folder. After downloading, three pre-trained models will be available, corresponding to ESAC with 10, 20 or 50 experts. You can evaluate e.g. our pre-trained model with 10 experts by calling: environments/dubrovnik> python ../../code/test_esac.py -c 10 -sid c10_pretrained Aachen Day/NightAachen Day/Night (Sattler) is a large-scale outdoor re-localization dataset.
We apply ESAC using the Note: The dataset has no public test ground truth. The dataset script will create dummy ground truth in the form of identity camera poses. The actual pose evaluation has to be performed via the dataset website (details below). We provide pre-trained models of ESAC for Aachen, see the download script in the respective environment folder. After downloading, three pre-trained models will be available, corresponding to ESAC with 10, 20 or 50 experts. You can run e.g. our pre-trained model with 10 experts by calling: environments/aachen> python ../../code/test_esac.py -c 10 -sid c10_pretrained As mentioned above, there is no test ground truth available, and the evaluation script will display arbitrary pose errors corresponding to our dummy ground truth.
However, Training ESACTraining ESAC proceeds in two stages: Initialization of all individual networks (gating and experts), and end-to-end training of all networks jointly.
You may call all training scripts discussed in the following with the The following procedure assumes that you call all scripts from an environment sub-folder with a If you are training ESAC for a large connected area (like Dubrovnik or Aachen), specify the number of experts to use via the For each environment used in the paper, we provide an extra README.md in its Each training script will create a log file InitializationTo initialize the gating network call: environments/env_name> python ../../code/init_gating.py The script will train the gating network to classify the correct scene/cluster. To initialize an expert network call: environments/env_name> python ../../code/init_expert.py -e <expert id> The script will train an expert using ground truth scene coordinates. Note: You have to initialize one expert per scene, i.e. one expert per room for the indoor datasets, and one expert per cluster for the outdoor datasets. Because the initialization of each expert is independent, you can run them in parallel on multiple GPUs. Optionally, you can refine an expert by calling: environments/env_name> python ../../code/ref_expert.py -e <expert id> Refinement will optimize the reprojection error of scene coordinate predictions, independent of any scene coordinate ground truth.
We adivse this step, if scene coordinate ground truth is sparse or unreliable, e.g. we did refinement for Dubrovnik and Aachen, but not for 7/12/19Scenes.
If you do refinement, be sure to call the end-to-end training (next point) with the option End-to-End TrainingTo perform end-to-end training of all networks call: environments/env_name> python ../../code/train_esac.py The result will be stored as Note: Since end-to-end training optimizes all networks jointly, memory can become an issue.
If you run into memory limits, use the Testing ESACTo test ESAC call: environments/env_name> python ../../code/test_esac.py This will estimate poses for the test set, and compare them to the respective ground truth. Running the script creates two output files:
Note: The Aachen dataset has no public test ground truth.
The evaluation script will display arbitrary pose errors corresponding to our dummy ground truth.
To evaluate, upload Call the test script with the PublicationPlease cite the following paper if you use ESAC or parts of this code in your own work.
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论