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
3636inputs =  processor(image, return_tensors = " pt"  ).to(model.device, model.dtype)
3737outputs =  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()
4044image_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
4947plt.axis(' off'  )
5048plt.imshow(image)
5149plt.scatter(
Original file line number Diff line number Diff 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 : [ ] , 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments