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

Function draw_annotation

examples/FasterRCNN/viz.py:15–35  ·  view source on GitHub ↗

Will not modify img

(img, boxes, klass, polygons=None, is_crowd=None)

Source from the content-addressed store, hash-verified

13
14
15def draw_annotation(img, boxes, klass, polygons=None, is_crowd=None):
16 """Will not modify img"""
17 labels = []
18 assert len(boxes) == len(klass)
19 if is_crowd is not None:
20 assert len(boxes) == len(is_crowd)
21 for cls, crd in zip(klass, is_crowd):
22 clsname = cfg.DATA.CLASS_NAMES[cls]
23 if crd == 1:
24 clsname += ';Crowd'
25 labels.append(clsname)
26 else:
27 for cls in klass:
28 labels.append(cfg.DATA.CLASS_NAMES[cls])
29 img = viz.draw_boxes(img, boxes, labels)
30
31 if polygons is not None:
32 for p in polygons:
33 mask = polygons_to_mask(p, img.shape[0], img.shape[1])
34 img = draw_mask(img, mask)
35 return img
36
37
38def draw_proposal_recall(img, proposals, proposal_scores, gt_boxes):

Callers 2

do_visualizeFunction · 0.90
balloon.pyFile · 0.90

Calls 3

polygons_to_maskFunction · 0.90
draw_maskFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…