total_l2_loss = 0 total_overlap = 0 total_overlap_score = 0 total_time = 0 num_of_images = 0 for fn in image_names: if not (fn.endswith("jpg") or fn.endswith("JPG")): continue print(fn) image = cv2.imread(os.path.join(test_path, fn), 3) points, time = model.predict_points(image) label = evaluator.get_label_by_image_name(fn) # l1_loss, _ = evaluator.error_func['L1'](label, points) # print( 'L1_loss = {}'.format(l1_loss)) # l2_loss, _ = evaluator.error_func['L2'](label, points) # print( 'L2_loss = {}'.format(l2_loss)) try: overlap, overlap_score = evaluator.error_func['overlap'](points, label, threshold=0.8) except: overlap = 0 overlap_score = 0 print('overlap = {}'.format(overlap))