File size: 3,215 Bytes
a80d6bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# DarkFeat

DarkFeat: Noise-Robust Feature Detector and Descriptor for Extremely Low-Light RAW Images (AAAI2023 Oral)

<img src="./fig/fig.gif" alt="darkfeat demo">

### Installation

```shell
git clone git@github.com:THU-LYJ-Lab/DarkFeat.git
cd DarkFeat
pip install -r requirements.txt
```

[Pytorch](https://pytorch.org/) installation is machine dependent, please install the correct version for your machine.

### Demo

```shell
python ./demo_darkfeat.py \
	--input /path/to/your/sequence \
	--output_dir ./output \
	--resize 960 640 \
	--model_path /path/to/pretrained/weights
```

Sample raw image sequences and pretrained weights can be downloaded from [here](https://drive.google.com/drive/folders/1zkUCsBVEmQcPZPhsEUymA5GIvAzi12hD?usp=sharing).

Note that different pytorch and cuda versions may cause different model output results, and the output matches may differ from those shown in the gif. The results are tested in python 3.6, PyTorch 1.10.2 and cuda 10.2.

### Evaluation

1. Download [MID](https://github.com/Wenzhengchina/Matching-in-the-Dark) Dataset.

2. Preprocessing the data in MID dataset, you can choose whether to enable histogram equalization or not:

   ```shell
   python raw_preprocess.py --dataset_dir /path/to/MID/dataset
   ```

3. Extract the keypoints and descriptors, followed by a nearest neighborhood matching:

   ```shell
   python export_features.py \
     --model_path /path/to/pretrained/weights \
     --dataset_dir /path/to/MID/dataset
   ```

4. Estimate the pose through corresponding keypoint pairs:

   ```shell
   python pose_estimation.py --dataset_dir /path/to/MID/dataset
   ```

5. Finally collect the results of pose estimation errors:

   ```
   python read_error.py
   ```

### Training from scratch

We use [GL3D](https://github.com/lzx551402/GL3D) as our source training-use matching dataset. Please follow the [instructions](https://github.com/lzx551402/GL3D) to download and unzip all the data (including GL3D group and tourism group).

Then using the preprocessing code provided by ASLFeat to generate matching informations:

```shell
git clone https://github.com/lzx551402/tfmatch
# please edit the GL3D path in the shell script before executing.
cd tfmatch
sh train_aslfeat_base.sh
```

To launch the training, configure your training hyperparameters inside `./configs` and then run:

```shell
# stage1
python run.py --stage 1 --config ./configs/config_stage1.yaml \
	--dataset_dir /path/to/your/GL3D/dataset \
	--job_name YOUR_JOB_NAME
# stage2 
python run.py --stage 2 --config ./configs/config_stage1.yaml \
	--dataset_dir /path/to/your/GL3D/dataset \
	--job_name YOUR_JOB_NAME \
	--start_cnt 160000
# stage3
python run.py --stage 3 --config ./configs/config.yaml \
	--dataset_dir /path/to/your/GL3D/dataset \
	--job_name YOUR_JOB_NAME \
	--start_cnt 220000
```

### Acknowledgements

This project could not be possible without the open-source works from [ASLFeat](https://github.com/lzx551402/ASLFeat), [R2D2](https://github.com/naver/r2d2),  [MID](https://github.com/Wenzhengchina/Matching-in-the-Dark), [GL3D](https://github.com/lzx551402/GL3D), [SuperGlue](https://github.com/magicleap/SuperGluePretrainedNetwork). We sincerely thank them all.