MCPcopy Index your code
hub / github.com/ActiveVisionLab/DFNet / get_error_in_q

Function get_error_in_q

script/dm/pose_model.py:162–191  ·  view source on GitHub ↗

Convert Rotation matrix to quaternion, then calculate the location errors. original from PoseNet Paper

(args, dl, model, sample_size, device, batch_size=1)

Source from the content-addressed store, hash-verified

160
161# # pytorch
162def get_error_in_q(args, dl, model, sample_size, device, batch_size=1):
163 ''' Convert Rotation matrix to quaternion, then calculate the location errors. original from PoseNet Paper '''
164 model.eval()
165
166 results = np.zeros((sample_size, 2))
167 results, vis_info = compute_error_in_q(args, dl, model, device, results, batch_size)
168 median_result = np.median(results,axis=0)
169 mean_result = np.mean(results,axis=0)
170
171 # standard log
172 print ('Median error {}m and {} degrees.'.format(median_result[0], median_result[1]))
173 print ('Mean error {}m and {} degrees.'.format(mean_result[0], mean_result[1]))
174
175 # timing log
176 #print ('Avg execution time (sec): {:.3f}'.format(np.mean(time_spent)))
177
178 # standard log2
179 # num_translation_less_5cm = np.asarray(np.where(results[:,0]<0.05))[0]
180 # num_rotation_less_5 = np.asarray(np.where(results[:,1]<5))[0]
181 # print ('translation error less than 5cm {}/{}.'.format(num_translation_less_5cm.shape[0], results.shape[0]))
182 # print ('rotation error less than 5 degree {}/{}.'.format(num_rotation_less_5.shape[0], results.shape[0]))
183 # print ('results:', results)
184
185 # save for direct-pn paper log
186 # if 0:
187 # filename='Direct-PN+U_' + args.datadir.split('/')[-1] + '_result.txt'
188 # np.savetxt(filename, predict_pose)
189
190 # visualize results
191 # vis_pose(vis_info)
192
193class EfficientNetB3(nn.Module):
194 ''&#x27; EfficientNet-B3 backbone,

Callers 3

train_nerf_trackingFunction · 0.90
train_feature_matchingFunction · 0.90
train_posenetFunction · 0.70

Calls 1

compute_error_in_qFunction · 0.70

Tested by

no test coverage detected