예제 #1
0
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)
예제 #2
0
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)

    run_frank_mocap(args, hand_bbox_detector, body_mocap, hand_mocap)
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")
        args.out_dir = os.path.join(args.out_dir, f"hand_bboxes_{args.th_hands}")

        if not os.path.exists(args.out_dir):
            os.makedirs(args.out_dir)
        elif not args.replace and os.path.exists(os.path.join(args.out_dir, f"finished.marker")):
            print(f"[{i}/{len(lines)-1}] Already processed video -> '{args.out_dir}'")
            continue

        print(f"[{i}/{len(lines)-1}] Processing video '{args.input_path}' -> '{args.out_dir}'")
        run_hand_mocap(args, bbox_detector)
        print(f"[FINISHED] Time: {time.time() - t0} s")

   
if __name__ == '__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"

    #Set Bbox detector
    bbox_detector =  HandBboxDetector(args.view_type, device, th=args.th_hands)

    if args.list:
        run_from_list(args, bbox_detector)
    else:
        root = "/data/sessions_processed/final_dataset/"
        args.out_dir = os.path.join(args.out_dir, args.input_path.replace(root, "").split(".")[0], f"hand_bboxes_{args.th_hands}")
        if not os.path.exists(args.out_dir):
            os.makedirs(args.out_dir)
        run_hand_mocap(args, bbox_detector)