I have to extract part of a source image, then I have to check if it is similar or almost similar to any of the 10 target images, so that I can do further processing on that one specific target image, which is similar to the source image. It's like template matching, but they have to loop over 10 different images to find whether a matching template is found in any of those images or not.

I wanted to use a CNN-based solution, as a classical distance-based solution is giving poor results.

Can I use a CNN for template matching, so that there is robustness, as the background of the target image is not that good, and it causes a problem? If some resource can be pointed that would be great too.

  • $\begingroup$ Do you have enough training instances for each of the 10 (target) classes for which you have the prototypical target images? Because in that case, the task would boil down to a simple classification task (of a class label). Otherwise, for template matching, have you tried using the SIFT transform method, possibly in combination with pre-processing to reduce the noise in images? $\endgroup$
    – Daniel B.
    Jan 29, 2021 at 22:56
  • $\begingroup$ Yes I have reasonable value to train right now but problem is that in future classes will be keep on expanding and new classes will be slightly different from existing classes, that's why I was thinking to use template based CNN solution. I have tried SIFT and SURF based algorithm but using them didn't gave better result. I have thought about zero shot learning/incremental learning as for future classes I will have some details available like how new class of image should be. But not sure which approach to take. $\endgroup$
    – Rambo_john
    Jan 29, 2021 at 23:12
  • $\begingroup$ A CNN, if you don't use it for classification, only produces a highly-nonlinear encoding of some input image. From there on, you would probably have to resort to other template matching techniques again. Alternatively. have you tried LVQ already? $\endgroup$
    – Daniel B.
    Jan 29, 2021 at 23:19
  • $\begingroup$ Thanks for suggestion, will try both CNN and parallelly LVQ to check which one works. But since my old try with classical algorithm failed, or it was very slow to find matching.As destination where the template is to be matched is very noisy and filled with extra unnecessary details which confused classical methods for matching. $\endgroup$
    – Rambo_john
    Jan 29, 2021 at 23:29
  • $\begingroup$ You can always try improving robustness of almost any ML method by applying data augmentation, i.e. by adding additional artificial training data to your existing training dataset, where the extra images are copies of existing training images to which noise (maybe even of different magnitude, so to say) has been added. That might help as well. $\endgroup$
    – Daniel B.
    Jan 29, 2021 at 23:34


You must log in to answer this question.