Skip to content

Commit

Permalink
Tasks: additions to keypoint detection task page (#890)
Browse files Browse the repository at this point in the history
Co-authored-by: VB <[email protected]>
  • Loading branch information
merveenoyan and Vaibhavs10 authored Sep 17, 2024
1 parent f900503 commit cc01ed5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/tasks/src/tasks/keypoint-detection/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,14 @@ model = SuperPointForKeypointDetection.from_pretrained("magic-leap-community/sup
inputs = processor(image, return_tensors="pt").to(model.device, model.dtype)
outputs = model(**inputs)

# visualize the output
# postprocess
image_sizes = [(image.size[1], image.size[0])]
outputs = processor.post_process_keypoint_detection(model_outputs, image_sizes)
keypoints = outputs[0]["keypoints"].detach().numpy()
scores = outputs[0]["scores"].detach().numpy()
image_width, image_height = image.size
image_mask = outputs.mask
image_indices = torch.nonzero(image_mask).squeeze()

image_scores = outputs.scores.squeeze()
image_keypoints = outputs.keypoints.squeeze()
keypoints = image_keypoints.detach().numpy()
scores = image_scores.detach().numpy()

# plot
plt.axis('off')
plt.imshow(image)
plt.scatter(
Expand Down
4 changes: 4 additions & 0 deletions packages/tasks/src/tasks/keypoint-detection/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ const taskData: TaskDataCustom = {
description: "An application that detects hand keypoints in real-time.",
id: "datasciencedojo/Hand-Keypoint-Detection-Realtime",
},
{
description: "An application to try a universal keypoint detection model.",
id: "merve/SuperPoint",
},
],
summary: "Keypoint detection is the task of identifying meaningful distinctive points or features in an image.",
widgetModels: [],
Expand Down

0 comments on commit cc01ed5

Please sign in to comment.