File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
packages/tasks/src/tasks/keypoint-detection Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -36,16 +36,14 @@ model = SuperPointForKeypointDetection.from_pretrained("magic-leap-community/sup
36
36
inputs = processor(image, return_tensors = " pt" ).to(model.device, model.dtype)
37
37
outputs = model(** inputs)
38
38
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()
40
44
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()
48
45
46
+ # plot
49
47
plt.axis(' off' )
50
48
plt.imshow(image)
51
49
plt.scatter(
Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ const taskData: TaskDataCustom = {
37
37
description : "An application that detects hand keypoints in real-time." ,
38
38
id : "datasciencedojo/Hand-Keypoint-Detection-Realtime" ,
39
39
} ,
40
+ {
41
+ description : "An application to try a universal keypoint detection model." ,
42
+ id : "merve/SuperPoint" ,
43
+ } ,
40
44
] ,
41
45
summary : "Keypoint detection is the task of identifying meaningful distinctive points or features in an image." ,
42
46
widgetModels : [ ] ,
You can’t perform that action at this time.
0 commit comments