MIT License

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

Doppelgangers: Learning to Disambiguate Images of Similar Structures

项目背景与痛点

Doppelgangers 是一个能在复杂视觉场景中区分出结构极其相似的图像的深度学习项目。这类问题在现实世界中并不少见,例如在自动驾驶技术中识别雨滴和路标,或是安防监控中识别人脸和面具。这些问题的核心挑战在于,相似结构的图像在视觉特征上极为接近,传统的图像处理和识别方法很难有效区分。

Doppelgangers 项目通过引入深度学习和图像生成技术,解决了这一难题,为自动驾驶、安保监控等需要高精度视觉识别的应用提供了新的解决方案。它不仅展示了图像识别领域的最新技术进展,而且还为图像处理领域提供了一种新的研究框架。

技术核心揭秘

Doppelgangers 项目的核心技术在于它如何对结构极为相似的图像进行区分。项目采用了深度孪生网络结构(Siamese Network),通过比对两张输入图像之间的特征向量差异来确定它们是否为同一结构。此架构不仅提升了模型在特定任务上的表现,而且能够在相对较短的训练时间内达到较高精度,从而有效解决相似结构图像的识别问题。

深度孪生网络的内部工作流程如下:

graph TD A[原始图像] --> B[特征提取] B --> C{"孪生网络"} C -->|"分支一"| D("孪生网络-1") C -->|"分支二"| E("孪生网络-2") D --> F[特征向量] E --> G[特征向量] F --> H{"特征比较"} G --> H H --> I[相似度输出]
  • 原始图像:输入系统待处理识别的图像。
  • 特征提取:利用深度神经网络提取输入图像的高级特征。
  • 孪生网络:将提取的特征分成两路,分别通过独立但权重相同的孪生网络进行处理,从而得到两个独立的特征向量。
  • 特征比较:通过比较孪生网络分支输出的两个特征向量来计算相似度。
  • 相似度输出:最终确定两图是否属于同一类。

Doppelgangers 使用这种架构能够显著提高识别精度,减少假阳性的情况,是图像识别技术的重要突破。

功能亮点与差异

相比其他同类项目,Doppelgangers 的设计追求的是一种“精细化”的图像识别能力。通过深度孪生网络,项目能够有效处理结构极其相似的图像识别任务,这一特点是大多数通用图像识别模型所不及的。传统的图像识别技术大多依赖全局特征,难以捕捉到细微结构视觉区别。Doppelgangers 项目在这一方面尤为突出,能够提供高精度的图像区分能力,适用于对识别准确性有极高要求的场景。

此外,Doppelgangers 项目还提供了丰富的预训练模型和数据集,这些资源极大地丰富了研究者的实验素材,进一步推动了图像识别技术的发展。

应用场景与落地建议

Doppelgangers 的应用场景广泛,适用于需要高精度图像识别和结构对比的环境。例如:

  • 自动驾驶系统中的复杂路况识别,准确区分各种障碍物。
  • 安防监控及人脸识别,精准区别正常人员与伪装入侵者。
  • 工业质检应用,快速检测以及分类微观结构上的差异。

在实际部署过程中,需要注意以下几点:

  1. 模型训练: 在提供大规模数据集的同时,认真选择和调整模型参数以防止过拟合。
  2. 训练数据多样: 保持数据分布的多样性,有效增加模型的泛化能力。
  3. 实时性要求: 对实时性有较高要求的应用场景,需要优化模型大小,提升推理速度。

综合评价

Doppelgangers 作为图像识别与结构对比领域的一颗新星,无疑展现了在这一细分领域的技术和应用潜力。其通过深度孪生网路改进了图像区分性能,是对当前图像识别技术的重要补充。它不仅提供了一个清晰的方法论框架,而且展示了该技术的极大潜力。随着项目不断发展和完善,相信它在未来的自动驾驶、工业质检以及安防监控等领域将发挥更大的作用。

关于

GitHub 原始描述(英文)

Doppelgangers: Learning to Disambiguate Images of Similar Structures

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
464
价值分
151
活跃状态
活跃

语言占比

Jupyter Notebook
Python
Shell

README

Doppelgangers: Learning to Disambiguate Images of Similar Structures

Ruojin Cai1, Joseph Tung1, Qianqian Wang1, Hadar Averbuch-Elor2, Bharath Hariharan1, Noah Snavely1
1Cornell University, 2Tel Aviv University
ICCV 2023 Oral

Project Page | Paper | Arxiv | Dataset

Implementation for paper “Doppelgangers: Learning to Disambiguate Images of Similar Structures”, which proposes a learning-based approach to disambiguate distinct yet visually similar image pairs (doppelgangers) and applies it to structure-from-motion disambiguation.

Dependencies

  1. Create Conda environment with Python 3.8, PyTorch 1.12.0, and CUDA 10.2 using the following commands:
conda env create -f ./environment.yml
conda activate doppelgangers
  1. Download Colmap from their installation page (version 3.8+).

