Spaces:
Sleeping
Sleeping
Koni commited on
Commit ·
c22b52f
1
Parent(s): 609f003
fix: numpy float issue
Browse files
app.py
CHANGED
|
@@ -101,8 +101,8 @@ def run_inference(image: np.ndarray, model_name: str) -> tuple[np.ndarray, str]:
|
|
| 101 |
heatmaps = F.sigmoid(output).cpu().squeeze(0)
|
| 102 |
c, h, w = heatmaps.shape
|
| 103 |
heatmaps = heatmaps.view(c, -1).argmax(dim=1).numpy()
|
| 104 |
-
ys = (heatmaps // w).
|
| 105 |
-
xs = (heatmaps % w).
|
| 106 |
kps = np.stack([xs, ys], axis=1)
|
| 107 |
kps = kps[np.newaxis]
|
| 108 |
kp_img = draw_keypoints(img, kps, f"{model_name} — heatmap-based")
|
|
|
|
| 101 |
heatmaps = F.sigmoid(output).cpu().squeeze(0)
|
| 102 |
c, h, w = heatmaps.shape
|
| 103 |
heatmaps = heatmaps.view(c, -1).argmax(dim=1).numpy()
|
| 104 |
+
ys = (heatmaps // w).astype(float) / (h / 2) - 1
|
| 105 |
+
xs = (heatmaps % w).astype(float) / (w / 2) - 1
|
| 106 |
kps = np.stack([xs, ys], axis=1)
|
| 107 |
kps = kps[np.newaxis]
|
| 108 |
kp_img = draw_keypoints(img, kps, f"{model_name} — heatmap-based")
|