Skip to content

Commit cc01ed5

Browse files
Tasks: additions to keypoint detection task page (#890)
Co-authored-by: VB <[email protected]>
1 parent f900503 commit cc01ed5

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

packages/tasks/src/tasks/keypoint-detection/about.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,14 @@ model = SuperPointForKeypointDetection.from_pretrained("magic-leap-community/sup
3636
inputs = processor(image, return_tensors="pt").to(model.device, model.dtype)
3737
outputs = model(**inputs)
3838

39-
# visualize the output
39+
# postprocess
40+
image_sizes = [(image.size[1], image.size[0])]
41+
outputs = processor.post_process_keypoint_detection(model_outputs, image_sizes)
42+
keypoints = outputs[0]["keypoints"].detach().numpy()
43+
scores = outputs[0]["scores"].detach().numpy()
4044
image_width, image_height = image.size
41-
image_mask = outputs.mask
42-
image_indices = torch.nonzero(image_mask).squeeze()
43-
44-
image_scores = outputs.scores.squeeze()
45-
image_keypoints = outputs.keypoints.squeeze()
46-
keypoints = image_keypoints.detach().numpy()
47-
scores = image_scores.detach().numpy()
4845

46+
# plot
4947
plt.axis('off')
5048
plt.imshow(image)
5149
plt.scatter(

packages/tasks/src/tasks/keypoint-detection/data.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ const taskData: TaskDataCustom = {
3737
description: "An application that detects hand keypoints in real-time.",
3838
id: "datasciencedojo/Hand-Keypoint-Detection-Realtime",
3939
},
40+
{
41+
description: "An application to try a universal keypoint detection model.",
42+
id: "merve/SuperPoint",
43+
},
4044
],
4145
summary: "Keypoint detection is the task of identifying meaningful distinctive points or features in an image.",
4246
widgetModels: [],

0 commit comments

Comments
 (0)