iteration = args.iteration new_idx = poseDataset.new_idx featureRange = poseDataset.nodeFeaturesRanges base_dir = poseDataset.base_dir path = '{0}/{1}/'.format(base_dir,args.checkpoint) if not os.path.exists(path): print 'Checkpoint path does not exist. Exiting!!' sys.exit() crf_file = './CRFProblems/H3.6m/crf' if args.forecast == 'dra': path_to_checkpoint = '{0}checkpoint.{1}'.format(path,iteration) if os.path.exists(path_to_checkpoint): [nodeNames,nodeList,nodeFeatureLength,nodeConnections,edgeList,edgeListComplete,edgeFeatures,nodeToEdgeConnections,trX,trY,trX_validation,trY_validation,trX_forecasting,trY_forecasting,trX_forecast_nodeFeatures] = graph.readCRFgraph(poseDataset,noise=0.7,forecast_on_noisy_features=True) print trX_forecast_nodeFeatures.keys() print 'Loading the model' model = loadDRA(path_to_checkpoint) print 'Loaded DRA: ',path_to_checkpoint t0 = time.time() trY_forecasting = model.convertToSingleVec(trY_forecasting,new_idx,featureRange) fname = 'ground_truth_longforecast' model.saveForecastedMotion(trY_forecasting,path,fname) trX_forecast_nodeFeatures_ = model.convertToSingleVec(trX_forecast_nodeFeatures,new_idx,featureRange) fname = 'motionprefixlong' model.saveForecastedMotion(trX_forecast_nodeFeatures_,path,fname) forecasted_motion = model.predict_sequence(trX_forecasting,trX_forecast_nodeFeatures,sequence_length=trY_forecasting.shape[0],poseDataset=poseDataset,graph=graph)
def trainDRA(): crf_file = './CRFProblems/H3.6m/crf' + args.crf path_to_checkpoint = poseDataset.base_dir + '/{0}/'.format(args.checkpoint_path) print path_to_checkpoint if not os.path.exists(path_to_checkpoint): os.mkdir(path_to_checkpoint) saveNormalizationStats(path_to_checkpoint) [nodeNames,nodeList,nodeFeatureLength,nodeConnections,edgeList,edgeListComplete,edgeFeatures,nodeToEdgeConnections,trX,trY,trX_validation,trY_validation,trX_forecasting,trY_forecasting,trX_forecast_nodeFeatures] = graph.readCRFgraph(poseDataset) new_idx = poseDataset.new_idx featureRange = poseDataset.nodeFeaturesRanges dra = [] if args.use_pretrained == 1: dra = loadDRA(path_to_checkpoint+'checkpoint.'+str(args.iter_to_load)) print 'DRA model loaded successfully' else: args.iter_to_load = 0 if args.dra_type == 'simple': dra = DRAmodelRegression(nodeList,edgeList,edgeListComplete,edgeFeatures,nodeFeatureLength,nodeToEdgeConnections) if args.dra_type == 'RNNatEachNode': dra = DRAmodelRegression_RNNatEachNode(nodeList,edgeList,edgeListComplete,edgeFeatures,nodeFeatureLength,nodeToEdgeConnections) if args.dra_type == 'NoEdge': dra = DRAmodelRegressionNoEdge(nodeList,edgeList,edgeListComplete,edgeFeatures,nodeFeatureLength,nodeToEdgeConnections) saveForecastedMotion(dra.convertToSingleVec(trY_forecasting,new_idx,featureRange),path_to_checkpoint) saveForecastedMotion(dra.convertToSingleVec(trX_forecast_nodeFeatures,new_idx,featureRange),path_to_checkpoint,'motionprefix_N_') dra.fitModel(trX, trY, snapshot_rate=args.snapshot_rate, path=path_to_checkpoint, epochs=args.epochs, batch_size=args.batch_size, decay_after=args.decay_after, learning_rate=args.initial_lr, learning_rate_decay=args.learning_rate_decay, trX_validation=trX_validation, trY_validation=trY_validation, trX_forecasting=trX_forecasting, trY_forecasting=trY_forecasting,trX_forecast_nodeFeatures=trX_forecast_nodeFeatures, iter_start=args.iter_to_load, decay_type=args.decay_type, decay_schedule=args.decay_schedule, decay_rate_schedule=args.decay_rate_schedule, use_noise=args.use_noise, noise_schedule=args.noise_schedule, noise_rate_schedule=args.noise_rate_schedule, new_idx=new_idx,featureRange=featureRange,poseDataset=poseDataset,graph=graph,maxiter=args.maxiter,unNormalizeData=unNormalizeData)
import socket as soc import copy import readCRFgraph as graph '''Loads H3.6m dataset''' sys.path.insert(0,'CRFProblems/H3.6m') import processdata as poseDataset poseDataset.T = 150 poseDataset.delta_shift = 100 poseDataset.runall() print '**** H3.6m Loaded ****' #trX,trY = poseDataset.getMalikFeatures() #trX_forecasting,trY_forecasting = poseDataset.getMalikTrajectoryForecasting() crf_file = './CRFProblems/H3.6m/crf' [nodeNames,nodeList,nodeFeatureLength,nodeConnections,edgeList,edgeFeatures,nodeToEdgeConnections,trX,trY,trX_validation,trY_validation,trX_forecasting,trY_forecasting] = graph.readCRFgraph(crf_file,poseDataset) base_dir = poseDataset.base_dir path = '{0}/checkpoints_dra_T_150_batch_size_100_tg_100_ls_512_fc_256_initial_lr_0.001_clipnorm_25.0_noise_schd_[500.0,1000.0,1300.0,2000.0,2500.0,3300.0,4000.0,4500.0]_noise_rate_[0.1,0.3,0.5,0.7,0.8,0.9,1.0,1.2]_decay_schd_[1000.0,4000.0]_decay_rate_[0.1,0.1]/'.format(base_dir) #path_to_checkpoints = '{0}/checkpoints_LSTM_no_Trans_s_1000_lstm_init_orthogonal_fc_init_uniform_decay_type_schedule/'.format(base_dir) #path_to_checkpoint = '{0}/checkpoints_LSTM_no_Trans_s_1000_lstm_init_orthogonal_fc_init_uniform_decay_type_schedule/checkpoint.30'.format(base_dir) epoch = 20 path_to_checkpoint = '{0}checkpoint.{1}'.format(path,epoch) rnn = loadDRA(path_to_checkpoint) forecasted_motion = rnn.predict_sequence(trX_forecasting,sequence_length=trY_forecasting.shape[0]) skel_err = np.mean(np.sqrt(np.sum(np.square((forecasted_motion - trY_forecasting)),axis=2)),axis=1) err_per_dof = skel_err / trY_forecasting.shape[2] print skel_err print err_per_dof
ssh("echo " + "'" + string + "'" + " > " + file) # else: # ssh( "echo " + '"' + string + '"' + " >> " + file) path_to_checkpoint = '{0}/checkpoint.pik'.format( path) #'{0}checkpoint.{1}'.format(path,iteration) print(path_to_checkpoint) if os.path.exists(path_to_checkpoint): [ nodeNames, nodeList, nodeFeatureLength, nodeConnections, edgeList, edgeListComplete, edgeFeatures, nodeToEdgeConnections, trX, trY, trX_validation, trY_validation, X_test, Y_test, beginning_motion, adjacency ] = graph.readCRFgraph(poseDataset, noise=0.7, forecast_on_noisy_features=True) print beginning_motion.keys() else: print("ERROR: Checkpoint not found") gt = convertToSingleVec(Y_test, new_idx, featureRange) beginning_motion_dropped_ = convertToSingleVec(beginning_motion, new_idx, featureRange) gt_full = np.zeros((np.shape(gt)[0], np.shape(gt)[1], len(new_idx))) beginning_motion_full_ = np.zeros( (np.shape(beginning_motion_dropped_)[0], np.shape(beginning_motion_dropped_)[1], len(new_idx)))
def trainModel(params): drop_ids = params.drop_id.split(',') dropIdList = [] for dids in drop_ids: dropIdList.append(int(dids)) import processdata as poseDataset '''Loads H3.6m dataset''' sys.path.insert(0,'CRFProblems/H3.6m') poseDataset.T = params.sequence_length poseDataset.delta_shift = params.sequence_length - params.sequence_overlap poseDataset.num_forecast_examples = 24 poseDataset.copy_state = params.copy_state poseDataset.full_skeleton = params.full_skeleton poseDataset.train_for = params.train_for poseDataset.temporal_features = params.temporal_features poseDataset.crf_file = './CRFProblems/H3.6m/crf' + params.crf poseDataset.dataset_prefix = params.dataset_prefix poseDataset.drop_features = params.drop_features poseDataset.drop_id = dropIdList poseDataset.subsample_data = params.subsample_data poseDataset.runall() if poseDataset.copy_state: params.batch_size = poseDataset.minibatch_size path_to_dump = '../dump/' [nodeNames,nodeList,nodeFeatureLength,nodeConnections,edgeList,edgeListComplete,edgeFeatures,nodeToEdgeConnections,trX,trY,trX_validation,trY_validation,trX_forecasting,trY_forecasting,trX_forecast_nodeFeatures,adjacency] = graph.readCRFgraph(poseDataset) print '**** H3.6m Loaded ****' nodeNames = nodeNames.keys() new_idx = poseDataset.new_idx featureRange = poseDataset.nodeFeaturesRanges if params.use_pretrained == 1: print 'Loading pre-trained model with iter={0}'.format(params.iter_to_load) params.checkpoint_path = '/users/btech/siddsax/' model = loadModel(params.checkpoint_path+'checkpoint.'+str(params.iter_to_load)) print 'DRA model loaded successfully' else: params.iter_to_load = 0 model = defineGCN(params, nodeNames, nodeList, edgeList, edgeListComplete, edgeFeatures, nodeFeatureLength, nodeToEdgeConnections, new_idx, featureRange,adjacency) thefile = open('logger.txt', 'w') logModel(params, thefile, nodeNames, model, poseDataset) model.fitModel(trX, trY, snapshot_rate=params.snapshot_rate, path=params.checkpoint_path, pathD=path_to_dump, epochs=params.epochs, batch_size=params.batch_size, decay_after=params.decay_after, learning_rate=params.initial_lr, learning_rate_decay=params.learning_rate_decay, trX_validation=trX_validation, trY_validation=trY_validation, trX_forecasting=trX_forecasting, trY_forecasting=trY_forecasting,trX_forecast_nodeFeatures=trX_forecast_nodeFeatures, iter_start=params.iter_to_load, decay_type=params.decay_type, decay_schedule=params.decay_schedule, decay_rate_schedule=params.decay_rate_schedule, use_noise=params.use_noise, noise_schedule=params.noise_schedule, noise_rate_schedule=params.noise_rate_schedule, new_idx=new_idx, featureRange=featureRange, poseDataset=poseDataset, graph=graph, maxiter=params.maxiter, ssh_f=len(params.remoteBase), log=True, num_batches= params.curriculum)
def model(): if args.forecast == 'srnn': path_to_checkpoint = '{0}checkpoint.{1}'.format(path, args.iteration) print "Using checkpoint at: ",path_to_checkpoint if os.path.exists(path_to_checkpoint): [nodeNames, nodeList, nodeFeatureLength, nodeConnections, edgeList, edgeListComplete, edgeFeatures, nodeToEdgeConnections, trX,trY, trX_validation, trY_validation, trX_forecasting, trY_forecasting, trX_forecast_nodeFeatures] = graph.readCRFgraph(poseDataset) print trX_forecast_nodeFeatures.keys() print 'Loading the model (this takes long, can take upto 25 minutes)' model = loadDRA(path_to_checkpoint) print model print 'Loaded S-RNN from ', path_to_checkpoint t0 = time.time() save_full = True trY_forecasting = model.convertToSingleVec(trY_forecasting,new_idx,featureRange) # 8x100x54 print trY_forecasting.shape trX_forecast_nodeFeatures_ = model.convertToSingleVec(trX_forecast_nodeFeatures, new_idx, featureRange) # normalize_data_for_srnn() trY_forecasting_tem = trY_forecasting trX_forecasting_tem = trX_forecast_nodeFeatures_ filterList = [10, 11, 16, 17, 18, 19, 20, 25, 26, 31, 32, 33, 34, 35, 48, 49, 50, 58, 59, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 82, 83, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98] for i in filterList: trY_forecasting_tem = np.insert(trY_forecasting_tem, i, 0, axis=2) trX_forecasting_tem = np.insert(trX_forecasting_tem, i, 0, axis=2) trY_forecasting_full = trY_forecasting_tem trX_forecasting_full = trX_forecasting_tem print(trY_forecasting_full.shape) print(trX_forecasting_full.shape) fname = 'ground_truth_forecast' if(save_full): # unnormalize_data() trY_forecasting_full_orig = unnormalize_data(trY_forecasting_full, poseDataset.data_mean, poseDataset.data_std, []) model.saveForecastedMotion(trY_forecasting_full_orig, path, fname) else: model.saveForecastedMotion(trY_forecasting, path, fname) fname = 'motionprefix' if(save_full): trX_forecast_nodeFeatures_full_orig = unnormalize_data(trX_forecasting_full, poseDataset.data_mean, poseDataset.data_std, []) model.saveForecastedMotion(trX_forecast_nodeFeatures_full_orig, path, fname) else: model.saveForecastedMotion(trX_forecasting, path, fname) forecasted_motion = model.predict_sequence(trX_forecasting, trX_forecast_nodeFeatures,sequence_length=trY_forecasting.shape[0],poseDataset=poseDataset,graph=graph) forecasted_motion = model.convertToSingleVec(forecasted_motion, new_idx, featureRange) fname = 'forecast' if(save_full): filter_list = [] for x in range(trY_forecasting_full.shape[2]): if x in filterList: continue filter_list.append(x) forecasted_motion_full = trY_forecasting_full forecasted_motion_full[:, :, filter_list] = forecasted_motion # unnormalize_data() forecasted_motion_full_orig = unnormalize_data(forecasted_motion_full, poseDataset.data_mean, poseDataset.data_std, []) model.saveForecastedMotion(forecasted_motion_full_orig, path, fname) else: model.saveForecastedMotion(forecasted_motion, path, fname) skel_err = np.mean(np.sqrt(np.sum(np.square((forecasted_motion - trY_forecasting)),axis=2)),axis=1) err_per_dof = skel_err / trY_forecasting.shape[2] fname = 'forecast_error' model.saveForecastError(skel_err,err_per_dof,path,fname) t1 = time.time() print t1-t0 del model else: print "the path is not found!!!" elif args.forecast == 'lstm3lr' or args.forecast == 'erd': path_to_checkpoint = '{0}checkpoint.{1}'.format(path, args.iteration) if os.path.exists(path_to_checkpoint): print "Loading the model {0} (this may take sometime)".format(args.forecast) model = load(path_to_checkpoint) print 'Loaded the model from ',path_to_checkpoint save_full = True # more colum than srnn1 8x100x99 trX_forecasting_full, trY_forecasting_full = poseDataset.getMalikTrajectoryForecastingFull() # same mat as srnn1 8x100x54 trX_forecasting, trY_forecasting = poseDataset.getMalikTrajectoryForecasting() fname = 'ground_truth_forecast' if(save_full): # unnormalize_data() # print(poseDataset.dimensions_to_ignore) trY_forecasting_full_orig = unnormalize_data(trY_forecasting_full, poseDataset.data_mean, poseDataset.data_std, []) model.saveForecastedMotion(trY_forecasting_full_orig, path, fname) else: model.saveForecastedMotion(trY_forecasting, path, fname) fname = 'motionprefix' if(save_full): # unnormalize_data() trX_forecasting_full_orig = unnormalize_data(trX_forecasting_full, poseDataset.data_mean, poseDataset.data_std, []) model.saveForecastedMotion(trX_forecasting_full_orig, path, fname) else: model.saveForecastedMotion(trX_forecasting, path, fname) forecasted_motion = model.predict_sequence(trX_forecasting,sequence_length=trY_forecasting.shape[0]) fname = 'forecast' if(save_full): filter_list = [] for x in range(trY_forecasting_full.shape[2]): if x in poseDataset.dimensions_to_ignore: continue filter_list.append(x) forecasted_motion_full = trY_forecasting_full forecasted_motion_full[:, :, filter_list] = forecasted_motion # unnormalize_data() forecasted_motion_full_orig = unnormalize_data(forecasted_motion_full, poseDataset.data_mean, poseDataset.data_std, []) model.saveForecastedMotion(forecasted_motion_full_orig, path, fname) else: model.saveForecastedMotion(forecasted_motion,path,fname) skel_err = np.mean(np.sqrt(np.sum(np.square((forecasted_motion - trY_forecasting)),axis=2)),axis=1) err_per_dof = skel_err / trY_forecasting.shape[2] fname = 'forecast_error' model.saveForecastError(skel_err,err_per_dof,path,fname) # print(trX_forecasting_full.shape) # print(trX_forecasting.shape) del model else: print "the path is not found!!!" elif args.forecast == 'dracell': path_to_checkpoint = '{0}checkpoint.{1}'.format(path, args.iteration) if os.path.exists(path_to_checkpoint): [nodeNames,nodeList,nodeFeatureLength,nodeConnections,edgeList,edgeListComplete,edgeFeatures,nodeToEdgeConnections,trX,trY,trX_validation,trY_validation,trX_forecasting,trY_forecasting,trX_forecast_nodeFeatures] = graph.readCRFgraph(poseDataset,noise=0.7,forecast_on_noisy_features=True) print trX_forecast_nodeFeatures.keys() print 'Loading the model' model = loadDRA(path_to_checkpoint) print 'Loaded DRA: ',path_to_checkpoint t0 = time.time() trY_forecasting = model.convertToSingleVec(trY_forecasting,new_idx,featureRange) trX_forecast_nodeFeatures_ = model.convertToSingleVec(trX_forecast_nodeFeatures,new_idx,featureRange) fname = 'motionprefixlong' model.saveForecastedMotion(trX_forecast_nodeFeatures_,path,fname) cellstate = model.predict_cell(trX_forecasting,trX_forecast_nodeFeatures,sequence_length=trY_forecasting.shape[0],poseDataset=poseDataset,graph=graph) fname = 'forecast_celllong_{0}'.format(args.iteration) model.saveCellState(cellstate,path,fname) t1 = time.time() del model print 'ending program'
'''Loads H3.6m dataset''' sys.path.insert(0, 'CRFProblems/H3.6m') import processdata as poseDataset poseDataset.T = 150 poseDataset.delta_shift = 100 poseDataset.runall() print '**** H3.6m Loaded ****' #trX,trY = poseDataset.getMalikFeatures() #trX_forecasting,trY_forecasting = poseDataset.getMalikTrajectoryForecasting() crf_file = './CRFProblems/H3.6m/crf' [ nodeNames, nodeList, nodeFeatureLength, nodeConnections, edgeList, edgeFeatures, nodeToEdgeConnections, trX, trY, trX_validation, trY_validation, trX_forecasting, trY_forecasting ] = graph.readCRFgraph(crf_file, poseDataset) base_dir = poseDataset.base_dir path = '{0}/checkpoints_dra_T_150_batch_size_100_tg_100_ls_512_fc_256_initial_lr_0.001_clipnorm_25.0_noise_schd_[500.0,1000.0,1300.0,2000.0,2500.0,3300.0,4000.0,4500.0]_noise_rate_[0.1,0.3,0.5,0.7,0.8,0.9,1.0,1.2]_decay_schd_[1000.0,4000.0]_decay_rate_[0.1,0.1]/'.format( base_dir) #path_to_checkpoints = '{0}/checkpoints_LSTM_no_Trans_s_1000_lstm_init_orthogonal_fc_init_uniform_decay_type_schedule/'.format(base_dir) #path_to_checkpoint = '{0}/checkpoints_LSTM_no_Trans_s_1000_lstm_init_orthogonal_fc_init_uniform_decay_type_schedule/checkpoint.30'.format(base_dir) epoch = 20 path_to_checkpoint = '{0}checkpoint.{1}'.format(path, epoch) rnn = loadDRA(path_to_checkpoint) forecasted_motion = rnn.predict_sequence( trX_forecasting, sequence_length=trY_forecasting.shape[0]) skel_err = np.mean(np.sqrt( np.sum(np.square((forecasted_motion - trY_forecasting)), axis=2)),
def trainDRA(): crf_file = './CRFProblems/H3.6m/crf' + args.crf path_to_checkpoint = poseDataset.base_dir + '/{0}/'.format( args.checkpoint_path) print path_to_checkpoint if not os.path.exists(path_to_checkpoint): os.mkdir(path_to_checkpoint) saveNormalizationStats(path_to_checkpoint) [ nodeNames, nodeList, nodeFeatureLength, nodeConnections, edgeList, edgeListComplete, edgeFeatures, nodeToEdgeConnections, trX, trY, trX_validation, trY_validation, trX_forecasting, trY_forecasting, trX_forecast_nodeFeatures ] = graph.readCRFgraph(poseDataset) new_idx = poseDataset.new_idx featureRange = poseDataset.nodeFeaturesRanges dra = [] if args.use_pretrained == 1: dra = loadDRA(path_to_checkpoint + 'checkpoint.' + str(args.iter_to_load)) print 'DRA model loaded successfully' else: args.iter_to_load = 0 if args.dra_type == 'simple': dra = DRAmodelRegression(nodeList, edgeList, edgeListComplete, edgeFeatures, nodeFeatureLength, nodeToEdgeConnections) if args.dra_type == 'RNNatEachNode': dra = DRAmodelRegression_RNNatEachNode(nodeList, edgeList, edgeListComplete, edgeFeatures, nodeFeatureLength, nodeToEdgeConnections) if args.dra_type == 'NoEdge': dra = DRAmodelRegressionNoEdge(nodeList, edgeList, edgeListComplete, edgeFeatures, nodeFeatureLength, nodeToEdgeConnections) saveForecastedMotion( dra.convertToSingleVec(trY_forecasting, new_idx, featureRange), path_to_checkpoint) saveForecastedMotion( dra.convertToSingleVec(trX_forecast_nodeFeatures, new_idx, featureRange), path_to_checkpoint, 'motionprefix_N_') dra.fitModel(trX, trY, snapshot_rate=args.snapshot_rate, path=path_to_checkpoint, epochs=args.epochs, batch_size=args.batch_size, decay_after=args.decay_after, learning_rate=args.initial_lr, learning_rate_decay=args.learning_rate_decay, trX_validation=trX_validation, trY_validation=trY_validation, trX_forecasting=trX_forecasting, trY_forecasting=trY_forecasting, trX_forecast_nodeFeatures=trX_forecast_nodeFeatures, iter_start=args.iter_to_load, decay_type=args.decay_type, decay_schedule=args.decay_schedule, decay_rate_schedule=args.decay_rate_schedule, use_noise=args.use_noise, noise_schedule=args.noise_schedule, noise_rate_schedule=args.noise_rate_schedule, new_idx=new_idx, featureRange=featureRange, poseDataset=poseDataset, graph=graph, maxiter=args.maxiter, unNormalizeData=unNormalizeData)
def getError(args, poseDataset, model = None): new_idx = poseDataset.new_idx featureRange = poseDataset.nodeFeaturesRanges if model is None: model = loadModel(args.checkpoint_path) [nodeNames,nodeList,nodeFeatureLength,nodeConnections,edgeList,edgeListComplete,edgeFeatures,nodeToEdgeConnections,trX,trY,trX_validation,trY_validation,X_test,Y_test,beginning_motion,adjacency] = graph.readCRFgraph(poseDataset,noise=0.7,forecast_on_noisy_features=True) #------------------------------------------------------------------------------------------------------------ gt_dropped = convertToSingleVec(Y_test,new_idx,featureRange) beginning_motion_dropped = convertToSingleVec(beginning_motion,new_idx,featureRange) if os.path.exists(args.checkpoint_path): if(len(model.graphLayers)): predicted_test_dropped = model.predict_sequence(X_test,beginning_motion,featureRange,new_idx, sequence_length=gt_dropped.shape[0],poseDataset=poseDataset,graph=graph) else: predicted_test_dropped = model.predict_sequence_indep(X_test,beginning_motion, sequence_length=gt_dropped.shape[0],poseDataset=poseDataset,graph=graph) predicted_test_dropped = convertToSingleVec(predicted_test_dropped,new_idx,featureRange) # else: # predicted_test = np.zeros((np.shape(gt)[0],np.shape(gt)[1],len(new_idx))) # for i in range(8): # predicted_test[:,i,:] = genfromtxt('../savedModels/checkpoints_dra_T_150_bs_100_tg_100_ls_512_fc_256_demoforecast_iteration_unnorm_N_' + str(i), delimiter=',') gt_full = np.zeros((np.shape(gt_dropped)[0],np.shape(gt_dropped)[1],len(new_idx))) beginning_motion_full = np.zeros((np.shape(beginning_motion_dropped)[0],np.shape(beginning_motion_dropped)[1],len(new_idx))) predicted_test_full = np.zeros((np.shape(predicted_test_dropped)[0],np.shape(predicted_test_dropped)[1],len(new_idx))) for i in range(np.shape(predicted_test_dropped)[1]): predicted_test_full[:,i,:] = unNormalizeData(predicted_test_dropped[:,i,:],poseDataset.data_mean,poseDataset.data_std,poseDataset.dimensions_to_ignore) gt_full[:,i,:] = unNormalizeData(gt_dropped[:,i,:], poseDataset.data_mean,poseDataset.data_std,poseDataset.dimensions_to_ignore) beginning_motion_full[:, i, :] = unNormalizeData(beginning_motion_dropped[:,i,:], poseDataset.data_mean,poseDataset.data_std,poseDataset.dimensions_to_ignore) val_error = euler_error(predicted_test_full, gt_full) seq_length_out = len(val_error) out = "" for ms in [1,3,7,9,13,24]: if seq_length_out >= ms+1: out += " {0:.3f} |".format( val_error[ms] ) else: out += " n/a |" #error = 0 #for nm in nodeNames: # error+=model.predict_node_loss[nm](predicted_test[nm],Y_test[nm],.5) #print("Model loss :{}".format(error)) return out, predicted_test_full, gt_full