(dets, c, s, opt)
| 21 | |
| 22 | |
| 23 | def ddd_post_process_2d(dets, c, s, opt): |
| 24 | # dets: batch x max_dets x dim |
| 25 | # return 1-based class det list |
| 26 | ret = [] |
| 27 | include_wh = dets.shape[2] > 16 |
| 28 | for i in range(dets.shape[0]): |
| 29 | top_preds = {} |
| 30 | dets[i, :, :2] = transform_preds( |
| 31 | dets[i, :, 0:2], c[i], s[i], (opt.output_w, opt.output_h)) |
| 32 | classes = dets[i, :, -1] |
| 33 | for j in range(opt.num_classes): |
| 34 | inds = (classes == j) |
| 35 | top_preds[j + 1] = np.concatenate([ |
| 36 | dets[i, inds, :3].astype(np.float32), |
| 37 | get_alpha(dets[i, inds, 3:11])[:, np.newaxis].astype(np.float32), |
| 38 | get_pred_depth(dets[i, inds, 11:12]).astype(np.float32), |
| 39 | dets[i, inds, 12:15].astype(np.float32)], axis=1) |
| 40 | if include_wh: |
| 41 | top_preds[j + 1] = np.concatenate([ |
| 42 | top_preds[j + 1], |
| 43 | transform_preds( |
| 44 | dets[i, inds, 15:17], c[i], s[i], (opt.output_w, opt.output_h)) |
| 45 | .astype(np.float32)], axis=1) |
| 46 | ret.append(top_preds) |
| 47 | return ret |
| 48 | |
| 49 | def ddd_post_process_3d(dets, calibs): |
| 50 | # dets: batch x max_dets x dim |
no test coverage detected