Exemplo n.º 1
0
    parser.add_argument('--config', type=str, default=None)

    args = parser.parse_args()

    return args


if __name__ == "__main__":
    # configuration
    configuration = get_configuration(AttentionMapNetConfigurator(),
                                      get_args())

    # model
    feature_extractor = models.resnet34(pretrained=True)
    if configuration.model == "SEAttentionPoseNet":
        posenet = SEAttentionPoseNet(resnet=feature_extractor,
                                     config=configuration,
                                     drop_rate=configuration.dropout)
    elif configuration.model == "LearnGAPoseNet":
        posenet = LearnGAPoseNet(feature_extractor=feature_extractor,
                                 drop_rate=configuration.dropout)

    dataloader = get_dataloader(configuration)

    evaluator = Evaluator(config=configuration,
                          model=posenet,
                          dataloader=dataloader)

    evaluator.run()
Exemplo n.º 2
0
    feature_extractor = models.resnet34(pretrained=False)
    if configuration.model == "mapnet" or configuration.model == "posenet":
        model = PoseNet(feature_extractor, drop_rate=configuration.dropout)
    else:
        model = SEAttentionPoseNet(resnet=feature_extractor,
                                   config=configuration,
                                   drop_rate=configuration.dropout)

    # data
    dataloader = get_dataloader(configuration)

    # read mean and stdev for un-normalizing predictions
    pose_stats_file = osp.join(configuration.preprocessed_data_path,
                               'pose_stats.txt')
    pose_m, pose_s = np.loadtxt(pose_stats_file)  # mean and stdev

    configuration.dataset_length = len(dataloader.dataset)
    configuration.pose_m = pose_m
    configuration.pose_s = pose_s

    if not args.var:
        evaluator = Evaluator(config=configuration,
                              model=model,
                              dataloader=dataloader)
    else:
        evaluator = VarEvaluator(config=configuration,
                                 model=model,
                                 dataloader=dataloader)

    evaluator.run(False)