MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / draw_final_outputs

Function draw_final_outputs

examples/FasterRCNN/viz.py:71–96  ·  view source on GitHub ↗

Args: results: [DetectionResult]

(img, results)

Source from the content-addressed store, hash-verified

69
70
71def draw_final_outputs(img, results):
72 """
73 Args:
74 results: [DetectionResult]
75 """
76 if len(results) == 0:
77 return img
78
79 # Display in largest to smallest order to reduce occlusion
80 boxes = np.asarray([r.box for r in results])
81 areas = np_area(boxes)
82 sorted_inds = np.argsort(-areas)
83
84 ret = img
85 tags = []
86
87 for result_id in sorted_inds:
88 r = results[result_id]
89 if r.mask is not None:
90 ret = draw_mask(ret, r.mask)
91
92 for r in results:
93 tags.append(
94 "{},{:.2f}".format(cfg.DATA.CLASS_NAMES[r.class_id], r.score))
95 ret = viz.draw_boxes(ret, boxes, tags)
96 return ret
97
98
99def draw_final_outputs_blackwhite(img, results):

Callers 2

do_visualizeFunction · 0.90
do_predictFunction · 0.90

Calls 3

draw_maskFunction · 0.85
appendMethod · 0.80
formatMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…