I noticed a trend in libraries like mmdetection, detectron2 and even torchvision where we absorb the preprocessing into the nn.Module.
So for a classification model, normally we normalize pixels prior to input, whereas a detection model has that and other transforms built into the nn.Module. Furthermore, the detection models seem to have a bunch of assertions and checks (are the bbox targets properly defined).
Personally, I’m not a fan of this approach, and I like to keep the DNN in the nn.Module, and anything else like the preprocessing separate. Would go as far as to say that even the losses should be calculated separately (whereas in torchvision some of the losses are calculated within the submodules)
But why is that the trend? (this is my main question) Would love it if someone can convince me why I should drop my preference and go with the flow.