Merge model outputs directly in graph.

This commit is contained in:
Daniel
2025-01-17 18:33:19 +01:00
parent 97ea039f7d
commit 8f2322694a
3 changed files with 115 additions and 57 deletions

View File

@ -338,9 +338,8 @@ class RTMDet(BaseModel):
def postprocess(self, result: List[np.ndarray], image: np.ndarray):
boxes = np.squeeze(result[0], axis=0)
classes = np.squeeze(result[1], axis=0)
human_class = classes[:] == 0
human_class = boxes[:, 5] == 0
boxes = boxes[human_class]
keep = boxes[:, 4] > self.conf_threshold
@ -408,10 +407,7 @@ class RTMPose(BaseModel):
):
kpts = []
for i in range(len(bboxes)):
scores = np.clip(result[1][i], 0, 1)
kp = np.concatenate(
[result[0][i], np.expand_dims(scores, axis=-1)], axis=-1
)
kp = result[0][i]
paddings, scale, bbox, _ = self.boxcrop.calc_params(image.shape, bboxes[i])
kp[:, 0] -= paddings[0]