feat: add LibreYOLO as detection model backend - #1425
Open
IIIllllIlIlllII wants to merge 4 commits into
Open
Conversation
Add LibreYOLO (MIT-licensed) support as a new model type. LibreYOLO's API is compatible with Ultralytics, so the implementation inherits from UltralyticsDetectionModel and overrides load_model(), check_dependencies(), perform_batch_inference(), and _extract_predictions(). Resolves discussion obss#1397
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds LibreYOLO as a new detection model backend, as requested in #1397.
LibreYOLO is an MIT-licensed computer vision library with an API compatible with Ultralytics (same
Results,Boxes,Masks,OBBinterfaces). The implementation inherits fromUltralyticsDetectionModelwith four overrides to adapt for LibreYOLO's differences:check_dependencies()— requireslibreyoloinstead ofultralyticsload_model()— usesLibreYOLO()factory (device is passed at construction, not via.to())perform_batch_inference()— removes thecfgkwarg that LibreYOLO doesn't support_extract_predictions()— importsMasksfromlibreyoloinstead ofultralyticsUsage
Changes
sahi/models/libreyolo.pyUltralyticsDetectionModelsahi/auto_model.py"libreyolo"model typesahi/utils/libreyolo.pytests/test_libreyolo_model.pyTests
All 5 tests pass:
tests/test_libreyolo_model.py::test_load_model PASSED
tests/test_libreyolo_model.py::test_set_model PASSED
tests/test_libreyolo_model.py::test_perform_inference PASSED
tests/test_libreyolo_model.py::test_convert_original_predictions PASSED
tests/test_libreyolo_model.py::test_auto_model_type PASSED
Why LibreYOLO?
LibreYOLO provides MIT-licensed YOLO inference (vs Ultralytics' AGPL), which matters for users building commercial or closed-source applications. It supports YOLOv9, RF-DETR, YOLOX, and other architectures behind a single
LibreYOLO()factory.