How to implement custom object detection with template matching. Today, state-of-the-art object detection algorithms (algorithms aiming to detect objects in pictures) are using neural networks such as Yolov4. Template matching is a technique in digital image processing for finding small parts of an image that matches a template image. It is a much simpler solution than a neural network to conduct object detection. In my experience, combining a neural network like Yolov4 and object detection with template matching here is a good way to considerably improve your neural network performance! When you use OpenCV template matching, your template slides pixel by pixel on your image.