I’ve already create an image recognition application, now I want to use it to do real-time recognition, I wonder how can I do it?
I was thinking use opencv to get the camera video frame, and I hope to apply my image recognition application on it, here’s my code:
cap = cv2.VideoCapture(0)
learn = load_learner(path)
ret, frame = cap.read()
pred_class,pred_idx,outputs = learn.predict(frame)
if cv2.waitKey(1)&0xFF == ord(‘q’):
And I get an error:
AttributeError: ‘numpy.ndarray’ object has no attribute ‘apply_tfms’
So how can I fix the problem to get my code work?
Thanks to everyone who answer it.