Lip2Word
Lip2Word copied to clipboard
In lipReader.py (no of frames error)
In frameAdjust function defination, please add else block and push the code as mentioned below:
if target == n_frames : print("Perfect number of frames !") return video else : if n_frames > target : # If number of frames is more than 29, we select # 29 evenly distributed frames print("Adjusting number of frames") idx = np.linspace(0, n_frames-1, 29) idx = np.around(idx, 0).astype(np.int32) print("Indexes of the selected frames : \n{}".format(idx)) return video[:, :, idx] else : # If number of frames is less than 29, duplicate last # frame at the end of the video output_video = np.zeros((video.shape[0], video.shape[1], 29)).astype(np.uint8) output_video[:, :, :n_frames] = video for i in range(target-n_frames+1) : output_video[:, :, i+n_frames-1] = output_video[:, :, n_frames-1] return output_video
In frameAdjust function defination, please add else block and push the code as mentioned below:
if target == n_frames : print("Perfect number of frames !") return video else : if n_frames > target :
If number of frames is more than 29, we select
29 evenly distributed frames
print("Adjusting number of frames") idx = np.linspace(0, n_frames-1, 29) idx = np.around(idx, 0).astype(np.int32) print("Indexes of the selected frames : \n{}".format(idx)) return video[:, :, idx] else :
If number of frames is less than 29, duplicate last
frame at the end of the video
output_video = np.zeros((video.shape[0], video.shape[1], 29)).astype(np.uint8) output_video[:, :, :n_frames] = video for i in range(target-n_frames+1) : output_video[:, :, i+n_frames-1] = output_video[:, :, n_frames-1] return output_video
Use the below command to execute for Single Video. python lipReader.py --file data/lrs3_test_v0.4/test/0Fi83BHQsMA/2.mp4 --checkpoint_path experiments/inception/