Pretrained Model

  • Pretrained model is available in the following link. To use the pretrained models, download the checkpoint.tar.gz file, unzip and put doppelgangers_classifier_loftr.pt under ./weights/ folder.

    [Click to expand]
    cd weights/
    wget -c https://doppelgangers.cs.cornell.edu/dataset/checkpoint.tar.gz
    tar -xf checkpoint.tar.gz
    mv doppelgangers/checkpoints/doppelgangers_classifier_loftr.pt ./
    rm checkpoint.tar.gz
    rm -r doppelgangers/
    
  • We use LoFTR models for feature matching. Please download the LoFTR outdoor checkpoint outdoor_ds.ckpt in the following Google Drive link, and put it under ./weights/ folder.

Dataset

This section contains download links for several helpful datasets:

  • SfM Disambiguation: Download the Structure from Motion disambigaution Dataset from the SfM disambiguation with COLMAP GitHub repository. Unzip the file under folder ./data/sfm_disambiguation/.
  • Pairwise Visual Disambiguation: Download the Doppelgangers Dataset by following these instructions and put the dataset under folder ./data/doppelgangers_dataset/.

SfM Disambiguation

Overview of applying Doppelgangers classifier to SfM disambiguation with COLMAP
  • We begin by performing COLMAP feature extraction and matching, which generates a list of image pairs.
  • Next, we run Doppelgangers classifiers on these image pairs, with LoFTR matches as input.
  • We then remove image pairs from the COLMAP database if they have a predicted probability below the specified threshold. These pairs are more likely to be Doppelgangers.
  • Finally, we perform COLMAP reconstruction with the pruned database.
Demo

We provide a demo on the Cup dataset to demonstrate how to use our Doppelgangers classifier in Structure from Motion disambiguation with COLMAP: ./notebook/demo_sfm_disambiguation.ipynb.

Script

We provide a script for SfM disambiguation. The COLMAP reconstruction with Doppelgangers classifier can be found at [output_path]/sparse_doppelgangers_[threshold]/.

# Usage:
# python script_sfm_disambiguation.py [path/to/example_config] --input_image_path [path/to/dataset] --output_path [path/to/output]
python script_sfm_disambiguation.py doppelgangers/configs/test_configs/sfm_disambiguation_example.yaml \
  --colmap_exe_command colmap \
  --input_image_path data/sfm_disambiguation/yan2017/cup/images \
  --output_path results/cup/ \
  --threshold 0.8 \
  --pretrained weights/doppelgangers_classifier_loftr.pt
Details of the Arguments: [Click to expand]
  • To apply the Doppelgangers classifier on custom datasets, change the argument --input_image_path [path/to/dataset] to the dataset path accordingly, and set the path for output results using the argument --output_path [path/to/output].

  • If you have already completed COLMAP feature extraction and matching stage, you can skip this stage with the --skip_feature_matching argument, and specify the path to database.db file using the argument --database_path [path/to/database.db].

    Example [Click to expand]
    python script_sfm_disambiguation.py doppelgangers/configs/test_configs/sfm_disambiguation_example.yaml \
      --colmap_exe_command colmap \
      --input_image_path data/sfm_disambiguation/yan2017/cup/images \
      --output_path results/cup/ \
      --skip_feature_matching \
      --database_path results/cup/database.db
    
  • Use the argument --skip_reconstruction to skip the standard COLMAP reconstruction w/o Doppelgangers classifier.

  • Change doppelgangers threshold with argument --threshold and specify a value between 0 and 1. A smaller threshold includes more pairs, while a larger threshold filters out more pairs. The default threshold is set to 0.8. When the reconstruction is split into several components, consider using a smaller threshold. If the reconstruction is not completely disambiguated, consider using a larger threshold.

  • Pretrained model can be specified by the argument --pretrained [path/to/checkpoint].

Reconstruction Results

COLMAP reconstructions of test scenes with and without the Doppelgangers classifier, as described in the paper: reconstructions.tar.gz (3G)

These reconstructions can be imported and visualized in the COLMAP GUI.

Pairwise Visual Disambiguation

Method overview

method

(a) Given a pair of images, we extract keypoints and matches via feature matching methods. Note that this is a negative (doppelganger) pair picturing opposite sides of the Arc de Triomphe. The feature matches are primarily in the top part of the structure, where there are repeated elements, as opposed to the sculptures on the bottom part. (b) We create binary masks of keypoints and matches. We then align the image pair and masks with an affine transformation estimated from matches. © Our classifier takes the concatenation of the images and binary masks as input and outputs the probability that the given pair is positive.

Testing the pretrained model

# Usage:
# python test.py [path/to/config] --pretrained [path/to/checkpoint]
python test.py doppelgangers/configs/training_configs/doppelgangers_classifier_noflip.yaml \
  --pretrained weights/doppelgangers_classifier_loftr.pt

Training

# Usage:
# python train.py [path/to/config] 
# python train_multi_gpu.py [path/to/config]
python train.py doppelgangers/configs/training_configs/doppelgangers_classifier_noflip.yaml

# training with multiple gpus on Doppelgangers dataset with image flip augmentation
python train_multi_gpu.py doppelgangers/configs/training_configs/doppelgangers_classifier_flip.yaml

Citation

@inproceedings{cai2023doppelgangers,
  title     = {Doppelgangers: Learning to Disambiguate Images of Similar Structures},
  author    = {Cai, Ruojin and Tung, Joseph and Wang, Qianqian and Averbuch-Elor, Hadar and Hariharan, Bharath and Snavely, Noah},
  journal   = {ICCV},
  year      = {2023}
}

评论

暂无评论