airctic / icevision

An Agnostic Computer Vision Framework - Pluggable to any Training Library: Fastai, Pytorch-Lightning with more to come
https://airctic.github.io/icevision/
Apache License 2.0
845 stars 149 forks source link

Add support for Pytorch Lightning Trainer.test #1124

Closed AlexandreBrown closed 2 years ago

AlexandreBrown commented 2 years ago

🚀 Feature

Is your feature request related to a problem? Please describe. Currently, it is not possible to test an IceVision model with Pytorch Lightning (we can only train it but cannot test it).

Describe the solution you'd like We should override the test_step method in the IceVision Pytorch Lightning Model Adapter class so that it can be used by the Pytorch Lightning Trainer class (see https://pytorch-lightning.readthedocs.io/en/stable/common/trainer.html#testing )

Describe alternatives you've considered I've considered using the trainer.validate since IceVision already overrides the validation_step but this is not ideal since the validation step logs using self.log("val_loss", loss) which means that test metrics would be grouped with validaton metrics (eg: Using wandb logging).
This is not ideal since we lose the ability to clearly distinct validation metrics from test metrics.

Additional context PL Error :

MisconfigurationException: No `test_step()` method defined to run `Trainer.test`.