def draw_attention_vector(self, pred_vector1, pred_vector2, img, ax): #save_dir = os.path.join(args.save_dir, 'show_front') #img_name = os.path.basename(img_path) #img = cv.imread(img_path) predx, predy, predz = pred_vector1 #img = np.squeeze(img,axis=0) #print(img.shape) #img = img.reshape((224,224,3)) # draw pred attention vector with red utils.draw_front(img, predy, predz, tdx=None, tdy=None, size=100, color=(0, 0, 255)) predx, predy, predz = pred_vector2 utils.draw_front(img, predy, predz, tdx=None, tdy=None, size=100, color=(0, 255, 0)) #cv.imwrite(os.path.join(save_dir, img_name), img) cv.imshow("test_result", img) utils.draw_3d_coor(pred_vector1, pred_vector2, ax)
def draw_attention_vector(vector_label, pred_vector, img_path, args): #save_dir = os.path.join(args.save_dir, 'show_front') img_name = os.path.basename(img_path) img = cv.imread(img_path) predx, predy, predz = pred_vector #start_x = (pt2d[0].item() + pt2d[2].item()) // 2 #start_y = (pt2d[1].item() + pt2d[3].item()) // 2 # draw GT attention vector with green # if 'DMS_TEST_DATA' in args.test_data.split('/'): # gtx, gty, gtz = vector_label # utils.draw_front(img, gtx, gty, tdx=start_x, tdy=start_y, size=100, color=(0, 255, 0)) # draw GT axis # elif 'AFLW2000QUAT' in args.test_data.split('/'): # pitch, yaw, roll = angle_label # utils.draw_axis(img, pitch, yaw, roll, tdx=start_x, tdy=start_y, size=100) # draw face bbox # utils.draw_bbox(img, pt2d) # draw pred attention vector with red utils.draw_front(img, predy, predz, tdx=None, tdy=None, size=100, color=(0, 0, 255))
def draw_attention_vector(self, pred_vector1, front_vector, img, img_name): #save_dir = os.path.join(args.save_dir, 'show_front') #img_name = os.path.basename(img_path) #img = cv.imread(img_path) predx, predy, predz = pred_vector1 #img = np.squeeze(img,axis=0) #print(img.shape) #img = img.reshape((224,224,3)) # draw pred attention vector with red utils.draw_front(img, predy, predz, tdx=None, tdy=None, size=100, color=(0, 0, 255)) predx, predy, predz = front_vector utils.draw_front(img, predy, predz, tdx=None, tdy=None, size=100, color=(0, 0, 0)) #cv.imwrite(os.path.join(save_dir, img_name), img) cv.imwrite(os.path.join("./visualization/front+label", img_name), img)
def draw_attention_vector(vector_label, pred_vector, img_path, args): #save_dir = os.path.join(args.save_dir, 'show_front') img_name = os.path.basename(img_path) img = cv.imread(img_path) predx, predy, predz = pred_vector # draw pred attention vector with red utils.draw_front(img, predy, predz, tdx=None, tdy=None, size=100, color=(0, 0, 255))
def draw_vectors(self, pred_vector1, pred_vector2, pred_vector3, img, center, width): optimize_v = self.optimizer.Get_Ortho_Vectors(np.array(pred_vector1), np.array(pred_vector2), np.array(pred_vector3)) v1, v2, v3 = optimize_v[0], optimize_v[1], optimize_v[2] # draw vector in blue color predx, predy, predz = v1 utils.draw_front(img, predx, predy, width, tdx=center[0], tdy=center[1], size=100, color=(255, 0, 0)) # draw vector in green color predx, predy, predz = v2 utils.draw_front(img, predx, predy, width, tdx=center[0], tdy=center[1], size=100, color=(0, 255, 0)) # draw vector in red color predx, predy, predz = v3 utils.draw_front(img, predx, predy, width, tdx=center[0], tdy=center[1], size=100, color=(0, 0, 255)) cv.imshow("pose visualization", img)
def draw_attention_vector(self, pred_vector1, pred_vector2, pred_vector3, img, img_name): #save_dir = os.path.join(args.save_dir, 'show_front') #img_name = os.path.basename(img_path) #img = cv.imread(img_path) predx, predy, predz = pred_vector1 utils.draw_front(img, predy, predz, tdx=None, tdy=None, size=100, color=(0, 0, 255)) predx, predy, predz = pred_vector2 utils.draw_front(img, predy, predz, tdx=None, tdy=None, size=100, color=(0, 255, 0)) predx, predy, predz = pred_vector3 utils.draw_front(img, predy, predz, tdx=None, tdy=None, size=100, color=(255, 0, 0)) #cv.imwrite(os.path.join(save_dir, img_name), img) cv.imwrite(os.path.join("./plot", img_name), img)