# YOLO-Patch-Based-Inference: setup.py is at 1.3.10, the newest tag is 1.3.8

> A thin Python wrapper that runs Ultralytics detectors and segmenters over overlapping image crops and merges the per-crop predictions, distributed on PyPI as patched_yolo_infer under AGPL-3.0. The interesting parts are the version skew between setup.py and the release tags, the two separate suppression thresholds, and the quick start's own output attribute typo.

**Koldim2001/YOLO-Patch-Based-Inference** — Python library for YOLO small object detection and instance segmentation

- Repository: https://github.com/Koldim2001/YOLO-Patch-Based-Inference
- Stars: 556 · Forks: 31
- Language: Python
- License: AGPL-3.0
- Published: 2026-09-18 · Updated: 2026-09-18 · Language: en
- Canonical page: https://hysenlabs.com/projects/koldim2001-yolo-patch-based-inference

## setup.py is at 1.3.10 and the newest tag is at 1.3.8

The version in setup.py is `'1.3.10'`. The three most recent GitHub releases are `v1.3.8_patched_yolo_infer`, `v1.3.7_patched_yolo_infer` and `v1.3.4_patched_yolo_infer`, published on 2025-01-10, 2025-01-09 and 2025-01-02, so the source tree has moved two patch numbers past anything tagged, and the tag names append the distribution name to the version. The branch itself was last pushed on 2026-04-22, well after the last release, so what pip installs and what the repository contains are not the same snapshot unless you pin.

setup.py also classifies the package as `Development Status :: 5 - Production/Stable` while carrying that gap. It requires Python 3.8 or newer and pulls in four dependencies, `tqdm`, `opencv-python`, `matplotlib` and `ultralytics`, which is the same list as requirements.txt.

## Two suppression thresholds do different jobs

Duplicate suppression happens twice, and the two knobs are not the same setting. Inside the cropping class, `iou` defaults to 0.7 and is described as the IoU threshold for non-maximum suppression of a single crop. After the crops are merged, `CombineDetections` takes its own `nms_threshold`, and the quick start passes 0.25. So the first pass decides what one tile of the image keeps, and the second decides what survives when overlapping tiles are stitched back together.

Raising the merge threshold tightens the cross-crop stage without touching per-crop filtering, which is the knob to reach for when one object is detected in several overlapping tiles and survives as duplicates. The published argument table for the cropping class stops at `shape_x`, so the defaults for `shape_y` and the two overlap arguments are not written down anywhere in the README.

## The quick start ends with result.filtered_classe

The documented result carries six attributes: `img` with the original image, `confidences`, `boxes` as lists of `[x_min, y_min, x_max, y_max]`, `polygons` as NumPy arrays of mask coordinates when the model produces them, `classes_ids`, and `classes_names`. The quick start assigns five of them:

```python
import cv2
from patched_yolo_infer import MakeCropsDetectThem, CombineDetections

# Load the image
img_path = "test_image.jpg"
img = cv2.imread(img_path)

element_crops = MakeCropsDetectThem(
    image=img,
    model_path="yolo11m.pt",
    segment=False,
    shape_x=640,
    shape_y=640,
    overlap_x=25,
    overlap_y=25,
    conf=0.5,
    iou=0.7,
)
result = CombineDetections(element_crops, nms_threshold=0.25)

# Final Results:
img=result.image
confidences=result.filtered_confidences
boxes=result.filtered_boxes
polygons=result.filtered_polygons
classes_ids=result.filtered_classe
```

The last line reads `filtered_classe`, missing the trailing s that the attribute list uses, and `classes_names` is never assigned at all. Anyone copying the block verbatim hits the missing-s name first.

## The crop default is 700 while the network input is 640

Two size arguments do different jobs, and the defaults point in opposite directions. `imgsz` defaults to 640 and is the input size for YOLO inference itself. `shape_x` defaults to 700 and is the size of the crop in the x coordinate, so the default slice is larger than the image the detector sees. The quick start sets both to 640 and additionally sets `overlap_x` and `overlap_y` to 25, and raises `conf` from its documented 0.25 default to 0.5 while leaving `iou` at 0.7.

So the shortest example overrides nearly every default it documents, which makes it a configuration choice rather than a neutral starting point. Two further arguments short-circuit the usual path: `model` accepts an already initialized Ultralytics model object and, when given, is used instead of loading from `model_path`, whose default is `yolo11m.pt`; and `classes_list` filters by class id, with `None` meaning every class.

## Three example headings sit above nothing

