The pipeline to compute 3D models of a crop field and to properly register them. Includes the codes of the experiments done in the paper. This relies on the repository Hierarchical_Localization for performing localization between query and reference images.
cd interday_crop_registration/crop_alignment
conda env create -f environment.yaml
conda activate hloc
There are two files provided, each correspond to an experiment in the paper.
run_exp.py
: Experiment V.B in the paper. Evaluate the registration pipeline's capability when varying the time intervals between the query and reference models. Query-Reference pairs are defined here.run_pipeline.py
: Experiment V.C in the paper. Mimic the real use case. Run the registration pipeline sequentially, with ground truth model only used in refining the first model.
To run them, follow the following steps:
-
Prepare datasets
- Download the dataset for crop alignment.
- Modify the paths in the
run_xxx.py
scripts to match the paths of the extracted downloaded files first. Openrun_exp.py
orrun_pipeline.py
and change the following path:# TODO: Change the path to match the paths of the extracted downloaded dataset source_images_path = '/path/to/Wheat_2019_images'
-
Invoke retrained models
-
[Option 1] Use the retrained models used in the paper. In that case, you can skip this step. *Note: We provide the two models mentioned in the paper, one trained with considering height change and one without. The name idtifiers are
'loftr_23_0.5_hc'
and'loftr_23_0.5'
. Here's an example of using them to identify a matcher fromrun_exp.py
:extractor_matchers = [ ['sift', 'NN-ratio'], ['superpoint_aachen', 'superglue'], [None, 'loftr'], # extractor for LoFTR is None because it does not need feature extractor [None, 'loftr_23_0.5'], # retrained LoFTR without height change [None, 'loftr_23_0.5_hc'], # retrained LoFTR with height change ]
-
[Option 2] Retrain a new LoFTR model. Refer to Hierarchical_Localization for instructions on enabling
hloc
to support self-trained LoFTR models.
-
-
Run the code
python run_xxx.py