MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / exec

Method exec

flow-python/examples/application/electric_bicycle/shaper.py:44–67  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

42 return int(l), int(t), int(r), int(b)
43
44 def exec(self):
45 envelope = self.inp.recv()
46 if envelope is None:
47 self._map.clear()
48 return
49
50 msg = envelope.msg
51
52 # push the first
53 msg['shaper'] = []
54 for track in msg['tracks']:
55 tid = track['tid']
56 box = track['bbox']
57 if tid not in self._map:
58 self._map[tid] = dict()
59
60 data = msg['data']
61 l, t, r, b = self.expand(box, data.shape[1], data.shape[0],
62 1.1)
63 crop = data[t:b, l:r]
64 msg['shaper'].append(crop)
65 # cv2.imwrite(f'shaper_{envelope.partial_id}.jpg', crop)
66
67 self.out.send(envelope)

Callers

nothing calls this directly

Calls 4

expandMethod · 0.95
appendMethod · 0.80
recvMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected