/Deep-DIM

This is the official repo for the paper ‘’Robust Template Matching via Hierarchical Convolutional Features from a Shape Biased CNN''.

Primary LanguagePython


This is the official repo for the paper Robust Template Matching via Hierarchical Convolutional Features from a Shape Biased CNN. For more details, please refer to

@InProceedings{gao2021robust,
      title={Robust Template Matching via Hierarchical Convolutional Features from a Shape Biased CNN}, 
      author={Bo Gao and M. W. Spratling},
      year={2021},
      eprint={arXiv:2007.15817},
}

Motivation

The idea is straightforward which is to investigate if enhancing the CNN's encoding of shape information can produce more distinguishable features that improve the performance of template matching.

Results

Dependencies

  • Dependencies in our experiment, not necessary to be exactly same version but later version is preferred
  • python=3.7
  • pytorch=1.2.0

Demo Code

Download the pretrained model from here and put it into ./model

The results of using features from all combinations of three layers can be downloaded from here.

Run DIM on BBS dataset using features form the best combination.

python deep_DIM.py --Dataset BBS --Mode Best 

Run DIM on BBS dataset using features from all possible combinations of three layers.

python deep_DIM.py --Dataset BBS --Mode All 

What is DIM?

DIM is a recent state-of-the-art template matching method using the mechanism explaining away. An illustration of explaining away can be found below. Red rectangle area in the left image (template image) is the template for matching, and four same size green rectangle areas are the additional templates. These templates compete with each other to be matched to the search image (Right). To be specific, only one template is supported to be the best matching one at every location whereas the similarities of others are suppressed or explained away. The corresponding matching results are shown in the right. The details of DIM can be found here.