()
The evaluator.
The evaluator.
The evaluator .
def main():
    """The evaluator."""

    # Arguments parser
    parser = argparse.ArgumentParser()
    parser.add_argument('--submit', help='prediction json file', type=str,
                        default='keypoint_predictions_example.json')
    parser.add_argument('--ref', help='annotation json file', type=str,
                        default='keypoint_annotations_example.json')
    args = parser.parse_args()

    # Initialize return_dict
    return_dict = dict()
    return_dict['error'] = None
    return_dict['warning'] = []
    return_dict['score'] = None

    # Load annotation JSON file
    start_time = time.time()
    annotations = load_annotations(anno_file=args.ref,
                                   return_dict=return_dict)
    print 'Complete reading annotation JSON file in %.2f seconds.' %(time.time() - start_time)

    # Load prediction JSON file
    start_time = time.time()
    predictions = load_predictions(prediction_file=args.submit,
                                   return_dict=return_dict)
    print 'Complete reading prediction JSON file in %.2f seconds.' %(time.time() - start_time)

    # Keypoint evaluation
    start_time = time.time()
    return_dict = keypoint_eval(predictions=predictions,
                                annotations=annotations,
                                return_dict=return_dict)
    print 'Complete evaluation in %.2f seconds.' %(time.time() - start_time)

    # Print return_dict and final score
    pprint.pprint(return_dict)
    print 'Score: ', '%.8f' % return_dict['score']
def main ( ) : # Arguments parser parser = argparse . ArgumentParser ( ) parser . add_argument ( '--submit' , help = 'prediction json file' , type = str , default = 'keypoint_predictions_example.json' ) parser . add_argument ( '--ref' , help = 'annotation json file' , type = str , default = 'keypoint_annotations_example.json' ) args = parser . parse_args ( ) # Initialize return_dict return_dict = dict ( ) return_dict [ 'error' ] = None return_dict [ 'warning' ] = [ ] return_dict [ 'score' ] = None # Load annotation JSON file start_time = time . time ( ) annotations = load_annotations ( anno_file = args . ref , return_dict = return_dict ) print 'Complete reading annotation JSON file in %.2f seconds.' % ( time . time ( ) - start_time ) # Load prediction JSON file start_time = time . time ( ) predictions = load_predictions ( prediction_file = args . submit , return_dict = return_dict ) print 'Complete reading prediction JSON file in %.2f seconds.' % ( time . time ( ) - start_time ) # Keypoint evaluation start_time = time . time ( ) return_dict = keypoint_eval ( predictions = predictions , annotations = annotations , return_dict = return_dict ) print 'Complete evaluation in %.2f seconds.' % ( time . time ( ) - start_time ) # Print return_dict and final score pprint . pprint ( return_dict ) print 'Score: ' , '%.8f' % return_dict [ 'score' ]