Пример #1
0
    cmd_args = parser.parse_args()

    image_folder = cmd_args.image_folder
    show = cmd_args.show
    output_folder = cmd_args.output_folder
    pause = cmd_args.pause
    focal_length = cmd_args.focal_length
    save_vis = cmd_args.save_vis
    save_params = cmd_args.save_params
    save_mesh = cmd_args.save_mesh
    degrees = cmd_args.degrees
    expose_batch = cmd_args.expose_batch
    rcnn_batch = cmd_args.rcnn_batch

    cfg.merge_from_file(cmd_args.exp_cfg)
    cfg.merge_from_list(cmd_args.exp_opts)

    cfg.datasets.body.batch_size = expose_batch

    cfg.is_training = False
    cfg.datasets.body.splits.test = cmd_args.datasets
    use_face_contour = cfg.datasets.use_face_contour
    set_face_contour(cfg, use_face_contour=use_face_contour)

    with threadpool_limits(limits=1):
        main(
            image_folder,
            cfg,
            show=show,
            demo_output_folder=output_folder,
            pause=pause,
Пример #2
0
def execute(args):
    try:
        logger.info('人物姿勢推定開始: {0}',
                    args.img_dir,
                    decoration=MLogger.DECORATION_BOX)

        if not os.path.exists(args.img_dir):
            logger.error("指定された処理用ディレクトリが存在しません。: {0}",
                         args.img_dir,
                         decoration=MLogger.DECORATION_BOX)
            return False

        torch.backends.cudnn.benchmark = True
        torch.backends.cudnn.deterministic = False

        parser = get_parser()
        argv = parser.parse_args(args=[])

        show = argv.show
        pause = argv.pause
        focal_length = argv.focal_length
        save_vis = argv.save_vis
        save_params = argv.save_params
        save_mesh = argv.save_mesh
        degrees = argv.degrees
        expose_batch = argv.expose_batch
        rcnn_batch = argv.rcnn_batch

        cfg.merge_from_file(argv.exp_cfg)
        cfg.merge_from_list(argv.exp_opts)

        cfg.datasets.body.batch_size = expose_batch

        cfg.is_training = False
        cfg.datasets.body.splits.test = argv.datasets
        use_face_contour = cfg.datasets.use_face_contour
        set_face_contour(cfg, use_face_contour=use_face_contour)

        output_folder = os.path.join(args.img_dir, "pose")

        result = False
        with threadpool_limits(limits=1):
            result = main(
                args,
                cfg,
                show=show,
                output_folder=output_folder,
                pause=pause,
                focal_length=focal_length,
                save_vis=save_vis,
                save_mesh=save_mesh,
                save_params=save_params,
                degrees=degrees,
                rcnn_batch=rcnn_batch,
            )

        logger.info('人物姿勢推定終了: {0}',
                    args.img_dir,
                    decoration=MLogger.DECORATION_BOX)

        return result
    except Exception as e:
        logger.critical("姿勢推定で予期せぬエラーが発生しました。",
                        e,
                        decoration=MLogger.DECORATION_BOX)
        return False