plt.title('Prediction (probability)') #plt.ion() plt.show() #plt.pause(1) bVisualize = False if bVisualize: #by jhugestar sys.path.append('/ssd/codes/glvis_python/') #from glViewer import SetFaceParmData,setSpeech,setSpeechGT,setSpeech_binary, setSpeechGT_binary, init_gl #opengl visualization import glViewer maxFrameNum = 2000 frameNum = test_X_vis.shape[0] startIdx = 0 test_X_vis = np.swapaxes( test_X_vis, 0, 1) #(frames, 200) ->(200, frames) where num can be thought as frames while startIdx < frameNum: endIdx = min(frameNum, startIdx + maxFrameNum) glViewer.setSpeechGT_binary([test_Y_cropped[startIdx:endIdx]]) glViewer.setSpeech_binary([pred_binary[startIdx:endIdx]]) glViewer.SetFaceParmData([test_X_vis[:, startIdx:endIdx]]) glViewer.init_gl() startIdx += maxFrameNum
# vis_faceData = [face_group[2,:,:], face_group[0,:,:], face_group[1,:,:]] # vis_faceData = [f.swapaxes(0,1) for f in vis_faceData] # #glViewer.SetFaceParmData(vis_faceData,True) # vis_faceNormalData= [ test_traj_raw_all[seqIdx][2,:,3:6], test_traj_raw_all[seqIdx][0,:,3:6], test_traj_raw_all[seqIdx][1,:,3:6]] # vis_faceNormalData = [f.swapaxes(0,1) for f in vis_faceNormalData] # vis_f2face_trans , vis_f2face_rot = utility.ComputeHeadOrientation(glViewer.g_skeletons, vis_faceNormalData) # glViewer.SetFaceParmDataWithTrans(vis_faceData,True, vis_f2face_trans, vis_f2face_rot) # #################################### # ## Visualize Speaking vis_speakGT = [ speech_group[2]['indicator'], speech_group[0]['indicator'], speech_group[1]['indicator'] ] glViewer.setSpeechGT_binary(vis_speakGT) vis_speak_pred = [ pred_speak_binary ] # speech_group[0]['indicator'], speech_group[1]['indicator']] glViewer.setSpeech_binary(vis_speak_pred) glViewer.init_gl() # """Compute turn changing time""" # speechSig = test_sppech_raw[2,:] # turnChange = np.where(abs(speechSig[1:] - speechSig[:-1] ) >0.5)[0] # """Show only turn change time""" # frameLeng = posData[0].shape[1] # print(turnChange) # selectedFrames = []
#################################################################################### # Visualization """ Visualize Location + Orientation """ # glViewer.setPosOnly(final_vis_posData) #glViewer.setFaceNormal(final_vis_faceNormalData) #glViewer.setBodyNormal(final_vis_bodyNormalData) """Visualize Trajectory""" #glViewer.set_Holden_Trajectory_3(final_vis_holdenTraj, initTrans=final_vis_holdenTraj_holden_initTrans, initRot=final_vis_holdenTraj_holden_initRot) #pred """Visualize Body""" glViewer.set_Holden_Data_73(final_vis_bodyData, ignore_root=False, initRot=final_vis_body_initRot, initTrans=final_vis_body_initTrans, bIsGT=False) """Visualize Speech""" glViewer.setSpeechGT_binary(final_vis_speak) #glViewer.setSpeechGT_binary([ final_vis_speak[1], final_vis_speak[2],final_vis_speak[3]]) #glViewer.setSpeech_binary(final_vis_speak) # """Visualize face""" ##glViewer.SetFaceParmData(vis_faceData,False) vis_f2face_trans, vis_f2face_rot = utility.ComputeHeadOrientation( glViewer.g_skeletons, final_vis_faceNormalData) glViewer.SetFaceParmDataWithTrans(final_vis_faceData, True, vis_f2face_trans, vis_f2face_rot) """Render output to videos""" if bRender: glViewer.setSaveOnlyMode(True) glViewer.setSave(True) glViewer.setSaveFoldeName(outputFolder) glViewer.LoadCamViewInfo()