I am having a problem using my own re-trained inception_v3 for real-time inference.
First off I have a question. When saving my model after training, is it enough to just save it’s state dictionary with
or do I also have to save the model with it and then the state dictionary?
my issue with inference is I am trying to use the re-trained inception_v3, which i only saved and loaed the state_dictionary for, it’s giving issues when i try to use my webcam and Opencv.
This is the code:
ret,frame = cam.read()
frame = torch.Tensor(frame)
out=incept(new_frame.permute(0,3,1,2)) #model =model(inputs.permute(0, 3, 1, 2)) for proper channel placement
if cv2.waitKey(1) & 0xFF == ord(‘q’):
I am now getting an error stating:
TypeError: Expected Ptrcv::UMat for argument ‘mat’. Is there a better way to run a pytroch model for inference over webcam feed from opencv?