I’m using cocoapi for metric calculation and it needs dataset to build COCO object out of it.
I’ve written dataset initialization logic inside DataModule’s setup() method which I’m guessing is called internally by the trainer to ensure it has been called only once.
The cocoapi returns CocoEvaluator which I’m using in the main LightningModule. To handle this dependency chain, I need to call setup() method of DataModule so that the dataset has been constructed. I feel this defeats the purpose of having dedicated DataModule and LightningModule if I’ve a common dependency.
Let me know if there’s any better way of doing this. Can we provide DataModule as a parameter to LightningModule?