Skip to content

Releases: Koldim2001/YOLO-Patch-Based-Inference

Python library 1.3.8 version

10 Jan 08:55
Compare
Choose a tag to compare

This Python library simplifies SAHI-like inference for instance segmentation tasks, enabling the detection of small objects in images. It caters to both object detection and instance segmentation tasks, supporting a wide range of Ultralytics models.

The library also provides a sleek customization of the visualization of the inference results for all models, both in the standard approach (direct network run) and the unique patch-based variant.

Model Support: The library offers support for multiple ultralytics deep learning models, such as YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, YOLO11, YOLO11-seg, FastSAM, and RTDETR. Users can select from pre-trained options or utilize custom-trained models to best meet their task requirements.

pip install patched-yolo-infer==1.3.8

🚀MAIN UPDATES:
Progress Tracking for Patching and Inference:
The update introduces the ability to monitor the progress of patching and inference tasks. You can now see the status of these processes in real-time.
Custom Progress Callback Function:
You can provide your own custom function to display the progress status. By default, the library uses tqdm to show a progress bar.

HOW TO USE: You need to pass additional parameters when creating an instance of MakeCropsDetectThem:

  1. show_processing_status (boolean, default: False):
    If set to True, a tqdm progress bar will be displayed for the cropping and object detection processes.

  2. progress_callback (function, default: None):
    This parameter allows you to pass a custom callback function to handle progress updates. The function should accept three arguments:

  task (str): The name of the task (e.g., "cropping" or "detecting").
  current (int): The current progress value.
  total (int): The total number of steps in the task.

Example:

# Custom Callback function to output progress
def progress_callback(task, current, total):
    print(f"{task}: {current / total * 100:.2f}%")

element_crops = MakeCropsDetectThem(
    image=img,
    model_path="yolov8m.pt",
    segment=False,
    show_crops=False,
    shape_x=600,
    shape_y=600,
    overlap_x=25,
    overlap_y=25,
    conf=0.5,
    iou=0.7,
    show_processing_status=True,
    # progress_callback=progress_callback,
)

result = CombineDetections(element_crops, nms_threshold=0.25)

image

Using the custom callback, the users can do whatever they want with it:

image

Python library 1.3.7 version

09 Jan 20:09
Compare
Choose a tag to compare

This Python library simplifies SAHI-like inference for instance segmentation tasks, enabling the detection of small objects in images. It caters to both object detection and instance segmentation tasks, supporting a wide range of Ultralytics models.

The library also provides a sleek customization of the visualization of the inference results for all models, both in the standard approach (direct network run) and the unique patch-based variant.

Model Support: The library offers support for multiple ultralytics deep learning models, such as YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, YOLO11, YOLO11-seg, FastSAM, and RTDETR. Users can select from pre-trained options or utilize custom-trained models to best meet their task requirements.

pip install patched-yolo-infer==1.3.7

🚀MAIN UPDATES:
Added the ability to retrieve information about how many objects of each class were detected on each of the obtained patches during inference. This can be done by calling the patches_info() function on an instance of the MakeCropsDetectThem class.
image

Additionally, the new update introduces a convenient function for visualizing the results of standard inference for YOLO-pose neural networks (yolov8-pose & yolo11-pose). You can see an example of how to use this function by visiting this Colab notebook - Open In Colab
image

Python library 1.3.4 version

02 Jan 14:36
Compare
Choose a tag to compare

This Python library simplifies SAHI-like inference for instance segmentation tasks, enabling the detection of small objects in images. It caters to both object detection and instance segmentation tasks, supporting a wide range of Ultralytics models.

The library also provides a sleek customization of the visualization of the inference results for all models, both in the standard approach (direct network run) and the unique patch-based variant.

Model Support: The library offers support for multiple ultralytics deep learning models, such as YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, YOLO11, YOLO11-seg, FastSAM, and RTDETR. Users can select from pre-trained options or utilize custom-trained models to best meet their task requirements.

