guides/sahi-tiled-inference/ #8121
Replies: 31 comments 119 replies
-
I am using SAHI's Batch Prediction to predict large images (150000*150000). I need to set the --agnostic-nms=True in the Yolov8 to avoid multiple classes being detected for single object. But the SAHI's batch predict function does not accept --agnostic-nms argument for Yolov8. Is there a way to deal with this issue? |
Beta Was this translation helpful? Give feedback.
-
How to use SAHI predict in case of incoming images on-the-fly, rather than processing a batch of images from a folder, and Infered images needs to be visualized in real-time. |
Beta Was this translation helpful? Give feedback.
-
I would like to use yolov8 and sahi for video detection and every time i use cv2 for video processing, the output video does not return the same detection as each frame individually if taken as image. If you can please provide a code to do it or help with the logic |
Beta Was this translation helpful? Give feedback.
-
In AutoDetectionModel.from_pretrained argument config should I define image_size as 640 for the best possible YOLO prediction or will YOLO preprocess the image automatically to account for this? |
Beta Was this translation helpful? Give feedback.
-
Welcome my friends, i have problem and ican not sloved it, my problem is that object names are large in images, and the borders of the box that defines the object are also large. How can I change them? Or make modifications to them? The other issue is that I only want vehicles objects, meaning cars, buses, and motorcycles. The other issue is that I previously applied Yolo in vscode. When I applied Yolo in vccode, it showed me statistical results with the number of objects. How can this option exist? With many thanks. |
Beta Was this translation helpful? Give feedback.
-
I am using SAHI to predict on all present images in a folder using the predict() function, how do i get the PredictionResults object for each image? i've tried with: result = predict() and then prediction_list = results.object_prediction_list but it returns an error |
Beta Was this translation helpful? Give feedback.
-
I have a dataset of high-resolution images; I have trained my yolo8 model on the lower resolution of size 640, so if I use my existing model with SAHI, it will still receive results based on my previous training. Is there any guidance on retraining my model so I will obtain better results? |
Beta Was this translation helpful? Give feedback.
-
How I can combine SAHI with segmentation model for aerial images, could you provide me some details please |
Beta Was this translation helpful? Give feedback.
-
When I use Sahi, the inference speed is normal in a single main thread, but when I load Sahi into one of multiple threads, it causes the inference speed to be much slower. What is the reason for this |
Beta Was this translation helpful? Give feedback.
-
How can I predict only the specific classes I need and not all the classes used during training in Sahi inference? |
Beta Was this translation helpful? Give feedback.
-
Hi, I need help inresolving this.
This is my package environment
|
Beta Was this translation helpful? Give feedback.
-
I use YOLOv8 + SAHI for tree detection, I need to calculate the diameter of the tree canopy in cm/m, I read in several articles to use pixels from the bounding box and convert them into cm/m, how do I implement it in SAHI? |
Beta Was this translation helpful? Give feedback.
-
Hi folks. I still work with SAHI and YOLOv8-seg from sahi.predict import get_sliced_prediction Set the path to the imageIMAGE_PATH = r"PATH" Setting the path to the modelMODEL_PATH = r"PATH" Upload an imageimage = Image.open(IMAGE_PATH) Initialize the modeldetection_model = AutoDetectionModel.from_pretrained( Performing predictions with cutting the image into 512x512 partsresult = get_sliced_prediction( Saving the resultsoutput_dir = 'output_vs' Initialize the dictionary for merged masks by classcombined_masks_by_class = {} Export masks and combine them by classfor prediction in result.object_prediction_list:
Store merged masks by classfor category_name, combined_mask in combined_masks_by_class.items(): print(f"Results saved in {output_dir}") After that code I receive aerial image with boxes and label but without masks ( |
Beta Was this translation helpful? Give feedback.
-
I find that when I use different overlap_height_ratio and overlap_width_ratio in sahi to predict my images , I will get different detection results, I want to know the reason for it |
Beta Was this translation helpful? Give feedback.
-
Hi! I have been using SAHI with YOLOv8 for segmentation in my images, and it works great. Unfortunately, I am having problems to disable the labels and bounding boxes, as well as exporting data from the masks (I need the area and average color of the mask to classify the objecttts later with K-means). Regarding the labels and bounding boxes, I have tried introducing the arguments show_labels=False and visual_hide_labels = True in the coresponding functions, but no success and I cannot find the documentation for arguments of functions for SAHI. For the area of the mask (in pixels), I have only been able to find the height and width of the box, but that is not accurate enough for me, how can I find the area and average color of a mask? |
Beta Was this translation helpful? Give feedback.
-
i am getting this kind of error? what does this mean Performing prediction on 30 slices.ImportError Traceback (most recent call last) 7 frames ImportError: cannot import name 'HUBTrainingSession' from 'ultralytics.hub' (/usr/local/lib/python3.10/dist-packages/ultralytics/hub/init.py) |
Beta Was this translation helpful? Give feedback.
-
ImportError: cannot import name 'HUBTrainingSession' from 'ultralytics.hub' (/usr/local/lib/python3.10/dist-packages/ultralytics/hub/init.py) |
Beta Was this translation helpful? Give feedback.
-
How to disable bounding boxes and labels on images on which segmentation has been run by yolov8+SAHI |
Beta Was this translation helpful? Give feedback.
-
Hi, I am using
|
Beta Was this translation helpful? Give feedback.
-
I am performing instance segmentation, however the output from SAHI is only an image. How can I operate to obtain the polygonal contour information of the segmented areas?How do I extract contour information from the instance segmentation mask and convert it into polygon coordinate text? |
Beta Was this translation helpful? Give feedback.
-
Slicing reasoning with YOLOv8 and SAHI How to do target tracking.please 🙏 |
Beta Was this translation helpful? Give feedback.
-
I would like to know how to adjust the IoU threshold used by the model from the SAHI commands. |
Beta Was this translation helpful? Give feedback.
-
Hi, this code make any sense? Function to load YOLO labelsdef load_yolo_labels(label_path): Directories for images and labelsimage_dir = "path/to/your/images" Create output directories if they don't existos.makedirs(output_image_dir, exist_ok=True) Process each image and its corresponding labelfor image_filename in os.listdir(image_dir):
The idea is to use sahi on labeled images to slice them, and then train the model, the idea is to adapt the code to a segmentation format of labeling |
Beta Was this translation helpful? Give feedback.
-
Hello... If I wanted to calculate the system's performance, how can I do it exactly? I want to know if I put Yolo8 + Sahi in the server, what will be the image execution rate? Are there specific examples or a specific method? |
Beta Was this translation helpful? Give feedback.
-
Hello! I want to use SAHI for segmentation prediction with a custom fine-tuned YOLO model, but I would like to export the segmentation contours in YOLO format as the output. Is there any way to do this? Thank you! |
Beta Was this translation helpful? Give feedback.
-
Hi, can you please advise me how I can output the coordinates of segmentation objects? In YOLO I do something like this
How do I get something like this out of sahi? |
Beta Was this translation helpful? Give feedback.
-
Hello! Is there any way to implement the retina_mask argument from the YOLO predict function in SAHI? |
Beta Was this translation helpful? Give feedback.
-
How to save the txt file with the detections when performed using batch prediction? For example, save the txt file for each image to create an auto annotated dataset. |
Beta Was this translation helpful? Give feedback.
-
I am using SAHI and YOLO11l-seg to segmentation large .tif image (100000 x 100000), but i getting error |
Beta Was this translation helpful? Give feedback.
-
Hello! I am using the SAHI for the batch prediction:
After I run the code, the final images are automatically saved to the runs/predict/exp3 directory. It seems that results variable does not hold any valid objects. I have two questions:
|
Beta Was this translation helpful? Give feedback.
-
guides/sahi-tiled-inference/
A comprehensive guide on how to use YOLOv8 with SAHI for standard and sliced inference in object detection tasks.
https://docs.ultralytics.com/guides/sahi-tiled-inference/
Beta Was this translation helpful? Give feedback.
All reactions