Using Monai Sliding Window with a YOLOv8 Segmentation model #7455
Unanswered
Mehreganbeiki
asked this question in
Q&A
Replies: 1 comment
-
Hi @Mehreganbeiki, the main issue is that type of the prediction from the model is incompatible with the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
So I have been trying to use the Monai sliding window on my test images. Here in the code, I load my Yolov8-seg model, which I trained earlier, and also read an image, convert it to a torch tensor, unsqueeze it to have the specific shape needed, and pass it to the sliding window. I am getting the following error, which I assume is because something with the model is not compatible with what function requires. I am working with RGB 2D images.
roi_size = 1312
sw_batch_size = 8
overlap = 0.3
model = YOLO("best.pt")
test_file_path = "L 20.jpg"
image = cv2.imread(test_file_path)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
transform = transforms.ToTensor()
tensor_image = transform(image)
tensor_image = tensor_image.unsqueeze(0)
sliding_window = sliding_window_inference(tensor_image, roi_size, 1, model)
Beta Was this translation helpful? Give feedback.
All reactions