pip install patched-yolo-infer==1.3.4

🚀MAIN UPDATES:
Added the ability to obtain information about useful attributes based on the inference result.
Example:
image

Python library 1.3.3 version

08 Oct 21:22
41523da
Compare
Choose a tag to compare

This Python library simplifies SAHI-like inference for instance segmentation tasks, enabling the detection of small objects in images. It caters to both object detection and instance segmentation tasks, supporting a wide range of Ultralytics models.

The library also provides a sleek customization of the visualization of the inference results for all models, both in the standard approach (direct network run) and the unique patch-based variant.

Model Support: The library offers support for multiple ultralytics deep learning models, such as YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, YOLO11, YOLO11-seg, FastSAM, and RTDETR. Users can select from pre-trained options or utilize custom-trained models to best meet their task requirements.

pip install patched-yolo-infer==1.3.3

🚀MAIN UPDATES:

There is an opportunity to produce cropping into patches at different resolutions. This way, small objects can be detected when cropping into smaller patches, and large objects can be detected when cropping into larger patches. As a result, the algorithm will be able to detect a wider range of object sizes in the frame. To achieve this, the image needs to be processed multiple times through MakeCropsDetectThem with different patch parameters, and then pass the list of element_crops to the CombineDetections process. Below is an example of this approach:
output
An example of using this approach can be seen in this Google Colab notebook – Open In Colab

Python library 1.3.1 version

23 Sep 10:34
Compare
Choose a tag to compare

This Python library simplifies SAHI-like inference for instance segmentation tasks, enabling the detection of small objects in images. It caters to both object detection and instance segmentation tasks, supporting a wide range of Ultralytics models.

The library also provides a sleek customization of the visualization of the inference results for all models, both in the standard approach (direct network run) and the unique patch-based variant.

Model Support: The library offers support for multiple ultralytics deep learning models, such as YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, FastSAM, and RTDETR. Users can select from pre-trained options or utilize custom-trained models to best meet their task requirements.

pip install patched-yolo-infer==1.3.1

🚀MAIN UPDATES:

The key advancements in this version are centered around the enhanced visualization capabilities for neural network inference results. Now you can implement a color selection not only for boxes and masks, but also a color selection of the class text field. An example is shown below:

visualize_results_usual_yolo_inference(
    img,
    model,
    conf=0.15,
    iou=0.7,
    segment=True,
    show_classes_list=[0, 1, 2, 7],
    list_of_class_colors=[(0,0,255),(0,255,0),(0,0,0),_,_,_,_,(255,0,0)],
    color_class_background=[(0,0,255),(0,255,0),(0,0,0),_,_,_,_,(255,0,0)],
    thickness=3,
    font_scale=0.65,
    show_class=True,
    show_boxes=False,
)

image

Python library 1.3.0 version

05 Aug 16:15
Compare
Choose a tag to compare

This Python library simplifies SAHI-like inference for instance segmentation tasks, enabling the detection of small objects in images. It caters to both object detection and instance segmentation tasks, supporting a wide range of Ultralytics models.

The library also provides a sleek customization of the visualization of the inference results for all models, both in the standard approach (direct network run) and the unique patch-based variant.

Model Support: The library offers support for multiple ultralytics deep learning models, such as YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, FastSAM, and RTDETR. Users can select from pre-trained options or utilize custom-trained models to best meet their task requirements.

pip install patched-yolo-infer==1.3.0

🚀MAIN UPDATES:
There is now an option to choose between class-agnostic and not class-agnostic types of NMS, which improves quality in the case of a multi-class detection or instance segmentation task.
To efficiently process a large number of images of varying sizes and contents, manually selecting the optimal patch sizes and overlaps can be difficult. To address this, an algorithm auto_calculate_crop_values has been developed to automatically calculate the best parameters for patches (crops).
Furthermore, enhanced default parameters for more effective patched inference have been established.

Python library 1.2.9 version

25 Jul 13:23
Compare
Choose a tag to compare

