Closed CarlosNacher closed 2 months ago
Whats happening in _setup_transform
is setting the evaluation transform as the models default image transformation method. This is intended because during inference you want to use the eval transform only. The eval transform is stored to the model and saved in the model export file.
During training and validation the images are not transformed by the model transforms, but by the transforms that are defined in the respective datamodules.
In addition to what @alexriedel1 described, i could add the following: if the user does not provide any custom transforms, the datamodule will use the transforms pre-defined by the model. These are the default ones that are reported in their respective papers.
If the user wants to provide custom transforms, the datamodule takes those into account. At the end of the training they will be wrapped within the exported model. The idea behind is that a user should be able to pass a raw image to the inference model without requiring any additional pre-processing stages. All of this will be handled by the inference model.
I'm moving this to Q&A, from which we could continue to discuss.
Discussed in https://github.com/openvinotoolkit/anomalib/discussions/2100