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

Method exec

flow-python/examples/application/cat_finder/reid_image.py:33–52  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

31 logger.info("Image Reid loaded.")
32
33 def exec(self):
34 envelope = self.inp.recv()
35 if envelope is None:
36 return
37 image = envelope.msg
38
39 data = image['data']
40 items = image['items']
41 assert isinstance(items, list)
42
43 for item in items:
44 bbox = item['bbox']
45 crop = data[round(bbox[1]):round(bbox[3]),
46 round(bbox[0]):round(bbox[2])]
47
48 # cv2.imwrite(f'reid_image_{envelope.partial_id}.jpg', crop)
49 feature = self._model.inference(crop)
50 item['feature'] = feature
51 logger.info(f'feature {feature}')
52 self.out.send(envelope)

Callers

nothing calls this directly

Calls 4

recvMethod · 0.45
inferenceMethod · 0.45
infoMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected