Hi guys i'm trying to test my model into video for prediction
i got no error log or anything
but nothing appear, i am trying to open the video and predict it using my cnn(alexnet)+lstm model
here are my code
model_path = 'Model/CCTV_10Frame_Adam_Model_1e2_b16_regul.h5'
model = models.load_model(model_path)
vid = cv2.VideoCapture("Data16_116.mp4")
while(True):
ret, frame = vid.read()
start = time.time()
if ret:
draw = frame.copy()
draw = cv2.cvtColor(draw, cv2.COLOR_BGR2RGB)
scale_percent = 20 # percent of original size
width = 299
height = width
dim = (width, height)
frame_set = cv2.resize(draw, dim, interpolation = cv2.INTER_AREA)
frame_set=np.arange(10*width*height*3).reshape(10,width, height, 3)
frame_set.reshape(10, width, height, 3).shape
frame_set = np.expand_dims(frame_set, axis=0)
result=model.predict(frame_set)
cv2_imshow(result)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
vid.release()
cv2.destroyAllWindows()
does anyone know a thing about this?
any answer would be grateful
thank you so much !
Note : i did try it in vsc but sadly its only open for 1 second and the log saying
Allocator (GPU_0_bfc) ran out of memory trying to allocate 1.25GiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
"""Can you please check after remove the **else : break ** block from your code ? As it might be skipping the camera frame without validating any interrupt from user . """
if cv2.waitKey(1) & 0xFF == ord('q'): // remove the else block
break