MCPcopy Create free account
hub / github.com/IDEA-Research/DINO / ColorMap

Class ColorMap

util/visualizer.py:43–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 return img_res.permute(0,3,1,2)
42
43class ColorMap():
44 def __init__(self, basergb=[255,255,0]):
45 self.basergb = np.array(basergb)
46 def __call__(self, attnmap):
47 # attnmap: h, w. np.uint8.
48 # return: h, w, 4. np.uint8.
49 assert attnmap.dtype == np.uint8
50 h, w = attnmap.shape
51 res = self.basergb.copy()
52 res = res[None][None].repeat(h, 0).repeat(w, 1) # h, w, 3
53 attn1 = attnmap.copy()[..., None] # h, w, 1
54 res = np.concatenate((res, attn1), axis=-1).astype(np.uint8)
55 return res
56
57
58class COCOVisualizer():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected