| 192 | return dets[0] |
| 193 | |
| 194 | def merge_outputs(self, detections): |
| 195 | results = {} |
| 196 | for j in range(1, self.opt.num_classes + 1): |
| 197 | results[j] = np.concatenate( |
| 198 | [detection[j] for detection in detections], axis=0).astype(np.float32) |
| 199 | |
| 200 | scores = np.hstack( |
| 201 | [results[j][:, 4] for j in range(1, self.opt.num_classes + 1)]) |
| 202 | if len(scores) > self.max_per_image: |
| 203 | kth = len(scores) - self.max_per_image |
| 204 | thresh = np.partition(scores, kth)[kth] |
| 205 | for j in range(1, self.opt.num_classes + 1): |
| 206 | keep_inds = (results[j][:, 4] >= thresh) |
| 207 | results[j] = results[j][keep_inds] |
| 208 | return results |
| 209 | |
| 210 | def update(self, im_blob, img0): |
| 211 | self.frame_id += 1 |