def main(): args = DemoOptions().parse() args.use_smplx = True device = torch.device( 'cuda') if torch.cuda.is_available() else torch.device('cpu') assert torch.cuda.is_available(), "Current version only supports GPU" hand_bbox_detector = HandBboxDetector('third_view', device) #Set Mocap regressor body_mocap = BodyMocap(args.checkpoint_body_smplx, args.smpl_dir, device=device, use_smplx=True) hand_mocap = HandMocap(args.checkpoint_hand, args.smpl_dir, device=device) # Set Visualizer if args.renderer_type in ['pytorch3d', 'opendr']: from renderer.screen_free_visualizer import Visualizer else: from renderer.visualizer import Visualizer visualizer = Visualizer(args.renderer_type) run_frank_mocap(args, hand_bbox_detector, body_mocap, hand_mocap, visualizer)
def main(args): args.use_smplx = True device = torch.device( 'cuda') if torch.cuda.is_available() else torch.device('cpu') assert torch.cuda.is_available(), "Current version only supports GPU" #Set Bbox detector bbox_detector = HandBboxDetector(args.view_type, device) # Set Mocap regressor hand_mocap = HandMocap(args.checkpoint_hand, args.smpl_dir, device=device) # Set Visualizer if args.renderer_type in ['pytorch3d', 'opendr']: from renderer.screen_free_visualizer import Visualizer else: from renderer.visualizer import Visualizer visualizer = Visualizer(args.renderer_type) args.out_dir = os.path.join( "/output/annotations/", args.input_path.replace("/data/sessions_processed/final_dataset/", "").split(".")[0], f"hand_bboxes_0.2") print(args.out_dir) assert os.path.exists(args.out_dir) # run run_hand_mocap(args, bbox_detector, hand_mocap, visualizer)
def __init__(self): self.args = DemoOptions().parse() self.args.use_smplx = True self.args.save_pred_pkl = True self.device = torch.device( 'cuda') if torch.cuda.is_available() else torch.device('cpu') self.bbox_detector = HandBboxDetector(self.args.view_type, self.device) self.hand_mocap = HandMocap(self.args.checkpoint_hand, self.args.smpl_dir, device=self.device) self.visualizer = Visualizer(self.args.renderer_type)
def run_from_list(args): assert os.path.exists(args.list) with open(args.list, "r") as f: lines = f.readlines() args.save_frame = False args.no_video_out = True args.use_smplx = True device = torch.device( 'cuda') if torch.cuda.is_available() else torch.device('cpu') assert torch.cuda.is_available(), "Current version only supports GPU" #Set Bbox detector bbox_detector = HandBboxDetector(args.view_type, device) # Set Mocap regressor hand_mocap = HandMocap(args.checkpoint_hand, args.smpl_dir, device=device) # Set Visualizer if args.renderer_type in ['pytorch3d', 'opendr']: from renderer.screen_free_visualizer import Visualizer else: from renderer.visualizer import Visualizer visualizer = Visualizer(args.renderer_type) for i in range(1, len(lines)): t0 = time.time() path = lines[i].replace("\n", "") session, task = (path.split(".")[0]).split("/")[-2:] args.input_path = path args.out_dir = f"/output/annotations/{session}/{task}/hand_bboxes_0.2/" if not args.replace and os.path.exists( os.path.join(args.out_dir, MARKER)): print( f"[{i}/{len(lines)-1}] Landmarks already extracted for this video -> '{args.out_dir}'" ) continue print( f"[{i}/{len(lines)-1}] Extracting hand landmarks of '{session} - {task}'" ) # run run_hand_mocap(args, bbox_detector, hand_mocap, visualizer) print(f"[FINISHED] Time: {time.time() - t0} s")
def main(): args = DemoOptions().parse() # load pkl files pkl_files = gnu.get_all_files(args.pkl_dir, ".pkl", "full") # get smpl type demo_type, smpl_type = __get_data_type(pkl_files) # get smpl model smpl_model = __get_smpl_model(demo_type, smpl_type) # Set Visualizer assert args.renderer_type in ['pytorch3d', 'opendr'], \ f"{args.renderer_type} not implemented yet." from renderer.screen_free_visualizer import Visualizer visualizer = Visualizer(args.renderer_type) # load smpl model visualize_prediction(args, demo_type, smpl_type, smpl_model, pkl_files, visualizer)
def main(): args = DemoOptions().parse() args.use_smplx = True device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu") #Set Mocap regressor if not torch.cuda.is_available(): hand_bbox_detector = HandBboxDetector_cpu("third_view", device) body_mocap = BodyMocap_cpu(args.checkpoint_body_smplx, args.smpl_dir, device = device, use_smplx= True) hand_mocap = HandMocap_cpu(args.checkpoint_hand, args.smpl_dir, device = device) # Set Visualizer if args.renderer_type in ['pytorch3d', 'opendr']: from renderer.screen_free_visualizer import Visualizer else: from renderer.visualizer import Visualizer visualizer = Visualizer(args.renderer_type) run_frank_mocap_cpu(args, hand_bbox_detector, body_mocap, hand_mocap,visualizer) else: print("This is the CPU beta version")
def main(): args = DemoOptions().parse() device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu') assert torch.cuda.is_available(), "Current version only supports GPU" # Set bbox detector body_bbox_detector = BodyPoseEstimator() # Set mocap regressor use_smplx = args.use_smplx checkpoint_path = args.checkpoint_body_smplx if use_smplx else args.checkpoint_body_smpl print("use_smplx", use_smplx) body_mocap = BodyMocap(checkpoint_path, args.smpl_dir, device, use_smplx) # Set Visualizer if args.renderer_type in ['pytorch3d', 'opendr']: from renderer.screen_free_visualizer import Visualizer else: from renderer.visualizer import Visualizer visualizer = Visualizer(args.renderer_type) run_body_mocap(args, body_bbox_detector, body_mocap, visualizer)