├── .assets
├── Content-aware
│ ├── Ablation.png
│ ├── Feature_extractor.png
│ ├── Homography estimator.png
│ ├── Mask predictor.png
│ ├── Mask_result.png
│ ├── Network structure.png
│ ├── Triplet loss.png
│ ├── comparison.png
│ ├── dataset.png
│ ├── exp_1.png
│ ├── exp_2.png
│ └── exp_3.png
├── DeepHomography
│ ├── 4points_parameterization.png
│ ├── Classification HomographyNet.png
│ ├── Deep Image Homography Estimation.png
│ ├── Regression HomographyNet.png
│ ├── Training Data Generation.png
│ └── experiment result.png
├── Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography
│ ├── Edge-Preserved Deformation Network.png
│ ├── Large-Baseline Deep Homography Network.png
│ ├── Size-Free Stitching.png
│ ├── ex1.png
│ ├── ex2.png
│ ├── ex3.png
│ ├── fusion block.png
│ └── residual homography offsets.png
├── Real_Time_Image_Stitching
│ ├── cameraSystem0.png
│ ├── cameraSystem1.png
│ ├── cameraSystem2.png
│ ├── cameraSystem3.png
│ └── netArchitecture.png
├── Unsupervised
│ ├── Photometric loss.png
│ ├── experiment_1.png
│ ├── experiment_2.png
│ ├── experiment_3.png
│ ├── experiment_4.png
│ ├── network structure.png
│ ├── pipeline1.png
│ └── pipeline2.png
├── VFISnet
│ ├── ContentRevision.png
│ ├── HEstimation.png
│ ├── datasetGen.png
│ └── structureStitching.png
└── deepmeshflow
│ ├── ex.png
│ ├── mask.png
│ ├── meshflowMask.png
│ ├── network.png
│ ├── result1.png
│ └── result2.png
├── .idea
├── .gitignore
├── DeepHomographyEstimation.iml
├── inspectionProfiles
│ ├── Project_Default.xml
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
└── vcs.xml
├── README.md
├── dataset
├── Content-Aware-DeepH-Data
│ └── test
├── Synthetic Dataset
│ └── test
├── UDIS-D
│ ├── test
│ │ └── test
│ └── train
│ │ ├── input1
│ │ ├── 003001.jpg
│ │ ├── 003118.jpg
│ │ ├── 004295.jpg
│ │ ├── 005334.jpg
│ │ └── 009194.jpg
│ │ └── input2
│ │ ├── 003001.jpg
│ │ ├── 003118.jpg
│ │ ├── 004295.jpg
│ │ ├── 005334.jpg
│ │ └── 009194.jpg
└── dataset_info.md
└── doc
├── Content-aware.md
├── DeepHomographyEstimation.md
├── DeepMeshFlow.md
├── Depth-aware.md
├── Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography.md
├── Real_Time_Image_Stitching.md
├── Unsupervised_deephomo.md
└── VFISnet.md
/.assets/Content-aware/Ablation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/Ablation.png
--------------------------------------------------------------------------------
/.assets/Content-aware/Feature_extractor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/Feature_extractor.png
--------------------------------------------------------------------------------
/.assets/Content-aware/Homography estimator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/Homography estimator.png
--------------------------------------------------------------------------------
/.assets/Content-aware/Mask predictor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/Mask predictor.png
--------------------------------------------------------------------------------
/.assets/Content-aware/Mask_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/Mask_result.png
--------------------------------------------------------------------------------
/.assets/Content-aware/Network structure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/Network structure.png
--------------------------------------------------------------------------------
/.assets/Content-aware/Triplet loss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/Triplet loss.png
--------------------------------------------------------------------------------
/.assets/Content-aware/comparison.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/comparison.png
--------------------------------------------------------------------------------
/.assets/Content-aware/dataset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/dataset.png
--------------------------------------------------------------------------------
/.assets/Content-aware/exp_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/exp_1.png
--------------------------------------------------------------------------------
/.assets/Content-aware/exp_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/exp_2.png
--------------------------------------------------------------------------------
/.assets/Content-aware/exp_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Content-aware/exp_3.png
--------------------------------------------------------------------------------
/.assets/DeepHomography/4points_parameterization.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/DeepHomography/4points_parameterization.png
--------------------------------------------------------------------------------
/.assets/DeepHomography/Classification HomographyNet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/DeepHomography/Classification HomographyNet.png
--------------------------------------------------------------------------------
/.assets/DeepHomography/Deep Image Homography Estimation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/DeepHomography/Deep Image Homography Estimation.png
--------------------------------------------------------------------------------
/.assets/DeepHomography/Regression HomographyNet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/DeepHomography/Regression HomographyNet.png
--------------------------------------------------------------------------------
/.assets/DeepHomography/Training Data Generation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/DeepHomography/Training Data Generation.png
--------------------------------------------------------------------------------
/.assets/DeepHomography/experiment result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/DeepHomography/experiment result.png
--------------------------------------------------------------------------------
/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/Edge-Preserved Deformation Network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/Edge-Preserved Deformation Network.png
--------------------------------------------------------------------------------
/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/Large-Baseline Deep Homography Network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/Large-Baseline Deep Homography Network.png
--------------------------------------------------------------------------------
/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/Size-Free Stitching.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/Size-Free Stitching.png
--------------------------------------------------------------------------------
/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/ex1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/ex1.png
--------------------------------------------------------------------------------
/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/ex2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/ex2.png
--------------------------------------------------------------------------------
/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/ex3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/ex3.png
--------------------------------------------------------------------------------
/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/fusion block.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/fusion block.png
--------------------------------------------------------------------------------
/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/residual homography offsets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography/residual homography offsets.png
--------------------------------------------------------------------------------
/.assets/Real_Time_Image_Stitching/cameraSystem0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Real_Time_Image_Stitching/cameraSystem0.png
--------------------------------------------------------------------------------
/.assets/Real_Time_Image_Stitching/cameraSystem1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Real_Time_Image_Stitching/cameraSystem1.png
--------------------------------------------------------------------------------
/.assets/Real_Time_Image_Stitching/cameraSystem2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Real_Time_Image_Stitching/cameraSystem2.png
--------------------------------------------------------------------------------
/.assets/Real_Time_Image_Stitching/cameraSystem3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Real_Time_Image_Stitching/cameraSystem3.png
--------------------------------------------------------------------------------
/.assets/Real_Time_Image_Stitching/netArchitecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Real_Time_Image_Stitching/netArchitecture.png
--------------------------------------------------------------------------------
/.assets/Unsupervised/Photometric loss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Unsupervised/Photometric loss.png
--------------------------------------------------------------------------------
/.assets/Unsupervised/experiment_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Unsupervised/experiment_1.png
--------------------------------------------------------------------------------
/.assets/Unsupervised/experiment_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Unsupervised/experiment_2.png
--------------------------------------------------------------------------------
/.assets/Unsupervised/experiment_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Unsupervised/experiment_3.png
--------------------------------------------------------------------------------
/.assets/Unsupervised/experiment_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Unsupervised/experiment_4.png
--------------------------------------------------------------------------------
/.assets/Unsupervised/network structure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Unsupervised/network structure.png
--------------------------------------------------------------------------------
/.assets/Unsupervised/pipeline1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Unsupervised/pipeline1.png
--------------------------------------------------------------------------------
/.assets/Unsupervised/pipeline2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/Unsupervised/pipeline2.png
--------------------------------------------------------------------------------
/.assets/VFISnet/ContentRevision.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/VFISnet/ContentRevision.png
--------------------------------------------------------------------------------
/.assets/VFISnet/HEstimation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/VFISnet/HEstimation.png
--------------------------------------------------------------------------------
/.assets/VFISnet/datasetGen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/VFISnet/datasetGen.png
--------------------------------------------------------------------------------
/.assets/VFISnet/structureStitching.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/VFISnet/structureStitching.png
--------------------------------------------------------------------------------
/.assets/deepmeshflow/ex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/deepmeshflow/ex.png
--------------------------------------------------------------------------------
/.assets/deepmeshflow/mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/deepmeshflow/mask.png
--------------------------------------------------------------------------------
/.assets/deepmeshflow/meshflowMask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/deepmeshflow/meshflowMask.png
--------------------------------------------------------------------------------
/.assets/deepmeshflow/network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/deepmeshflow/network.png
--------------------------------------------------------------------------------
/.assets/deepmeshflow/result1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/deepmeshflow/result1.png
--------------------------------------------------------------------------------
/.assets/deepmeshflow/result2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/.assets/deepmeshflow/result2.png
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Datasource local storage ignored files
5 | /dataSources/
6 | /dataSources.local.xml
7 | # Editor-based HTTP Client requests
8 | /httpRequests/
9 |
--------------------------------------------------------------------------------
/.idea/DeepHomographyEstimation.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DeepHomographyEstimation
2 | 这是基于深度学习神经网络预测**单应性矩阵**,并用于后续拼接和其他视觉任务的论文汇总。其中涉及的论文有如下几篇。所有论文的数据集整理在dataset文件夹下。网络的结构、损失函数的设计以及论文各自的方法将总结在doc文件夹下,点击以下的超链接直接跳转。后续会持续更新总结相关论文的思路方法。
3 |
4 | ## 基于监督学习的单应估计网络
5 | - [Deep image homography estimation(2016)](./doc/DeepHomographyEstimation.md)
6 | - [A view-free image stitching network based on global homography(2020)](./doc/VFISnet.md)
7 | - [Real-Time Image Stitching with Convolutional Neural Networks(2019)](./doc/Real_Time_Image_Stitching.md)
8 | - [Learning Edge-Preserved Image Stitching from Large-Baseline Deep Homography(2020)](./doc/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography.md)
9 |
10 |
11 |
12 | ## 基于非监督学习的单应估计网络
13 | - [Unsupervised Deep Homography: A Fast and Robust Homography Estimation Model(2018)](./doc/Unsupervised_deephomo.md)
14 | - [Content-Aware Unsupervised Deep Homography Estimation(2020)](./doc/Content-aware.md)
15 | - [Depth-Aware Multi-Grid Deep Homography Estimation with Contextual Correlation(2021)](./doc/Depth-aware.md)
16 | - [DeepMeshFlow: Content Adaptive Mesh Deformation for Robust Image Registration](./doc/deepmeshflow.md)
17 |
18 |
19 |
20 |
21 |
22 | ## 数据集汇总
23 | - Synthetic Dataset(COCO合成数据集)
24 | - Content-Aware-DeepH-Data(视频数据集)
25 | - UDIS-D(视差宽基线图像)
26 |
27 |
28 | > !- 文章中公式不渲染的部分建议下载chrome插件MathJax Plugin for Github
29 |
--------------------------------------------------------------------------------
/dataset/Content-Aware-DeepH-Data/test:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/dataset/Synthetic Dataset/test:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/dataset/UDIS-D/test/test:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/dataset/UDIS-D/train/input1/003001.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/dataset/UDIS-D/train/input1/003001.jpg
--------------------------------------------------------------------------------
/dataset/UDIS-D/train/input1/003118.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/dataset/UDIS-D/train/input1/003118.jpg
--------------------------------------------------------------------------------
/dataset/UDIS-D/train/input1/004295.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/dataset/UDIS-D/train/input1/004295.jpg
--------------------------------------------------------------------------------
/dataset/UDIS-D/train/input1/005334.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/dataset/UDIS-D/train/input1/005334.jpg
--------------------------------------------------------------------------------
/dataset/UDIS-D/train/input1/009194.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/dataset/UDIS-D/train/input1/009194.jpg
--------------------------------------------------------------------------------
/dataset/UDIS-D/train/input2/003001.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/dataset/UDIS-D/train/input2/003001.jpg
--------------------------------------------------------------------------------
/dataset/UDIS-D/train/input2/003118.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/dataset/UDIS-D/train/input2/003118.jpg
--------------------------------------------------------------------------------
/dataset/UDIS-D/train/input2/004295.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/dataset/UDIS-D/train/input2/004295.jpg
--------------------------------------------------------------------------------
/dataset/UDIS-D/train/input2/005334.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/dataset/UDIS-D/train/input2/005334.jpg
--------------------------------------------------------------------------------
/dataset/UDIS-D/train/input2/009194.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Leeing98/DeepHomographyEstimation/e49673b81cb585aa9e772d8f0b2b378cce278976/dataset/UDIS-D/train/input2/009194.jpg
--------------------------------------------------------------------------------
/dataset/dataset_info.md:
--------------------------------------------------------------------------------
1 | # 数据集说明文档(未完)
2 |
3 | ## Synthetic数据集
4 | 由于本数据集的合成方式最早由Daniel等人在2016年提出,后续的论文皆为该论文上的进一步推广,因此许多后续论文都将该数据集作为对比实验进行测试。后续许多论文以实验证明,该数据集由于合成时仅采用了一个单应矩阵的变换,没有考虑到深度差异,导致训练后的网络在真实数据集上输出结果误差较大。
5 |
6 | > 选用本数据集的论文有:
7 | > 1. Deep image Homography Estimation
8 | > 2. Unsupervised Deep Homography: A Fast and Robust Homography Estimation Model
9 | > 3. Content-aware
10 |
11 | 该合成数据集是用MSCOCO2014的训练集和测试集制作的,具体的合成细节请看来自Daniel团队的论文。
12 | - 处理前:网站下载的图像分别放在**train2014(82783 items)**、**test2014(6 items)**、**val2014(8 items)** 三个文件夹下(图像大小不一)
13 | - 处理后:生成新的处理后的文件夹**train2014processed**、**test2014processed**、**val2014processed**。参考的论文以numpy库下的np.save存储为**npy文件**,分别包含两个大小一致的patch和一个GT的矩阵H。
14 |
15 | ## Content-Aware-DeepH-Data数据集
16 |
17 |
--------------------------------------------------------------------------------
/doc/Content-aware.md:
--------------------------------------------------------------------------------
1 | # Content-Aware Unsupervised Deep Homography Estimation
2 | ###### 本篇论文是基于非监督学习的神经网络,吸收了Daniel监督学习的思路采用深度神经网络估计单应矩阵,预测的形式依然采用四个点的8维偏移量。但本篇区别于前两篇的改进点在于它提出了利用特征图而不是原图像来计算损失函数,并且它提出了mask的思路来实现对图像中纹理较少和运动等影响匹配的情形进行削弱,对图像中特征明显的部分加大权重,以此同时实现类ransac和类Attention机制的作用。
3 |
4 |
5 | > - 论文来源:[Content-Aware Unsupervised Deep Homography Estimation.(pdf)](https://arxiv.org/pdf/1909.05983)
6 | > - 数据集:合成数据集MSCOCO2014/2017、视频数据集Content-Aware-DeepH-Data
7 | > - 参考主页:[JirongZhang(项目源码)](https://github.com/JirongZhang/DeepHomography)
8 |
9 |
10 |
11 |
12 | ## 1. 主要思路
13 | 首先根据下图,我们分析基于特征的方法和基于深度学习的方法存在的缺点和不足:
14 |
15 |

16 |
17 |
18 | 在上图中分别取了三种具有代表性的场景:
19 | 1. 有运动的前景
20 | 2. 包含纹理较少的场景(雪地、海洋或天空等)
21 | 3. 光照过强或过弱
22 |
23 | 图中是两张图叠在一起的结果,其中一张图只叠加了图像的蓝绿通道,另一张图像只保留红色通道。显示红色或青色的地方就是没有对齐的部分,反之显示原色的部分是对齐的。
24 |
25 | #### 基于特征的单应估计
26 | > 图中第一列的就是特征估计单应矩阵的结果,出现了很大部分没有对齐的地方,尤其表现在没有纹理和光照过暗的场景下。造成配准结果较差的原因有:
27 | > 1. 匹配点少
28 | > 2. 特征点**分布不均匀**
29 | > 3. 需要过滤场景中**不占主导地位的平面**或**运动的物体**上的特征点
30 |
31 |
32 | #### 基于深度学习的单应矩阵预测
33 | > 图中第二列为2018年Nguyen团队提出的非监督学习的框架,对真实数据的配准,基于深度学习的方法对于所有情形上的配准结果都比较一致。在低光照情形下,甚至比SIFT的效果好得多,这也印证了Unsupervised论文中的实验结论。
34 |
35 | #### 基于内容学习的单应估计
36 | - 本文主要提出了利用一个特征提取网络提取原图像的特征图
37 | - 利用mask预测网络来对图像的内容进行加权,把注意力放在主要信息上来预测单应矩阵,并在计算损失函数时利用mask过滤非主导信息。
38 |
39 |
40 |
41 | ## 2. 数据集
42 | 本文的数据集为Content-Aware-DeepH-Data,是作者团队拍摄的视频数据。视频数据放置在项目源码文件夹内的/Data文件夹内。数据的读取方式是从Train_List.txt文件中读取,每一行记录两帧的文件名。txt的生成方式本文没有给出,是由个人定义的。项目文件中给出的两帧图像间隔的帧数经观察为2~8帧,因此两幅图像之间的重叠率基本在70%以上。
43 |
44 |

45 |
46 |
47 | 数据集的读取函数在项目文件的dataset.py中,主要就是根据Train_List.txt文件的文件名读取文件,并对图像做预处理。return的对象包含:两张原图,输入网络的两个patch,patch的索引和patch的四个顶点坐标。
48 |
49 | ```python
50 | org_img = np.concatenate([img_1, img_2], axis=0)
51 |
52 | x = np.random.randint(self.rho, self.WIDTH - self.rho - self.patch_w)
53 | y = np.random.randint(self.rho, self.HEIGHT - self.rho - self.patch_h)
54 |
55 | input_tesnor = org_img[:, y: y + self.patch_h, x: x + self.patch_w]
56 |
57 | y_t_flat = np.reshape(self.y_mesh, (-1))
58 | x_t_flat = np.reshape(self.x_mesh, (-1))
59 | patch_indices = (y_t_flat + y) * self.WIDTH + (x_t_flat + x)
60 |
61 | top_left_point = (x, y)
62 | bottom_left_point = (x, y + self.patch_h)
63 | bottom_right_point = (self.patch_w + x, self.patch_h + y)
64 | top_right_point = (x + self.patch_w, y)
65 | h4p = [top_left_point, bottom_left_point, bottom_right_point, top_right_point]
66 |
67 | h4p = np.reshape(h4p, (-1))
68 |
69 | org_img = torch.tensor(org_img)
70 | input_tesnor = torch.tensor(input_tesnor)
71 | patch_indices = torch.tensor(patch_indices)
72 | h4p = torch.tensor(h4p)
73 |
74 | return (org_img, input_tesnor, patch_indices, h4p)
75 | ```
76 |
77 |
78 |
79 | ## 3. 网络结构
80 | 如下图所示是本文网络的整体框架,主要集中在上一章节的三个大改进上。输入阶段是两张大小一样的图像,每幅图像都分别进入一个特征提取网络和一个Mask预测网络。特征提取网络输出的图像$F_a$和mask预测网络输出的图像$M_a$大小一致,最后进行一个矩阵的点乘得到图像$G_a$。两个经过点乘的图像输入单应性估计网络得到预测的8维向量结果。
81 |
82 |
83 |

84 |
85 |
86 |
87 |
88 | 以下是本文网络最重要的三个网络:
89 | #### 3.1 Feature extractor(特征图提取)
90 | 根据源码的书写,输入特征提取网络的图像不是原图org_img(大小为640x360)而是选取的input_tensor(大小为560x315)。
91 |
92 |
93 |

94 |
95 |
96 |
97 |
98 | ```python
99 | self.ShareFeature = nn.Sequential(
100 | nn.Conv2d(1, 4, kernel_size=3, padding=1, bias=False),
101 | nn.BatchNorm2d(4),
102 | nn.ReLU(inplace=True),
103 |
104 | nn.Conv2d(4, 8, kernel_size=3, padding=1, bias=False),
105 | nn.BatchNorm2d(8),
106 | nn.ReLU(inplace=True),
107 |
108 | nn.Conv2d(8, 1, kernel_size=3, padding=1, bias=False),
109 | nn.BatchNorm2d(1),
110 | nn.ReLU(inplace=True),
111 | )
112 | ```
113 |
114 |
115 |
116 |
117 | #### 3.2 Mask predictor(mask预测)
118 | 输入该mask预测网络的图像是原图大小,然后利用函数getPatchFromFullimg得到patch大小的图像。
119 |
120 |
121 |

122 |
123 |
124 |
125 |
126 | ```python
127 | self.genMask = nn.Sequential(
128 | nn.Conv2d(1, 4, kernel_size=3, padding=1, bias=False),
129 | nn.BatchNorm2d(4),
130 | nn.ReLU(inplace=True),
131 |
132 | nn.Conv2d(4, 8, kernel_size=3, padding=1, bias=False),
133 | nn.BatchNorm2d(8),
134 | nn.ReLU(inplace=True),
135 |
136 | nn.Conv2d(8, 16, kernel_size=3, padding=1, bias=False),
137 | nn.BatchNorm2d(16),
138 | nn.ReLU(inplace=True),
139 |
140 | nn.Conv2d(16, 32, kernel_size=3, padding=1, bias=False),
141 | nn.BatchNorm2d(32),
142 | nn.ReLU(inplace=True),
143 |
144 | nn.Conv2d(32, 1, kernel_size=3, padding=1, bias=False),
145 | nn.BatchNorm2d(1),
146 | nn.Sigmoid(),
147 | )
148 | ```
149 |
150 |
151 |
152 | #### 3.3 Homography estimator(单应性估计)
153 |
154 |
155 |

156 |
157 |
158 |
159 | 在此网络中,我们注意到一个问题——该网络的输入图像大小是不固定的。这是因为在单应估计网络这部分,倒数第二层采用了一个**全局平均池化层**。经过该层的数据变为512维的张量,最后进入全连接层输出一个8维的结果。该部分经讨论,发现该网络结构是在resnet结构上进行的修改,单应性估计的结构就是采用的resnet的代码。而生成特征图网络和mask预测网络是作者在resnet源码基础上增加的。
160 |
161 |
162 | ```python
163 | self.conv1 = nn.Conv2d(2, 64, kernel_size=7, stride=2, padding=3,
164 | bias=False)
165 | self.bn1 = nn.BatchNorm2d(64)
166 | self.relu = nn.ReLU(inplace=True)
167 | self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
168 | self.layer1 = self._make_layer(block, 64, layers[0])
169 | self.layer2 = self._make_layer(block, 128, layers[1], stride=2)
170 | self.layer3 = self._make_layer(block, 256, layers[2], stride=2)
171 | self.layer4 = self._make_layer(block, 512, layers[3], stride=2)
172 | self.avgpool = nn.AvgPool2d(7, stride=1)
173 | self.fc = nn.Linear(512 * block.expansion, num_classes)
174 | ...
175 | ...
176 | patch_1_res = torch.mul(patch_1, mask_I1)
177 | patch_2_res = torch.mul(patch_2, mask_I2)
178 | x = torch.cat((patch_1_res, patch_2_res), dim=1) #此处为合并两个patch输入单应估计模型
179 |
180 | x = self.conv1(x)
181 | x = self.bn1(x)
182 | x = self.relu(x)
183 | x = self.maxpool(x)
184 |
185 | x = self.layer1(x)
186 | x = self.layer2(x)
187 | x = self.layer3(x)
188 | x = self.layer4(x)
189 |
190 | x = self.avgpool(x)
191 | x = x.view(x.size(0), -1)
192 | x = self.fc(x)
193 |
194 | H_mat = DLT_solve(h4p, x).squeeze(1)
195 |
196 |
197 | ```
198 |
199 |
200 | #### 3.4 Triplet Loss函数
201 | 网络在构建loss函数的时候采用了TripletMarginLoss来构建损失函数。
202 |
203 |
204 |
205 |

206 |
207 |
208 |
209 | 损失函数的形式化表达为:
210 |
211 | $$L_n({I_a}\',{I_b})=\frac{\sum_{i}{M_a}\'{M_b}\cdot \Vert {F_a}\'-F_b \Vert_1}{\sum_{i}{M_a}\'M_b}$$
212 |
213 | $$L(I_a,I_b)=\Vert F_a-F_b \Vert_1$$
214 |
215 | $$\displaystyle \min_{m,f,h}L_n({I_a}\', I_b)+L_n({I_b}\',I_a)-\lambda L(I_a,I_b)+\mu \Vert H_{ab}H_{ba}-I \Vert_2^2$$
216 |
217 |
218 | 我们根据源码来分析它损失函数的写法:
219 |
220 | ```python
221 | pred_I2 = transform(patch_size_h, patch_size_w, M_tile_inv, H_mat, M_tile,
222 | org_imges[:, :1, ...], patch_indices, batch_indices_tensor) #利用预测出的H_mat对原图I1进行变形转到I2的图像坐标系下并取patch位置
223 | pred_Mask = transform(patch_size_h, patch_size_w, M_tile_inv, H_mat, M_tile,
224 | mask_I1_full, patch_indices, batch_indices_tensor) #同样对I1的mask进行变形并取patch位置得到pred_Mask,等同于公式中的Ma'
225 |
226 | pred_Mask = normMask(pred_Mask) #归一化
227 |
228 | mask_ap = torch.mul(mask_I2, pred_Mask) #I2上取的patch大小的mask_I2和pred_Mask做矩阵点乘,等同于公式中Ma'Mb
229 |
230 | sum_value = torch.sum(mask_ap) #累和,Ln的分母
231 | pred_I2_CnnFeature = self.ShareFeature(pred_I2) #等同于对变形后的I1的patch求取特征图得到公式里的Fa'
232 |
233 | feature_loss_mat = triplet_loss(patch_2, pred_I2_CnnFeature, patch_1) #TripletLoss的就是为了
234 |
235 | feature_loss = torch.sum(torch.mul(feature_loss_mat, mask_ap)) / sum_value
236 | feature_loss = torch.unsqueeze(feature_loss, 0)
237 | ```
238 |
239 |
240 |
241 | ## 4. 实验结果
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 | #### 结论
251 |
252 |
253 |
254 |
255 |
256 | ## 5.复现实验
257 | ### 合成数据集过程
258 |
259 |
260 |
--------------------------------------------------------------------------------
/doc/DeepHomographyEstimation.md:
--------------------------------------------------------------------------------
1 | # Deep Image Homography Estimation
2 | ###### 本篇论文是基于监督学习的神经网络,网络以两幅合成的patch作为输入(两者间存在已知的单应变换关系H),预测输出对应H的8个参数(四个顶点的偏移量)。因为数据集是手工合成的,因而该网络的ground truth也是已知的,所以该思路是在监督下训练神经网络。
3 |
4 |
5 | > - 论文来源:[DeTone, D., Malisiewicz, T., & Rabinovich, A. (2016). Deep image homography estimation.(pdf)](https://arxiv.org/pdf/1606.03798)
6 | > - 数据集:合成数据集MSCOCO2014/2017
7 | > - 参考主页(源码未开源):
8 | >> 1. [alexhagiopol](https://github.com/alexhagiopol/deep_homography_estimation)
9 | >> 2. [mazenmel](https://github.com/mazenmel/Deep-homography-estimation-Pytorch)
10 | >> 3. [**mez**](https://github.com/mez/deep_homography_estimation)(包含数据集预处理可视化全过程的ipynb文件)
11 |
12 |
13 |
14 |
15 | ## 1. 主要思路
16 | 本文希望通过输入两幅大小一致的图像由网络学习得到**8个参数**,对应两幅图像之间存在的单应关系(矩阵H为8DoF)。
17 | #### 矩阵H形式化
18 | 单应性矩阵的表达$H_{4point}$转化为对第一幅图像四个顶点坐标的8个维度($x_i$, $y_i$, $i$=1, 2, … 8 )的偏移$H_{4point}$。
19 | #### 4-points形式化的好处
20 | 相比较3x3的参数化形式,由于H中混合了旋转成分、平移成分、尺度成分和错切成分。平移分量比旋转和错切分量在数值上变换更大。当计算矩阵误差时,两者对矩阵值的影响都很大,但旋转分量的差值对L2损失函数所造成的**影响比重**比平移向量小。
21 |
22 |
23 |

24 |
25 |
26 |
27 |
28 | ## 2. 合成数据集
29 | > - 来源:[MSCOCO](https://cocodataset.org/#download) 2014 train/val/testing
30 | > - 合成方法:
31 | >> 1. 对于MSCOCO数据集的图像,选定一个**随机的位置点p**
32 | >> 2. 以p为patch的左上角顶点,确定长宽均为128的**patchA**
33 | >> 3. 对patchA的四个顶点做x,y轴上随机的摆动,得到4-points长度为**8维的偏移量**
34 | >> 4. 四个顶点变换前的坐标到变换后的坐标存在一个单应变换矩阵HAB,将原图像乘上HBA(逆矩阵)得到warped图像
35 | >> 5. 在warped图像上同一位置p上取一个128x128大小的patch名为**patchB**
36 |
37 |
38 |
39 |
40 |

41 |
42 |
43 | ### 合成数据集代码示例
44 | > 该代码来自mazenmel主页的[DataGeneration文件](https://github.com/mazenmel/Deep-homography-estimation-Pytorch/blob/master/DataGenerationAndProcessing.py)
45 | >
详细的可视化过程见mez主页的[data_generation文件](https://github.com/mez/deep_homography_estimation/blob/master/Dataset_Generation_Visualization.ipynb)
46 | ```python
47 | img = cv2.imread(path+'/%s'%image,0)
48 | img = cv2.resize(img,(320,240))
49 | ```
50 | 在此处将COCO数据集内的图像均resize为宽为320,高为240的图像。
51 | ```python
52 | rho = 32
53 | patch_size = 128
54 | top_point = (32,32)
55 | left_point = (patch_size+32, 32)
56 | bottom_point = (patch_size+32, patch_size+32)
57 | right_point = (32, patch_size+32)
58 | test_image = img.copy()
59 | four_points = [top_point, left_point, bottom_point, right_point]
60 | ```
61 | 此处固定了左上角p位置的坐标为(32,32),patch的大小为128\*128,则可以确定patchA四个顶点的坐标four_points。位置p的坐标实际应当也取一个范围内的随机值,这里简化为固定点。
62 | ```python
63 | perturbed_four_points = []
64 | for point in four_points:
65 | perturbed_four_points.append((point[0] + random.randint(-rho,rho), point[1]+random.randint(-rho,rho)))
66 | ```
67 | perturbed_four_points作为四个点偏移后坐标的集合,rho是四个点在xy方向上偏移的最大量,因此此处取了(-rho,rho)之间的随机整数。
68 | ```python
69 | H = cv2.getPerspectiveTransform( np.float32(four_points), np.float32(perturbed_four_points) )
70 | H_inverse = inv(H)
71 |
72 | warped_image = cv2.warpPerspective(img,H_inverse, (320,240))
73 | ```
74 | patchA到patchB之间的单应矩阵由opencv的函数计算为H,对**原图**乘上H的逆矩阵,得到warped图像。
75 | ```python
76 | Ip1 = test_image[top_point[1]:bottom_point[1],top_point[0]:bottom_point[0]]
77 | Ip2 = warped_image[top_point[1]:bottom_point[1],top_point[0]:bottom_point[0]]
78 |
79 | training_image = np.dstack((Ip1, Ip2))
80 | H_four_points = np.subtract(np.array(perturbed_four_points), np.array(four_points))
81 | datum = (training_image, H_four_points)
82 |
83 | return datum
84 | ```
85 | 对**原图**和**warped图像**都在同一位置p上截取一个128\*128大小的patch(Ip1,Ip2),该生成函数返回的值就是由**Ip1、Ip2深度堆叠**和**4-points偏移量**的元组。
86 | ```python
87 | def savedata(path):
88 | lst = os.listdir(path+'/')
89 | os.makedirs(path+'processed/')
90 | new_path = path+'processed/'
91 | for i in lst:
92 | np.save(new_path+'%s'%i[0:12],ImagePreProcessing(i,path))
93 |
94 | savedata(train_path)
95 | savedata(validation_path)
96 | savedata(test_path)
97 | ```
98 | 最初的COCO训练集的图片集合存储在train2014文件夹里,处理后的数据将以.npy文件格式存储在train2014processed文件夹里
99 |
100 |
101 |
102 | ## 3. 网络结构
103 |
104 |
105 |

106 |
107 |
108 |
109 |
110 | - 8个卷积层和2个全连接层
111 | - 每两个卷积层后接一个最大池化层
112 | - 在Conv8和第一个全连接层后都有一个概率为0.5的dropout层
113 |
114 | ```python
115 | class Model(nn.Module):
116 | def __init__(self):
117 | super(Model,self).__init__()
118 | self.layer1 = nn.Sequential(nn.Conv2d(2,64,3,padding=1),
119 | nn.BatchNorm2d(64),
120 | nn.ReLU())
121 |
122 | self.layer2 = nn.Sequential(nn.Conv2d(64,64,3,padding=1),
123 | nn.BatchNorm2d(64),
124 | nn.ReLU(),
125 | nn.MaxPool2d(2))
126 | self.layer3 = nn.Sequential(nn.Conv2d(64,64,3,padding=1),
127 | nn.BatchNorm2d(64),
128 | nn.ReLU())
129 | self.layer4 = nn.Sequential(nn.Conv2d(64,64,3,padding=1),
130 | nn.BatchNorm2d(64),
131 | nn.ReLU(),
132 | nn.MaxPool2d(2))
133 | self.layer5 = nn.Sequential(nn.Conv2d(64,128,3,padding=1),
134 | nn.BatchNorm2d(128),
135 | nn.ReLU())
136 | self.layer6 = nn.Sequential(nn.Conv2d(128,128,3,padding=1),
137 | nn.BatchNorm2d(128),
138 | nn.ReLU(),
139 | nn.MaxPool2d(2))
140 | self.layer7 = nn.Sequential(nn.Conv2d(128,128,3,padding=1),
141 | nn.BatchNorm2d(128),
142 | nn.ReLU())
143 | self.layer8 = nn.Sequential(nn.Conv2d(128,128,3,padding=1),
144 | nn.BatchNorm2d(128),
145 | nn.ReLU())
146 | self.fc1 = nn.Linear(128*16*16,1024)
147 | self.fc2 = nn.Linear(1024,8)
148 | ```
149 |
150 |
151 |
152 | ## 4. 实验结果
153 | 实验分为两个网络——回归网络和分类网络。
154 |
155 | - 回归网络的输出为8维张量,直接对应4-points的8个偏移量。GT是8个偏移量
156 | - 分类网络的输出是8\*21大小的张量,每个21维的向量表示在该坐标值在取值范围\[10,-10]的概率。GT由正确的偏移量确定,eg:某点x坐标的偏移为-3,则21维向量里代表-3的那一位概率为1,其余都为0。
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 | #### 结论
170 | 1. 度量的指标是8个偏移量的误差的均值
171 | 2. 回归模型比分类模型的结果更好
172 |
173 |
174 |
175 |
176 | ## 5.复现实验
177 | ### 合成数据集过程
178 | leeing:由于MSCOCO2014训练集的图像数量有82783幅图像,在生成.npy图像的过程中时间消耗巨大,据估计花费2-3h。
179 | 根据单个epoch的时间消耗,整个训练完成下来需要花费近10天,因此中止了训练过程,下一步调整数据集的图像数量。
180 |
181 | 待补充...
182 |
--------------------------------------------------------------------------------
/doc/DeepMeshFlow.md:
--------------------------------------------------------------------------------
1 | # DeepMeshFlow: Content Adaptive Mesh Deformation for Robust Image Registration
2 |
3 | 本文在content-aware网络的基础上提出基于内容自适应的deep meshflow估计网络,该网络生成几类特定大小的mesh flow,再通过融合掩码得到最终结果。该方法将deep homography对低纹理区域具有鲁棒性的优点和meshflow可以描述非线性运动的特点。
4 |
5 |
6 |
7 | > - 论文来源:[DeepMeshFlow: Content Adaptive Mesh Deformation for Robust Image Registration](https://arxiv.org/pdf/1912.05131.pdf)
8 | > - 数据集:合成数据集MSCOCO2014/2017、视频数据集Content-Aware-DeepH-Data
9 | > - 代码:(暂无源码)
10 |
11 |
12 |
13 | ## 网络结构
14 |
15 | 本文网络结构的前半部分与content-aware的网络结构相同,此处不赘述。
16 |
17 |
18 |

19 |
20 |
21 |
22 | - $f(\cdot)$:特征提取网络,全由卷积层构成,输出特征图$F_a、F_b$。
23 | $$
24 | F_a={\cal f}(I_a), F_b={\cal f}(I_b)
25 | $$
26 |
27 | - $m(\cdot)$:掩码预测网络,全由卷积层构成,输出掩码$M_a、M_b$。通过对掩码进行归一化处理并且加大权重后可以达到**突出特征图中重要内容**的效果,该效果**类似传统算法中的RANSAC**。
28 |
29 | $$ M_a=m(I_a), G_a=F_aM_a $$
30 | $$ M_b=m(I_b), G_b=F_bM_b $$
31 |
32 | - $h(\cdot)$:meshflow回归网络,backbone为ResNet-34,输出K个mesh flow。
33 | $$
34 | \{ M_k\} =h(G_a,G_b), k=1,2,...,k
35 | $$
36 |
37 | - $s(\cdot)$:场景分割网络,该网络将图像$I_a、I_b$堆叠后分割为K类,分别对应上述的K个分支,输出尺寸为$(H_g+1)\times (W_g+1)\times K$
38 |
39 | $$
40 | S=s(I_a,I_b)
41 | $$
42 |
43 | - K Branches:ResNet-34后接K个分支,每个分支由自适应池化层开始,经过卷积层生成特定大小的mesh flow。
44 | $$
45 | M_1^{'}\rightarrow ({H_g\over 16}+1)\times({W_g\over 16}+1)\times 2=2\times 2\times 2 \\
46 | M_2^{'}\rightarrow ({H_g\over 4}+1)\times({W_g\over 4}+1)\times 2=5\times 5\times 2 \\
47 | M_3\rightarrow ({H_g}+1)\times({W_g}+1)\times 2=17\times 17\times 2
48 | $$
49 | 之后将粗尺度$M_1^{'}、M_2^{'}$上采样到$M_3$分辨率,并且依靠场景分割网络$S$加以融合,得到最终结果$M^* $。
50 |
51 | $$
52 | M^{* }(u,v) = M_{\hat k}(u,v) \hat{k}=argmax_kS(u,v,k)
53 | $$
54 | 即按照掩码中的最大值选择mesh flow中的对应值。
55 |
56 | ## 损失函数
57 |
58 | 本文的损失函数与content-aware中的相同
59 |
60 | - 如果估计的单应性矩阵$\cal H_{ab}$足够正确,则经过变换后的特征图$F_a^{'}$和目标特征图$F_b^{'}$对齐效果会很好,故$l_1 loss$也很低。考虑到真实场景中单个单应性矩阵不能满足两个视图之间的转换,本文使用了$M_a^{'}、M_b$对$l_1loss$进行了归一化:
61 |
62 | $$
63 | L_n(I_a^{'},I_b)={\sum_i M_a^{'}M_b\cdot |F_a^{'}-F_b|\over {\sum_i M_a^{'}M_b}}
64 | $$
65 |
66 | - 当特征图是全零的时候使用上述式子会比较片面,因为这只证明$I_a^{'}、I_b$对齐效果好,但无法证明原图$I_a、I_b$未对齐,故需要最小化另一个损失:
67 | $$
68 | L(I_a,I_b)=|F_a-F_b|
69 | $$
70 |
71 | - 同时作者将图像交换求解$M^{* , r}$,并且相应地计算损失$L_n(I_b^{'},I_a)$。在这基础上增加损失确保$M^{* }、M^{* ,r}$互为逆矩阵,增加超参数$\lambda、\mu$后最终损失为:
72 | $$
73 | min_{m,f,h}L_n(I_a^{'},I_b)+L_n(I_b^{'},I_a)-\lambda L(I_a,I_b)+\mu \sum_{(u,v)}|\cal H_{ab}(u,v)H_{ba}(u,v)-I|
74 | $$
75 |
76 |
77 | ## 实验结果
78 |
79 |
80 |
81 | - 本文与content-aware创新点主要在mask的使用,它可以消除对齐时不可分辨或者具有误导性的区域,比如低纹理或者运动物体。
82 |
83 |
84 |

85 |
86 |
87 | - 对比实验中使用$l2$距离来衡量拼接质量的好坏,结果表示本文的方法相比之前的方法达到最优,同时对比了各个尺寸的mesh的效果,本文的自适应尺寸mesh效果最优
88 |
89 |
90 |

91 |
92 |
93 |
94 |

95 |
96 |
97 |
98 |

99 |
100 |
101 |
102 | ## 结论
103 |
104 | - 本文在content-aware的基础上预测meshflow,同时提出了一种自适应的多尺度meshflow的计算方式。该方法在解决视差有较好效果。
105 |
106 |
--------------------------------------------------------------------------------
/doc/Depth-aware.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/Learning_Edge-Preserved_Image_Stitching_from_Large-Baseline_Deep_Homography.md:
--------------------------------------------------------------------------------
1 | # Learning Edge-Preserved Image Stitching from Large-Baseline Deep Homography
2 |
3 | ***
4 | 本文提出了一个监督图像拼接学习框架由Large-Baseline Deep Homography与edge preserved deformation两个模块组成。分别实现deep homography estimation和deep image stitching的效果。该网络可以接受任意尺度的图像,即使在合成数据集中进行训练,在真实图像中也有良好的泛化能力
5 |
6 |
7 |
8 |
9 |
10 | > - 论文来源:[Learning Edge-Preserved Image Stitching from Large-Baseline Deep Homography](https://arxiv.org/pdf/2012.06194.pdf)
11 | > - 数据集:Stitiched MS-COCO
12 | > - 代码:(源码暂未开源)
13 |
14 |
15 |
16 | ## 1.Large-Baseline Deep Homography
17 | 在大基线场景当中,图像间的重合率很低,CNN的感受野明显受阻。针对此问题本文设计了**large-baseline deep homography network**,该网络将**feature pyramid**与**feature correlation**关联结合,提高了特征映射的利用率,同时拓展了模型的感受野。
18 |
19 |
20 |
21 |

22 |
23 |
24 |
25 | ### A. Feature Pyramid
26 |
27 | 网络整体结构类似FPN网络,经过8个卷积核层与3个池化层分别得到尺寸为$\frac{1}{2}$、$\frac{1}{4}$、$\frac{1}{8}$的三层特征金字塔。每层特征金字塔都用来估计单应性。该方法**在特征级上由粗到精地估计单应性**。
28 |
29 | ### B. **Feature Correlation**
30 |
31 | 参考特征图$F_A$和目标特征图$F_B$尺寸均为$W\times H\times C$,可视为由$W \times H$个维度为$C$的特征向量组成。可用余弦相似度计算两个图上任意两点间的相关性:
32 | $$
33 | c(x_A,x_B)={ \over|F_A(x_A)||F_B(x_B)|}
34 | $$
35 | 其中$x_A$、$x_B$分别表示特征图$F_A$、$F_B$上的空间位置。假设搜索半径为$R$,最终可以得到$W\times H\times (2R+1)^2$的feature correlation图。假设$W=H$,当$R=W$时该步骤称为Global Correlation,当$R
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 每次由高层计算得到的单应性矩阵,将下一层目标特征图进行warp变换后继续与和其同层的参考特征图计算**残差**的八坐标偏移。每次计算Solving DLT的时候需要的是总偏移量,所以需要加上剩余的偏移量。
48 |
49 | 综上所述可得到最终表达式:
50 |
51 |
52 |
53 |
&space;\right>&space;\right\})
54 |
55 |
56 | 由于特征金字塔为三层,最终预测的偏移量表达为:
57 |
58 | $$
59 | \Delta_{w\times h}=\Delta_1+\Delta_2+\Delta_3
60 | $$
61 |
62 | ### C. Objective Function
63 |
64 | 该网络以监督方式训练,损失函数为:
65 | $$
66 | {\cal L_H}=w_1(\hat{\Delta_{w\times h}}-\Delta_1)+w_2(\hat{\Delta_{w\times h}}-\Delta_1-\Delta_2)+w_3(\hat{\Delta_{w\times h}}-\Delta_1-\Delta_2-\Delta_3)
67 | $$
68 |
69 | ## **Edge-Preserved Deformation Network**
70 |
71 | 全局单应性图像拼接容易产生伪影,本文设计了edge-preserved deformation network来学习从边缘到内容的图像拼接规则。该网络采用encoder-decoder模式,以边缘不连续性为代价消除伪影,以边缘保留策略学习纠正不连续性。
72 |
73 |
74 |

75 |
76 |
77 |
78 | ### A. Edge Deformation Branch
79 |
80 | 边缘仅包含图像中对象的轮廓,保留边缘进行拼接效率更高。边缘提取方式:
81 | $$
82 | E_{i,j}=|G_{i,j}-G_{i-1,j}|+|G_{i,j}-G_{i,j-1}|
83 | $$
84 | 该分支卷积核为64, 64, 128, 128, 256, 256, 512, 512, 256, 256, 128, 128, 64, 64, 1,每两个卷积层后接上一个最大池化层与或者一个反卷积层。为了避免梯度消失与信息不平衡等问题,使用skip connection(shortcut connection)连接encoder与decoder同尺度的层。
85 |
86 | ### B. Image Deformation Branch
87 |
88 | 该分支在缝合边的引导下生成缝合图像。为了实现边缘保持图像拼接,在decoder阶段使用edge deformation branch学习的边缘特征来引导学习。最后使用fusion block将两个分支的最后的特征图融合起来。
89 |
90 |
91 |

92 |
93 |
94 |
95 | ### C. Objective Function
96 |
97 | 网络损失函数分为边缘损失与内容损失
98 | $$
99 | L_{edge}={1 \over W\times H\times 1}||\hat{E}-E||_1
100 | $$
101 |
102 | $$
103 | L_{content}={1\over {W_j\times H_j\times C_j}}||\Phi_j(\hat{I})-\Phi_j(I)||_2
104 | $$
105 |
106 | $$
107 | L=\lambda_eL_{edge}+\lambda_cL_{content}
108 | $$
109 |
110 | $\hat E$由grond truth$\hat{I}$经过边缘提取后得到的边缘图像,$W、H$表示拼接图像的宽与高,$\Phi_j$表示VGG19第$j$层的结果,$W_j、H_j、C_j$表示第$j$层特征图的宽、高、通道数。内存损失的设计有利于image deformation branch生成感知自然的拼接图像。
111 |
112 | ## Size-Free Stitching
113 |
114 |
115 |

116 |
117 |
118 |
119 |
120 | 该网络可以处理任何尺寸大小的图像:
121 |
122 | 1. 将$W \times H$尺寸大小的输入图像调整为$w\times h$,并且记录尺度因子$\sigma_w、\sigma_h$。
123 | 2. 将$w\times h$尺寸大小图像投入网络并且评估偏移量。
124 | 3. 根据尺度因子调整偏移量大小。
125 |
126 | 输入图像尺度的增加会很大程度上增加计算机的负担,以global correlation为例,尺度变化$\lambda$倍会导致运算量变化$\lambda^4$倍:
127 | $$
128 | W\times H\times (2W+1)^2\Rightarrow \lambda W\times \lambda H\times (2\lambda W+1)^2
129 | $$
130 |
131 | ## Experiment
132 |
133 | 在四顶点增加随机perturbation$[-\rho,\rho]$与随机translation$[-\tau,\tau]$获得大基线、低重合度的图像,格式为$(I_{Reference},I_{Target},\Delta,Label)$。
134 |
135 | 论文数据集中图像尺寸$W\times H$;patches尺寸${W\over {2.4}}\times {H\over {2.4}}$;$Max_{perturbation}$为$0.5P^W\times 0.5P^H$;$Max_{translation}为$$0.2P^W\times 0.2P^H$;投入网络图像尺寸$w\times h$为$128\times 128$;
136 |
137 | ***对比实验结果***
138 |
139 |
140 |

141 |
142 |
143 |
144 |
145 | ***特征金字塔消融实验结果***
146 |
147 |
148 |

149 |
150 |
151 |
152 |
153 | ***Edge Deformation Branch消融实验结果***
154 |
155 |
156 |
157 |
158 |

159 |
160 |
161 |
162 | ## Conclusion
163 |
164 | * 提出了**large-baseline deep homography network**来实现单应估计与图像配准;**edge-preserved deformation**模块学习图像拼接的变形规则;采用方案使得该网络可以接受**任意尺度**的图像。
165 | * 该网络仅在合成数据集中训练得到的模型在真实图像中也有较好效果。
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
--------------------------------------------------------------------------------
/doc/Real_Time_Image_Stitching.md:
--------------------------------------------------------------------------------
1 | # Real-Time Image Stitching with Convolutional Neural Networks
2 | ## 主要创新点
3 | **针对深度学习在图像拼接领域缺少真实标签数据集的情况,提出了一种获取真实标签(真实拼接图像)的方法,同时采用GAN(对抗生成网络)进行后处理,消除重影。**
4 | > 1. 提出监督学习数据集的生成方法——利用平面镜使得照相机的光心可以调节。
5 | > 2. 提出PanoGAN网络来消除重影——最后用PSNR指标来衡量去重影的效果。
6 |
7 | ## 主要步骤
8 | ### 数据准备(数据集没公开)
9 | 本文主要基于如下两个假设(观察)来制作数据集:
10 | 1. 相机的光轴会相交,并且交点与两个相机的光心距离不远。
11 | 2. 沿着光轴移动一点距离对拍摄内容几乎没有影响。
12 |
13 | 
14 |
15 | 为了获取图像的方便,本文使用平面镜构建了一个拍摄系统:
16 |
17 | 
18 |
19 | - 平面镜与水平面成45°,这样当两个相机的光心放在锥体顶点所在的水平面且距离顶点的距离一样时,通过平面镜的反射,虚拟光心会重合。
20 | - 当需要拍摄无有视差的图像时,只需要将相机往上移动即可。
21 |
22 | 
23 |
24 | ### PanoGAN去除重影
25 | 
26 |
27 | **Input**
28 | 输入的是7通道图像,两幅warp后的RGB图像+代表重叠区域*binary mask*
29 |
30 | **Generator**
31 | *down sampling + residual block + up sampling*
32 |
33 | **Discriminator**
34 | 采用SRGAN中提出的Discriminator
35 |
36 | **PS**
37 | GAN网络需要在后续进一步了解
38 | ### Loss function
39 | **Percepture loss**
40 | 采用SRGAN中的loss function
41 | $$
42 | \min_G=l_{VGG}+\lambda*l_{Adv}
43 | $$
44 |
45 | $$
46 | l_{VGG}=\frac{1}{whc}\sum_{x=0}^{w-1}\sum_{y=0}^{h-1}\sum_{z=0}^{c-1}(\phi(I^{GT})_{x,y,z}-\phi(G(I^{In}))_{x,y,z})^2
47 | $$
48 |
49 | $$
50 | l_{Adv}=\frac{1}{2}E[(D(G(I^{In}))- 1)^2]
51 | $$
52 |
53 | **Dicriminator loss**
54 | $$
55 | \min_D=\frac{1}{2}E[(D(I^{GT}) - 1)^2]+\frac{1}{2}E[(D(I^{In}) - 0)^2]
56 | $$
57 | **pre_train generator loss**
58 | 这是预训练generator时使用的MSE loss
59 | $$
60 | l_{MSE}=\frac{1}{whc}\sum_{x=0}^{w-1}\sum_{y=0}^{h-1}\sum_{z=0}^{c-1}(I^{GT}_{x,y,z}-G(I^{In}_{x,y,z}))^2
61 | $$
62 | ### 评价指标
63 | **PSNR(Peak Signal to Noise Ratio)**
64 | 用来评价输出的结果与GT之间的误差:
65 | $$
66 | MSE=\frac{1}{whc}\sum_{x=0}^{w-1}\sum_{y=0}^{h-1}\sum_{z=0}^{c-1}(I(x,y,z)-GT(x,y,z))^2
67 | $$
68 | ## 总结
69 | 1. 这篇文章的可取之处是得到了一个真实的拼接数据集,但居然没有公开!!!!!
70 | 2. 文章说实话有点扯……不少细节没说清楚,建议不用看了,只要知道他如何构建数据库就行。
71 |
--------------------------------------------------------------------------------
/doc/Unsupervised_deephomo.md:
--------------------------------------------------------------------------------
1 | # Unsupervised Deep Homography: A Fast and Robust Homography Estimation Model
2 | ###### 本篇论文提出一个基于非监督学习单应矩阵的神经网络,是在Daniel D.T.等人发表的Deep Homography Estimation论文上的一个改进方案。Daniel的网络在合成数据集上虽然能呈现较好的结果,但在真实数据集上仍然存在较大的误差。本文通过重新定义损失函数,将4-points的差值转化为图像像素级的差值来实现反向传播。论文中提出利用Spatial Transform Layer实现图像的变形。
3 |
4 |
5 | > - 论文来源:[Nguyen, T., Chen, S. W., Shivakumar, S. S., Taylor, C. J., & Kumar, V. (2018). Unsupervised deep homography: A fast and robust homography estimation model. IEEE Robotics and Automation Letters, 3(3), 2346-2353..(pdf)](https://arxiv.org/pdf/1709.03966)
6 | > - 数据集:1. 合成数据集MSCOCO2014/2017 2. 真实数据集(未开源)
7 | > - 参考主页:[tynguyen](https://github.com/tynguyen/unsupervisedDeepHomographyRAL2018)(基于tensorflow的项目源码)
8 |
9 |
10 |
11 |
12 |
13 | ## 1. 主要思路
14 | 本文利用Daniel监督学习的回归模型学习出四个点的偏移量(8维tensor),因为要根据这个输出得到两幅patch($P_A$, $P_B$)之间的单应矩阵$\tilde{H}$,所以需要增加一个新的输入,也就是patchA四个顶点的初始值。
15 |
16 | #### 单应矩阵DLT求解
17 | 下图中红色方框中就是本文网络框架中新增的输入:**patchA四个顶点的初始坐标$C_{4pt}^{A}$**,和**图A原图$I_A$**(非patch)。初始坐标加上预测出的8个偏移量,可以得到patchB的四个顶点坐标,四个顶点对应四个顶点,通过DLT求解之间存在的单应变换矩阵。
18 |
19 |
20 |
21 |
22 | > 见下图标出的两个输入tensor DLT的箭头,分别就是patchA的四个坐标和patchB的四个坐标,输入进DLT模块。
23 |
24 |
25 |
26 |

27 |
28 |
29 |
30 |
31 | #### Photometric Loss函数
32 | 与Deep Homography Estimation论文中loss函数的构造方式不同,Daniel论文利用8个参数的GT和预测值之间的**欧式距离**作为loss———本篇论文则是利用预测的8个值按照DLT方法求解单应矩阵,单应矩阵对图像进行变形,loss函数是由参考图像和变形后图像像素的**L1范式距离**决定的。
33 |
34 |
35 | > 如下图所示,从DLT中计算得到的单应矩阵$\tilde{H}$,和patchA的原图$I_A$一齐输入到Spatial Transform模块内,该模块是以采样的形式来实现图像的变形的(我们在理解该概念时查阅了Spatial Transform Layer/Network等相关资料),本文中也详细介绍了STL的实现原理。
36 |
37 |
38 |
39 |

40 |
41 |
42 |
43 | 在Spatial Tranform阶段,之前项目中采用的OpenCV的warpPerspective自然不能使用,这时以下图图例的方式来帮助理解。
44 | > 1. 首先,构建一个和原图B$I_B$一样大的图$V$,图示$V$网格上的每一点$({u_i}\', {v_i}\')$就是对应$I_B$的每个像素点$({u_i}\', {v_i}\')$。图$V$实际就是由矩阵和A转换过来的图像。
45 | > 2. 图$V$上每个像素的点实际是**从$I_A$中采样**出来的。由于之前在DLT阶段由$P_A$和$P_B$得到了图像$I_A$到$I_B$的矩阵$\tilde{H}$,可以计算出$I_B$到$I_A$的矩阵$\tilde{H}\_{inv}$。
46 | > 3. 根根据矩阵$\tilde{H}\_{inv}$可以将$V$中的像素(假设坐标为$({u_i}\', {v_i}\')$)映射到$I_A$中的坐标$(u,v)$上,即图$V$中每个像素的值就完全是取自$I_A$。
47 | > 4. 由于坐标$(u,v)$可能出现浮点型数据,而图像是离散型变量,因此需要根据$(u,v)$周围的**4个像素**进行**双线性差值**。利用图中的公式:
48 | > $$ V_{i}^{C}=\sum_{n}^{H}\sum_{m}^{W}I_{mn}^{c}max(0,1-\left|u_i-m \right|)max(0,1-\left|v_i-n \right|) $$
49 | > 5. 最后得到的$V$是利用预测值$\tilde{H}\_{inv}$采样得到的图像,它和$I_B$同时取patchB位置的图像,loss函数则是计算$P_B$和$\tilde{P}\_B$的**L1范式距离**。
50 |
51 |
52 |
53 |

54 |
55 |
56 |
57 | ## 2. 数据集
58 | 本文依旧采用了Deep Homography Estimation中提出合成数据集来训练网络,除此之外为了增加网络对真实环境的适应性,本文还引入了作者团队拍摄的航空图像(未开源)
59 |
60 | ### 合成数据集
61 | > 生成合成数据集的源码文件[gen_synthetic_data.py](https://github.com/tynguyen/unsupervisedDeepHomographyRAL2018/blob/master/code/utils/gen_synthetic_data.py)
62 |
63 | 该网络新增了几个输入,合成数据集构建时除了存储patchA、patchB和GT之外还需要存储原图$I_A$以及$I_B$。在以下源码中,作者存储$P_A$的四个点的坐标(f_pts1),两幅图像之间的单应矩阵(f_gt),两个图像原图的文件名(f_file_list)。
64 |
65 |
66 |
67 |
68 | ```python
69 | # Text files to store homography parameters (4 corners)
70 | if args.mode=='train' and not args.debug:
71 | f_pts1 = open(args.pts1_file, 'ab')
72 | f_gt = open(args.gt_file, 'ab')
73 | f_file_list = open(args.filenames_file, 'ab')
74 | ...
75 | ...
76 | np.savetxt(f_gt, [gt], delimiter= ' ')
77 | np.savetxt(f_pts1, [pts1], delimiter= ' ')
78 | f_file_list.write('%s %s\n'%(str(index) +'.jpg', str(index) +'.jpg') )
79 | ```
80 |
81 |
82 |
83 | 合成数据集因为只有单张图像,看论文的时候觉得$I_B$的指向性不明确。在查阅源码后,发现合成数据集的$I_B$实际上是对$I_A$进行$H_{inv}$矩阵透视变换后的图像,见下方代码。
84 |
85 |
86 | ```python
87 | # compute Homography
88 | H = cv2.getPerspectiveTransform(np.float32(four_points), np.float32(perturbed_four_points))
89 | try:
90 | H_inverse = inv(H)
91 | except:
92 | print "singular Error!"
93 | return index, 0
94 | ...
95 | ...
96 | inv_warped_image = numpy_transformer(gray_image, H_inverse, (width, height))
97 | ...
98 | ...
99 | # Save synthetic data
100 | large_img_path = os.path.join(args.I_dir, str(index) + '.jpg')
101 |
102 | if args.mode == 'train' and args.color==False:
103 | cv2.imwrite(large_img_path, gray_image)
104 | ...
105 | ...
106 | if args.I_prime_dir is not None:
107 | img_prime_path = os.path.join(args.I_prime_dir, str(index) + '.jpg')
108 | if args.mode == 'train' and args.color==False:
109 | cv2.imwrite(img_prime_path, inv_warped_image)
110 |
111 | ```
112 |
113 |
114 | gray_image和inv_warped_image在这里就分别代表$I_A$和$I_B$。
115 |
116 |
117 |
118 | ### 无人机拍摄的真实数据集(未开源)
119 | 待补充...
120 |
121 |
122 |
123 | ## 3. 网络结构
124 | 本文的网络结构在回归四个顶点偏移量的时候借用了Deep image Homography Estimation的回归网络模型,后续的模块在计算损失函数的时候借用了Spatial Transform Layer的方案。
125 |
126 |

127 |
128 |
129 |
130 |
131 | 详见项目源码,utils文件夹内包含生成合成数据集和真实场景数据集的代码、图像空间变换的功能函数。code文件夹内homography_CNN_\*是深度神经网络方法在两个数据集上的训练代码。homography_Conventional_\*是传统方法代码。homography_model是本文网络结构源码,具体结构与监督方法的回归网络模型基本一致,如下(文件line88-133):
132 | ```python
133 | def _vgg(self):
134 | with tf.variable_scope('conv_block1', reuse=self.reuse_variables): # H
135 | conv1 = self._conv_block(self.model_input, ([64, 64]), (3, 3), (1, 1))
136 | maxpool1 = self._maxpool2d(conv1, 2, 2) # H/2
137 | with tf.variable_scope('conv_block2', reuse=self.reuse_variables):
138 | conv2 = self._conv_block(maxpool1, ([64, 64]), (3, 3), (1, 1))
139 | maxpool2 = self._maxpool2d(conv2, 2, 2) # H/4
140 | with tf.variable_scope('conv_block3', reuse=self.reuse_variables):
141 | conv3 = self._conv_block(maxpool2, ([128, 128]), (3, 3), (1, 1))
142 | maxpool3 = self._maxpool2d(conv3, 2, 2) # H/8
143 | with tf.variable_scope('conv_block4', reuse=self.reuse_variables):
144 | conv4 = self._conv_block(maxpool3, ([128, 128]), (3, 3), (1, 1))
145 | # Dropout
146 | keep_prob = 0.5 if self.mode=='train' else 1.0
147 | dropout_conv4 = slim.dropout(conv4, keep_prob)
148 |
149 | # Flatten dropout_conv4
150 | out_conv_flat = slim.flatten(dropout_conv4)
151 |
152 | # Two fully-connected layers
153 | with tf.variable_scope('fc1'):
154 | fc1 = slim.fully_connected(out_conv_flat, 1024, scope='fc1')
155 | dropout_fc1 = slim.dropout(fc1, keep_prob)
156 | with tf.variable_scope('fc2'):
157 | fc2 = slim.fully_connected(dropout_fc1, 8, scope='fc2', activation_fn=None) #BATCH_SIZE x 8
158 |
159 | self.pred_h4p = fc2
160 | ```
161 |
162 |
163 |
164 | ## 4. 实验结果
165 | ### 合成数据集
166 | 测评指标为四个点偏移量的**均方根误差(RMSE)**。重叠率表示的是$P_A$四个顶点有较小的偏移($P_A$和$P_B$的重叠率为85%、75%和65%)。作者将本文的方法和单位矩阵、SIFT、ECC和基于监督的方法进行比较。
167 | - 在三种重叠率下,SIFT在60%的情形下都具有最小的RMSE,**而在40%的情形下,它的误差反而比深度学习的方法差得多**。
168 | - 深度学习的方法在**所有场景下的表现趋于一致**,更适用于多变的真实场景应用。
169 | - 基于特征的方法和深度学习的方法的表现都比ECC好。
170 |
171 |
172 |
173 |

174 |
175 |
176 |
177 |
178 | - - -
179 | ### 真实数据集
180 | 从RMSE评估图标上可见,在团队无人机拍摄的航空数据集上,非监督的结果是最好的。
181 |
182 |

183 |
184 |
185 |
186 | 从可视化实验结果可见,红色的框为gt,黄色的框为预测出(特征匹配)的结果。在左列光照情况变换明显的hard情形下直接匹配失败。而在右侧比较适中的场景下RMSE仍然大于基于深度学习的方案,但是即使是偏移比较大,它的效果远胜于ECC。
187 |
188 |

189 |
190 |
191 |
192 | 最后,对成本消耗进行比较。越靠近左下角,说明该方法效果更好并且消耗时间成本越低。基于学习的方法无论是监督和非监督消耗的时间成本都比SIFT低,但从误差来看,监督的误差>ORB>SIFT>非监督。
193 |
194 |

195 |
196 |
197 |
198 |
199 |
200 | #### 结论
201 | - 非监督的方法在大部分场景下的误差基本一致,普适性更好。但SIFT在60%的误差极小,只在比较极端的情况下出现特别大的误差。
202 | - 文章损失函数的构建方法值得借鉴,特别利用了Spatial Tranform Layer来实现图像变形,这为后续基于深度学习的论文都提供了新的经验。
203 |
204 |
205 |
206 |
207 | ## 5.复现实验
208 | 代码是基于tensorflow实现的,环境已经搭建好,目前还没有训练过。
209 | ### 合成数据集实验
210 | 待补充
211 | ### 真实数据集实验
212 | 航空数据集没有公开目前不能实验。
213 |
214 |
215 |
216 |
--------------------------------------------------------------------------------
/doc/VFISnet.md:
--------------------------------------------------------------------------------
1 | # A view-free image stitching network based on global homography
2 | ## 主要创新点
3 | **在已有的深度学习方法上,本文针对小重叠率的情况进行研究:**
4 | > 1. 改进合成数据集的生成方案——原有的方法只是对四个顶点进行扰动,改进方案则是先对原始的patch做一个平移,以此来获取更小的重叠率。原始方案的重叠率在60%以上,改进方案的重叠率在20%以上。
5 | > 2. 改进单应矩阵的估计方法——采用*global correlation homography estimation*的方法,使用图像的全局相关性操作构建损失函数。
6 | > 3. 在STL的基础上增加了*structure stitching*方法——即将STL得到的映射结果使用*average fuse*的融合方法,得到粗略的拼接效果。
7 | > 4. 在网络中引入*Content revision*去除重影——使用*encoder-deconder*网络去重影。
8 | ## 主要步骤
9 | ### 数据准备
10 | 
11 |
12 | **真实标签为(I_A, I_B, f, Label)**
13 |
14 | - f是在顶点扰动的基础上增加了平移向量:
15 | $$
16 | f^i_x=p^i_x+t_x\\
17 | f^i_y=p^i_y+t_y
18 | $$
19 | - Label是拼接的结果,由图中绿色框和红色框组成,并且最终将结果放到304\*304的canvas中。
20 | ### Step1: Homography estimation stage
21 | 传统单应矩阵估计一般会经过:特征点提取、特征匹配、DLT,最终得到单应性矩阵。已有的深度学习方案都直接使用CNN回归网络得到单应性矩阵。
22 |
23 | 
24 |
25 | 本文模拟传统方法,先使用一个CNN提取图像的特征并计算*global correlation*,再经过卷积+全连接层得到四个偏移量,最后通过DLT求得单应性矩阵*H*。
26 |
27 | **Input**
28 | > 将输入的两幅图像转换成灰度图像
29 |
30 | **Feature Extractor**
31 | > 两幅图像使用同样的权重,每一个模块都是**两层卷积+一层最大池化层**
32 |
33 | **L2 normalization**
34 | > 需看源码
35 |
36 | **global correlation**
37 | > 将得到的两个feature maps $F_A, F_B\in W^l\times H^l\times C^l$进行全局的相关操作,得到$CV^l$
38 | > $$
39 | > CV^l(x_1,x_2)=\frac{}{|F_A^l(x_1)||F_B^l(x_2)|}\quad x_1,x_2\in \mathbb{Z}^2
40 | > $$
41 | - $F_A^l(x_1)$表示在$x_1$处的像素值,每一个像素值是一个维度为$C^l$的向量,这里的<>表示点乘。
42 | - 对feature1中的每一个像素点,计算第二幅图像中所有像素点与该点的correlation值,得到一个$W^l\times H^l$的向量。因此$CV^l$的大小为$W^l\times H^l\times (W^l\times H^l)$。
43 | - $CV^l(x_1,x_2)$的值在0~1之间,这个值越大则表示两个feature在$x_1,x_2$两个位置上越匹配。
44 |
45 | **Regression network**
46 | > 由卷积层+全连接层构成,得到四个顶点的偏移,最后通过DLT解出单应矩阵H。
47 |
48 | ### Step2: Structure stitching stage
49 | 该步骤在STL上多加了一个融合的操作,将STL得到的两幅图像通过average fusion进行融合,得到粗略的拼接效果。
50 |
51 | 
52 |
53 | - 这里的输入不再是灰度图像了,而是原始彩色图像。
54 | - 这里STL的输出图像大小是由H计算得到的canvas大小。
55 | - 当H不同时,即使处理同样两幅图像,最终得到的拼接图像大小都可能不同,为了实现的方便,这里将canvas的大小统一设置为304\*304(输入patch的大小为128\*128),保证所有的structure stitching result和label(拼接的图像的ground truth)一样大。
56 |
57 | ### Step3: Content revision stage
58 | 该步骤的主要作用是去除重影。
59 |
60 | 
61 |
62 | **Input**
63 | > 该步骤的输入是将SSL步骤中的$I_{AW}, I_{BW}$和structure stitching result进行concatenate得到的多通道图像。
64 | - 采用encoder-decoder的结构得到Stitching result。
65 |
66 | ### Step4:Loss fuction
67 | 已有的深度学习方法都是将偏移量作为loss函数考虑的对象,该论文除了将偏移量考虑在内,同时也将图像的拼接结果作为loss函数的一部分。
68 |
69 | **$L_H$**
70 |
71 | 主要考虑图像四个顶点的偏移与ground truth之间的误差:
72 | $$
73 | L_H(\hat{f}, f)=\frac{||\hat{f} - f||_2^2}{N}
74 | $$
75 | N表示偏移由多少个量构成,一般是四个点,八个偏移量。
76 |
77 | **$L_S$**
78 |
79 | 主要考虑拼接效果与ground truth之间的误差:
80 | $$
81 | L_S(\hat{I}, I)=\frac{||\hat{I}-I||_1}{W\times H\times C}
82 | $$
83 | 这里采用的是L_1 Loss。
84 |
85 | **$L_C$**
86 |
87 | 主要考虑拼接结果的feature与ground truth的feature之间的误差
88 | $$
89 | L_C(\hat{I}, I)=\frac{||\phi_j(\hat{I})-\phi_j(I)||_2^2}{W_j\times H_j\times C_j}
90 | $$
91 | $\phi_j(.)$表示VGG_19的第j层结果。
92 | > 这个Loss是最终减少重影的关键
93 |
94 | ## 总结
95 | 1. 在计算全局单应矩阵时,传统方法在特征点少重叠率低的情况下,容易出现无匹配和匹配错误。考虑到CNN强大的特征提取能力,以后应该考虑更多的使用深度学习的方法去计算单应性矩阵。
96 | 2. 本文去重影的方法——Content Revision,可以考虑在以后的拼接中作为后处理来使用。
97 |
--------------------------------------------------------------------------------