hello everyone, I was following the tutorial on colab (baloon dataset) and I saw that in the line of code " inference_on_dataset (trainer.model, val_loader, evaluator) ", the trainer was passed and not the predictor. Reading the documentation, the inference_on_dataset function takes as input the model in eval mode. Is this a mistake? trying on the balloon dataset, the AP drops 13% passing predictor.model instead of training.model
trainer.model is a model, therefore it's not a mistake.
The predictor in the colab tutorial was built with the same weights but different threshold configuration, therefore predictor.model will produce different results from trainer.model.
ok, i have other two question:
1) trainer.model is already in eval mode when I pass it as an argument function?
2) if I have already trained the model and kept the weights, do I have to instantiate the trainer to use the inferece_on_dataset function? or can I still use the predictor?
inference_on_dataset will use the model in eval mode regardless of its original mode. I'll make the docs more clear on this.build_model to obtain a model and load the weights, following https://detectron2.readthedocs.io/tutorials/models.html
Most helpful comment
ok, i have other two question:
1) trainer.model is already in eval mode when I pass it as an argument function?
2) if I have already trained the model and kept the weights, do I have to instantiate the trainer to use the inferece_on_dataset function? or can I still use the predictor?