def histogram_areas_AP(dict_areas_AP=None): if dict_areas_AP is None: with open('pickles/dict_areas_AP.pkl', 'rb') as cls_pkl: dict_areas_AP = pickle.load(cls_pkl) for key, value in dict_areas_AP.items(): AP = np.mean(value) if math.isnan(AP): dict_areas_AP[key] = 0 else: dict_areas_AP[key] = AP # dict_areas_AP[key] = 0 # dict_areas_AP[key] = np.mean(value) print(dict_areas_AP) mAP = dict_areas_AP['mAP'] dict_areas_AP.pop('mAP') n_classes = len(dict_areas_AP.keys()) window_title = "AP per area" plot_title = "mAP = {0:.2f}%".format(mAP * 100) x_label = "Average Precision" output_path = "output/areas_AP.png" to_show = False plot_color = 'royalblue' draw_plot_func(dict_areas_AP, n_classes, window_title, plot_title, x_label, output_path, to_show, plot_color, "")
def histogram_areas(dict_areas=None): if dict_areas is None: with open('pickles/dict_areas.pkl', 'rb') as areas_pkl: dict_areas = pickle.load(areas_pkl) window_title = "areas" plot_title = "number of objects per areas" x_label = "number of objects per area" output_path = "output/areas_wide.png" to_show = True plot_color = 'forestgreen' draw_plot_func(dict_areas, len(dict_areas.keys()), window_title, plot_title, x_label, output_path, to_show, plot_color, "")
def histogram_resolutions_img(dict_res_img=None): if dict_res_img is None: with open('pickles/dict_res_img_images.pkl', 'rb') as gt_pkl: dict_res_img = pickle.load(gt_pkl) classes = load_classes('data/autel.resolutions') window_title = "img/resolution" plot_title = "num images per resolution" x_label = "num images" output_path = "output/resolution_img_08072018.png" to_show = True plot_color = 'royalblue' draw_plot_func(dict_res_img, len(classes), window_title, plot_title, x_label, output_path, to_show, plot_color, "")
def histogram_resolutions_videos(dict_res_video=None): if dict_res_video is None: with open('pickles/dict_res_videos_images.pkl', 'rb') as gt_pkl: dict_res_video = pickle.load(gt_pkl) for key, values in dict_res_video.items(): dict_res_video[key] = len(values) classes = load_classes('data/autel.resolutions') window_title = "ground truth" plot_title = "number videos per resolution" x_label = "num videos" output_path = "output/resolution_videos_08072018.png" to_show = True plot_color = 'royalblue' draw_plot_func(dict_res_video, len(classes), window_title, plot_title, x_label, output_path, to_show, plot_color, "")
def histogram_classes_gt(dict_gt=None): if dict_gt is None: with open('pickle/dict_gt.pkl', 'rb') as gt_pkl: dict_gt = pickle.load(gt_pkl) classes = load_classes('data/autel.names') gt_path = '/home/alupotto/data/autel/new_labels' gt_list = glob.glob("{}/*.txt".format(gt_path)) window_title = "ground truth" plot_title = "Ground-Truth\n" plot_title += "(" + str(len(gt_list)) + " files and " + str( len(classes)) + " classes)" x_label = "number ground truth objects" output_path = "output/ground_truth.png" to_show = False plot_color = 'forestgreen' draw_plot_func(dict_gt, len(classes), window_title, plot_title, x_label, output_path, to_show, plot_color, "") return dict_gt
def histogram_classes_AP(dict_classes=None): if dict_classes is None: with open('pickles/dict_classes.pkl', 'rb') as cls_pkl: dict_classes = pickle.load(cls_pkl) classes = load_classes('data/autel.names') for key, value in dict_classes.items(): dict_classes[key] = np.mean(value) mAP = dict_classes['mAP'] dict_classes.pop('mAP') window_title = "AP per class" plot_title = "mAP = {0:.2f}%".format(mAP * 100) x_label = "Average Precision" output_path = "output/classes_AP.png" to_show = True plot_color = 'royalblue' draw_plot_func(dict_classes, len(classes), window_title, plot_title, x_label, output_path, to_show, plot_color, "") return dict_classes
def histogram_classes_gt(imgs_path, dict_gt=None): if dict_gt is None: with open('pickles/dict_part1_autel.pkl', 'rb') as gt_pkl: dict_gt = pickle.load(gt_pkl) print(dict_gt) classes = load_classes('data/autel.names') # load images img_files = sorted(glob.glob('%s/*.jpg' % imgs_path)) print(len(img_files)) window_title = "ground truth" plot_title = "Ground-Truth\n" plot_title += "(" + str(len(img_files)) + " files and " + str( len(classes)) + " classes)" x_label = "number ground truth objects" output_path = "output/ground_truth_08072018.png" to_show = True plot_color = 'forestgreen' draw_plot_func(dict_gt, len(classes), window_title, plot_title, x_label, output_path, to_show, plot_color, "")