kxqt commited on
Commit
492da6e
1 Parent(s): 1f28384

clean coder

Browse files
Files changed (1) hide show
  1. app.py +0 -4
app.py CHANGED
@@ -31,9 +31,7 @@ hourglass_args = {
31
  }
32
 
33
  def generate_mask(image, generator: SamAutomaticMaskGenerator):
34
- start = time.perf_counter()
35
  generator.predictor.set_image(image)
36
- eta1 = time.perf_counter() - start
37
 
38
  image_size = image.shape[:2]
39
  points_scale = np.array(image_size)[None, ::-1]
@@ -42,14 +40,12 @@ def generate_mask(image, generator: SamAutomaticMaskGenerator):
42
  transformed_points = generator.predictor.transform.apply_coords(points, image_size)
43
  in_points = torch.as_tensor(transformed_points, device=generator.predictor.device)
44
  in_labels = torch.ones(in_points.shape[0], dtype=torch.int, device=in_points.device)
45
- start = time.perf_counter()
46
  masks, iou_preds, _ = generator.predictor.predict_torch(
47
  in_points[:, None, :],
48
  in_labels[:, None],
49
  multimask_output=True,
50
  return_logits=True,
51
  )
52
- eta2 = time.perf_counter() - start
53
 
54
  # Serialize predictions and store in MaskData
55
  data = MaskData(
 
31
  }
32
 
33
  def generate_mask(image, generator: SamAutomaticMaskGenerator):
 
34
  generator.predictor.set_image(image)
 
35
 
36
  image_size = image.shape[:2]
37
  points_scale = np.array(image_size)[None, ::-1]
 
40
  transformed_points = generator.predictor.transform.apply_coords(points, image_size)
41
  in_points = torch.as_tensor(transformed_points, device=generator.predictor.device)
42
  in_labels = torch.ones(in_points.shape[0], dtype=torch.int, device=in_points.device)
 
43
  masks, iou_preds, _ = generator.predictor.predict_torch(
44
  in_points[:, None, :],
45
  in_labels[:, None],
46
  multimask_output=True,
47
  return_logits=True,
48
  )
 
49
 
50
  # Serialize predictions and store in MaskData
51
  data = MaskData(