You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DATA_SUBDIR = f"{HOME}/data/test"
SEGMENTATION_PREDICTION_SAVING_DIR = f"{DATA_SUBDIR}/segmented_images"
if not os.path.isdir(SEGMENTATION_PREDICTION_SAVING_DIR):
os.mkdir(SEGMENTATION_PREDICTION_SAVING_DIR)
DATA_SUBDIR = f"{HOME}/data/test"
SEGMENTATION_PREDICTION_SAVING_DIR = f"{DATA_SUBDIR}/segmented_images"
if not os.path.isdir(SEGMENTATION_PREDICTION_SAVING_DIR):
os.mkdir(SEGMENTATION_PREDICTION_SAVING_DIR)
Sometimes needed because of a bug in SAM
torch.use_deterministic_algorithms(mode=True, warn_only=True)
mask_predictor = SamPredictor(sam)
results_insights, sam_inferred_masks = segment_images_and_measure_results(mask_predictor, yolo_infered_bboxes_in_voc_format, DATA_SUBDIR, GENERIC_ANNOTATIONS_FILE_NAME, SEGMENTATION_PREDICTION_SAVING_DIR)
0%
0/16 [00:02<?, ?it/s]
ValueError Traceback (most recent call last)
in <cell line: 11>()
9 mask_predictor = SamPredictor(sam)
10
---> 11 results_insights, sam_inferred_masks = segment_images_and_measure_results(mask_predictor, yolo_infered_bboxes_in_voc_format,
12 DATA_SUBDIR, GENERIC_ANNOTATIONS_FILE_NAME,
13 SEGMENTATION_PREDICTION_SAVING_DIR)
1 frames
/content/SOTA_YOLOv8_and_SAM/save_and_display_image.py in save_overlayed_image(images_path, image_name, saving_dir, bboxes, masks, alpha, format, BGR_color_bboxes, BGR_color_masks, image_size)
147 if bboxes:
148 image = overlay_image_with_bboxes(image, bboxes, format=format, BGR_color=BGR_color_bboxes, image_size=image_size)
--> 149 if masks:
150 image = overlay_image_with_masks(image, masks, BGR_color=BGR_color_masks, alpha=alpha)
151 cv2.imwrite(f"{saving_dir}/{image_name[:-4]}-segmented.jpg", image)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The text was updated successfully, but these errors were encountered: