The terms error and loss are always relative to some ideal of fitness, and it is always against some model, the extension of the concept of curve fitting. The ideal is the optimized state.
When we are analyzing system behavior and optimizing PROCESS parameters as we do in machine learning, we don't always use the same terms. Just as people in medicine and alternative medicine speak of wellness, systems that process data instead of food also can be considered either well or dysfunctional. With machine vision, we optimize the processing of an arbitrary signal, an image with an object depicted in your case, not the parameters of a curve to fit a set of data points.
It is common to wish to judge the wellness of the learning state across a range of sizes. You cannot normalize the image by re-sizing before you recognize the image boundaries, so you have to design the process (circuit) that must be trained accordingly.
It is not in the error function that this can be done. There are only two places where it can be done.
- The model of the object you are trying to recognize
- The process topology you are attempting to train
The standard approach for size-independent recognition involves a sequence in the process being trained, reflected in activation and interconnection choices.
- Edge detection
- Corner detection
- Shape detection
- Illumination detection (for higher reliability)
Note that edge detection and corner detection can overlap in learning layers but not necessarily.
The key is obviously between corner and shape detection. The feed of corners into the layer that detects shape has to be angular rather than Cartesian yielding this sequence.
- Edge detection
- Corner detection
- Angles at corners
- Shape/form detection
- Illumination detection (for higher reliability)
A designer can hope a deep network will learn these through back-propagation, but convergence upon the ideal behavior (wellness) will be faster and more reliable if the layers are designed to perform those functions. That means your model for the shape or form you hope to detect must be in terms of angles not coordinates.
Florian Pierre and Joseph Piewak seem to be doing it correctly: https://arxiv.org/pdf/1709.03138.pdf. Search the document with ctrl-f for "angl". These researchers show excellence in their treatment: https://arxiv.org/pdf/1806.07996.pdf [2]. Search for "size indep" in that one.
References
[1] Fully Convolutional Neural Networks for Dynamic Object Detection in Grid Maps; Master’s Thesis of Florian Pierre, Joseph Piewak; Department of Computer Science, Institute for Anthropomatics and FZI Research Center for Information Technology respectively; 2016
[2] Novel Convolution Kernels for Computer Vision and Shape Analysis based on Electromagnetism; Beaini, Achiche, Cio, Raison; 2018; Polytechnique Montreal, 2900 Edouard Montpetit Blvd, Montreal, H3T 1J4, Canada