MCPcopy Create free account
hub / github.com/Sense-X/Co-DETR / makebarplot

Function makebarplot

tools/analysis_tools/coco_error_analysis.py:73–105  ·  view source on GitHub ↗
(rs, ps, outDir, class_name, iou_type)

Source from the content-addressed store, hash-verified

71
72
73def makebarplot(rs, ps, outDir, class_name, iou_type):
74 areaNames = ['allarea', 'small', 'medium', 'large']
75 types = ['C75', 'C50', 'Loc', 'Sim', 'Oth', 'BG', 'FN']
76 fig, ax = plt.subplots()
77 x = np.arange(len(areaNames)) # the areaNames locations
78 width = 0.60 # the width of the bars
79 rects_list = []
80 figure_title = iou_type + '-' + class_name + '-' + 'ap bar plot'
81 for i in range(len(types) - 1):
82 type_ps = ps[i, ..., 0]
83 aps = [ps_.mean() for ps_ in type_ps.T]
84 rects_list.append(
85 ax.bar(
86 x - width / 2 + (i + 1) * width / len(types),
87 aps,
88 width / len(types),
89 label=types[i],
90 ))
91
92 # Add some text for labels, title and custom x-axis tick labels, etc.
93 ax.set_ylabel('Mean Average Precision (mAP)')
94 ax.set_title(figure_title)
95 ax.set_xticks(x)
96 ax.set_xticklabels(areaNames)
97 ax.legend()
98
99 # Add score texts over bars
100 for rects in rects_list:
101 autolabel(ax, rects)
102
103 # Save plot
104 fig.savefig(outDir + f'/{figure_title}.png')
105 plt.close(fig)
106
107
108def get_gt_area_group_numbers(cocoEval):

Callers 1

analyze_resultsFunction · 0.85

Calls 1

autolabelFunction · 0.85

Tested by

no test coverage detected