ianpan commited on
Commit
e13a1c5
·
verified ·
1 Parent(s): 9a118e1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -4
README.md CHANGED
@@ -57,15 +57,16 @@ Example usage:
57
 
58
  ```
59
  import cv2
 
60
  from transformers import AutoModel
61
 
62
- def crop_mammo(img, crop_model, device):
63
- img_shape = torch.tensor([img.shape[:2]])
64
- x = crop_model.preprocess(img)
65
  x = torch.from_numpy(x).expand(1, 1, -1, -1).float().to(device)
66
  with torch.inference_mode():
67
  coords = model(x, img_shape)
68
- coords = coords[0].numpy()
69
  x, y, w, h = coords
70
  return img[y: y + h, x: x + w]
71
 
 
57
 
58
  ```
59
  import cv2
60
+ import torch
61
  from transformers import AutoModel
62
 
63
+ def crop_mammo(img, model, device):
64
+ img_shape = torch.tensor([img.shape[:2]]).to(device)
65
+ x = model.preprocess(img)
66
  x = torch.from_numpy(x).expand(1, 1, -1, -1).float().to(device)
67
  with torch.inference_mode():
68
  coords = model(x, img_shape)
69
+ coords = coords[0].cpu().numpy()
70
  x, y, w, h = coords
71
  return img[y: y + h, x: x + w]
72