Execute inference on a batch of images. :param batch: A numpy array holding the image batch. :return A list of outputs as numpy arrays.
(self, batch)
| 114 | return specs |
| 115 | |
| 116 | def infer(self, batch): |
| 117 | """ |
| 118 | Execute inference on a batch of images. |
| 119 | :param batch: A numpy array holding the image batch. |
| 120 | :return A list of outputs as numpy arrays. |
| 121 | """ |
| 122 | # Copy I/O and Execute |
| 123 | common.memcpy_host_to_device(self.inputs[0]['allocation'], batch) |
| 124 | self.context.execute_v2(self.allocations) |
| 125 | for o in range(len(self.outputs)): |
| 126 | common.memcpy_device_to_host(self.outputs[o]['host_allocation'], self.outputs[o]['allocation']) |
| 127 | return [o['host_allocation'] for o in self.outputs] |
| 128 | |
| 129 | def process(self, batch, scales=None, nms_threshold=None): |
| 130 | """ |