The Examples section of the README is three bare headings in a row: Detection example, Instance Segmentation example 1, and Instance Segmentation example 2. None of them is followed by code, an image or a paragraph. The same emptiness appears earlier, where the line introducing itself as an explanation of how patch-based inference works is followed by an empty centered paragraph block and nothing else, and where a closing `</details>` tag appears with no matching opening tag in the same file.

What the prose does supply is the model list: YOLOv8, YOLOv8-seg, YOLOv9, YOLOv9-seg, YOLOv10, YOLO11, YOLO11-seg, YOLO12, YOLO12-seg, FastSAM and RTDETR, with pre-trained or custom-trained weights both allowed. The library is described as simplifying SAHI-like inference for small object detection, and as covering both direct network runs and the patch-based variant with the same visualization layer.

## Keywords name YOLO26 and pose models the model list omits

The keyword list in setup.py reaches past the supported models named in the README. It includes `YOLO26`, `YOLO-pose`, `YOLO-pose visualization`, `patchify`, `slice-based inference`, `slicing inference`, `sahi` and `rtdetr`, while the README's own list of supported Ultralytics models stops at YOLO12 and its segmentation variants, with FastSAM and RTDETR, and no pose entry anywhere. `segment` also defaults to False, and the polygons attribute is described as available only if the model can produce it.

Keywords are packaging metadata rather than a support statement, but they are what a search index and a package page show, so the mismatch is worth knowing before you plan a pipeline around a pose variant and find it absent from the model list.

## LICENSE.txt is read into a variable setup() never uses

setup.py opens `LICENSE.txt`, assigns its contents to `license_text`, and then calls setup() without ever passing that variable. The only licensing argument is the string `license="AGPL-3.0"`. The file ships because it sits in the tree, not because the build declares it.

The same script reads its long description from `patched_yolo_infer/README.md`, a second README inside the package directory, which is not the root README.md the repository page shows. The tree also carries a `readme_content/` directory at the top level whose contents are not described anywhere in the documentation, next to `examples/`, `patched_yolo_infer/`, `requirements.txt`, `setup.py` and `LICENSE.txt`.

## Conclusion

patched_yolo_infer is a small, readable wrapper rather than a framework, and its sharpest edges are documentation gaps rather than architectural ones. It fits teams already using Ultralytics models who need small objects found by slicing and want the merge and duplicate suppression in one call, and it does not fit anyone who needs a pinned, auditable release: setup.py declares 1.3.10 while the newest tag is 1.3.8_patched_yolo_infer from January 2025, even though the branch was pushed to in April 2026. Before depending on it, read the two thresholds separately, treat the iou and nms_threshold values as the pair that decides your false positives, and remember the crop defaults are larger than the network input size.

## FAQ

### What does patched_yolo_infer actually do at inference time?

You create a MakeCropsDetectThem instance with the image and the crop and confidence parameters, then pass it to CombineDetections, which consolidates the predictions from each overlapping crop and suppresses duplicates. The result exposes img, confidences, boxes, polygons, classes_ids and classes_names.

### Is the iou parameter the same as the merge threshold?

No. The iou argument inside MakeCropsDetectThem, default 0.7, is the non-maximum suppression threshold for a single crop. CombineDetections takes a separate nms_threshold, passed as 0.25 in the quick start, for suppressing duplicates after the overlapping crops are merged.

### What is YOLO-inference?

This repository does not define the term in general; it wraps it. The library runs Ultralytics models such as YOLOv8, YOLOv9, YOLOv10, YOLO11, YOLO12, FastSAM and RTDETR over overlapping crops, and the installation step is pip install patched_yolo_infer, with PyTorch's CUDA build recommended beforehand when CUDA is available.

### Which version of the library does pip install?

setup.py declares 1.3.10, and the newest GitHub release is v1.3.8_patched_yolo_infer from 2025-01-10. The branch was last pushed on 2026-04-22, so the tagged release and the current tree are not the same snapshot unless you pin one.

## Sources

- [Issues](https://github.com/Koldim2001/YOLO-Patch-Based-Inference/issues)
- [Koldim2001/YOLO-Patch-Based-Inference on GitHub](https://github.com/Koldim2001/YOLO-Patch-Based-Inference)
- [License: AGPL-3.0](https://github.com/Koldim2001/YOLO-Patch-Based-Inference/blob/main/LICENSE)
- [README](https://github.com/Koldim2001/YOLO-Patch-Based-Inference/blob/main/README.md)
- [Releases](https://github.com/Koldim2001/YOLO-Patch-Based-Inference/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/koldim2001-yolo-patch-based-inference
