John Ho commited on
Commit
41fa610
·
1 Parent(s): 18aa4a5

added in kernels and fixed bug in mask data type

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. requirements.txt +1 -0
app.py CHANGED
@@ -31,7 +31,7 @@ DTYPE = (
31
  if torch.cuda.is_available() and torch.cuda.is_bf16_supported()
32
  else torch.float16
33
  )
34
- DEVICE = "cuda"
35
  logger.info(f"Device: {DEVICE}, dtype: {DTYPE}")
36
  logger.info("Loading Models and Processors...")
37
  try:
@@ -187,6 +187,7 @@ def video_inference(input_video, prompt: str):
187
  detected_masks = detected_masks.squeeze(1)
188
  # detected_masks: (num_objects, H, W)
189
  for i, mask in enumerate(detected_masks):
 
190
  mask_bin = (mask > 0.0).astype(np.uint8)
191
  xyxy = mask_to_xyxy(mask_bin)
192
  if not xyxy:
 
31
  if torch.cuda.is_available() and torch.cuda.is_bf16_supported()
32
  else torch.float16
33
  )
34
+ DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
35
  logger.info(f"Device: {DEVICE}, dtype: {DTYPE}")
36
  logger.info("Loading Models and Processors...")
37
  try:
 
187
  detected_masks = detected_masks.squeeze(1)
188
  # detected_masks: (num_objects, H, W)
189
  for i, mask in enumerate(detected_masks):
190
+ mask = mask.cpu().numpy()
191
  mask_bin = (mask > 0.0).astype(np.uint8)
192
  xyxy = mask_to_xyxy(mask_bin)
193
  if not xyxy:
requirements.txt CHANGED
@@ -6,4 +6,5 @@ loguru
6
  opencv-python-headless>=4.11.0.86
7
  peft
8
  sentencepiece
 
9
  matplotlib
 
6
  opencv-python-headless>=4.11.0.86
7
  peft
8
  sentencepiece
9
+ kernels
10
  matplotlib