jhj0517 commited on
Commit
8d612b7
1 Parent(s): 5f8864d

Add logger

Browse files
Files changed (1) hide show
  1. modules/sam_inference.py +4 -3
modules/sam_inference.py CHANGED
@@ -52,9 +52,9 @@ class SamInference:
52
  model_path = os.path.join(self.model_dir, filename)
53
 
54
  if not is_sam_exist(self.model_type):
55
- print(f"\nNo SAM2 model found, downloading {self.model_type} model...")
56
  download_sam_model_url(self.model_type)
57
- print("\nApplying configs to model..")
58
 
59
  try:
60
  self.model = build_sam2(
@@ -63,7 +63,8 @@ class SamInference:
63
  device=self.device
64
  )
65
  except Exception as e:
66
- print(f"Error while Loading SAM2 model! {e}")
 
67
 
68
  def generate_mask(self,
69
  image: np.ndarray,
 
52
  model_path = os.path.join(self.model_dir, filename)
53
 
54
  if not is_sam_exist(self.model_type):
55
+ logger.info(f"No SAM2 model found, downloading {self.model_type} model...")
56
  download_sam_model_url(self.model_type)
57
+ logger.info(f"Applying configs to model..")
58
 
59
  try:
60
  self.model = build_sam2(
 
63
  device=self.device
64
  )
65
  except Exception as e:
66
+ logger.exception("Error while auto generating masks")
67
+ raise f"Error while Loading SAM2 model! {e}"
68
 
69
  def generate_mask(self,
70
  image: np.ndarray,