I have used transfer learning of pytorch to trained a model. It has an extension of .pth. I want to use it to recognize object in video. I have always been using opencv in video processing so I want to use it this time too. However, the dnn module from opencv does not accept model with .pth extension. Can I generate model with pytorch that can be accepted by opencv? Or can I use model with .pth in opencv?
Here's how I saved the trained model
torch.save(the_model.state_dict(), PATH)
I have read that post How should I save the model of PyTorch if I want it loadable by OpenCV dnn module but it is not helpful