This Python library simplifies SAHI-like inference for instance segmentation tasks, enabling the detection of small objects in images. It caters to both object detection and instance segmentation tasks, supporting a wide range of Ultralytics models.

The library also provides a sleek customization of the visualization of the inference results for all models, both in the standard approach (direct network run) and the unique patch-based variant.

Model Support: The library offers support for multiple ultralytics deep learning models, such as YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, FastSAM, and RTDETR. Users can select from pre-trained options or utilize custom-trained models to best meet their task requirements.

pip install patched-yolo-infer==1.2.9

🚀MAIN UPDATES:
The capability to convert a list of polygons obtained from inference into a list of binary arrays using the function create_masks_from_polygons has been added. Additionally, the ability to manually set display colors for classes in the visualization function has been introduced; previously, one could only choose to randomly generate colors for the classes. Furthermore, the algorithm has been optimized in the mask processing mode with memory_optimize=False, which has reduced memory consumption in this mode by approximately half.

Python library 1.2.8 version

19 Jul 09:23
2e657d6
Compare
Choose a tag to compare

This Python library simplifies SAHI-like inference for instance segmentation tasks, enabling the detection of small objects in images. It caters to both object detection and instance segmentation tasks, supporting a wide range of Ultralytics models.

The library also provides a sleek customization of the visualization of the inference results for all models, both in the standard approach (direct network run) and the unique patch-based variant.

Model Support: The library offers support for multiple ultralytics deep learning models, such as YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, FastSAM, and RTDETR. Users can select from pre-trained options or utilize custom-trained models to best meet their task requirements.

pip install patched-yolo-infer==1.2.8

🚀MAIN UPDATES:
The algorithm for duplicate suppression (intelligent_sorter) has been refined. It now allows for setting the number of bins (sorter_bins) to adjust the quality of suppression. A smaller number of bins makes the NMS more dependent on object sizes rather than confidence scores.

Python library 1.2.7 version

01 Jul 21:13
b8d4a88
Compare
Choose a tag to compare

This Python library simplifies SAHI-like inference for instance segmentation tasks, enabling the detection of small objects in images. It caters to both object detection and instance segmentation tasks, supporting a wide range of Ultralytics models.

The library also provides a sleek customization of the visualization of the inference results for all models, both in the standard approach (direct network run) and the unique patch-based variant.

Model Support: The library offers support for multiple ultralytics deep learning models, such as YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, FastSAM, and RTDETR. Users can select from pre-trained options or utilize custom-trained models to best meet their task requirements.

pip install patched-yolo-infer==1.2.7

🚀MAIN UPDATES:

The core advancement in the library update is the implementation of batch inference support coupled with TensorRT technology, significantly enhancing processing speed.
By enabling batch_inference=True during the initialization of the MakeCropsDetectThem class, fps will be improved by approximately 1.5 times. Furthermore, the library now supports any converted ultralytics detection and instance segmentation model in TensorRT format, offering an additional 1.5 times fps increase. This dual-enhancement significantly accelerates video stream processing.

optimized

Python library 1.2.6 version

27 Jun 16:07
Compare
Choose a tag to compare

This Python library simplifies SAHI-like inference for instance segmentation tasks, enabling the detection of small objects in images. It caters to both object detection and instance segmentation tasks, supporting a wide range of Ultralytics models.

The library also provides a sleek customization of the visualization of the inference results for all models, both in the standard approach (direct network run) and the unique patch-based variant.

Model Support: The library offers support for multiple ultralytics deep learning models, such as YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, FastSAM, and RTDETR. Users can select from pre-trained options or utilize custom-trained models to best meet their task requirements.

pip install patched-yolo-infer==1.2.6

🚀MAIN UPDATES:
Increased the processing speed of the visualize_results_usual_yolo_inference function for the task of instance segmentation visualization, and added the ability to pass extra arguments to the inference. You can find a list of possible additional arguments in the Ultralytics documentation - here.