Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nok
Copy link
Contributor

@nok nok commented Jun 6, 2025

This pull request adds support for the Roboflow detection framework which includes provided object detection models from the Roboflow Universe (package inference) and local trained RFDETR models (package rfdetr).

sahi_roboflow

This notebook is good as starting point: https://github.com/nok/sahi/blob/feature/rfdetr/demo/inference_for_roboflow.ipynb

Roboflow Model Integration:

  • Added a new RoboflowDetectionModel class in sahi/models/roboflow.py, which includes methods for model initialization, dependency checks, inference, and converting predictions into the required format.
  • Updated sahi/auto_model.py to register the new RoboflowDetectionModel under the key "roboflow" in the model registry.

Documentation Updates:

  • Updated README.md to include installation instructions for the Roboflow detection framework, specifying the required packages inference>=0.50.3 and rfdetr>=1.1.0.

Testing

Unfortunately I couldn't add unit tests, because I got several dependency conflicts:

darius@ws:~/repos/sahi$ uv add "rfdetr>=1.1.0" "inference>=0.50.4" --group ci
  × No solution found when resolving dependencies for split (python_full_version >= '3.12' and sys_platform == 'darwin'):
  ╰─▶ Because matplotlib-stubs==0.2.0 depends on numpy>=1.20,<2.dev0 and only matplotlib-stubs<=0.2.0 is available, we can conclude that matplotlib-stubs>=0.2.0 depends on numpy>=1.20,<2.dev0.
      And because sahi:dev depends on matplotlib-stubs>=0.2.0 and inference==0.50.4 depends on numpy>=2.0.0,<2.3.0, we can conclude that inference==0.50.4 and sahi:dev are incompatible.

It would be great to get some help or advice if unit tests are required strictly.

Darius 👋

@fcakyon fcakyon self-requested a review June 22, 2025 06:04
@fcakyon fcakyon added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed labels Jun 22, 2025
@fcakyon
Copy link
Collaborator

fcakyon commented Jun 22, 2025

Hey @nok thank you for this fantastic PR! Please add a test file under tests/ folder and update ci dependencies in pyproject.toml and then lets move forward with merging your contribution 🚀

@fcakyon
Copy link
Collaborator

fcakyon commented Jun 23, 2025

@nok i resolved the uv package conflicts, you can freely add the rfdetr tests 👍🏻

@nok
Copy link
Contributor Author

nok commented Jun 24, 2025

Hello @fcakyon, thanks for resolving the conflicts. I really like uv, but I couldn’t resolve the dependencies by myself. I’ve created and pushed the missing unit tests, following the structure of the existing ones. Take a look! 😄

@fcakyon
Copy link
Collaborator

fcakyon commented Jun 24, 2025

@nok i will handle the rest 👍🏻

@nok
Copy link
Contributor Author

nok commented Jun 24, 2025

@fcakyon , FYI, I pushed a small change that adds local imports to the unit tests.

@fcakyon
Copy link
Collaborator

fcakyon commented Jun 24, 2025

Nice fix @nok 💯

from sahi.predict import get_prediction, get_sliced_prediction
from sahi.utils.cv import read_image

pytestmark = pytest.mark.skipif(sys.version_info[:2] < (3, 12), reason="Requires Python 3.12 or higher")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related to the CI dependencies:

  "inference>=0.50.3;python_version>='3.12'",
  "rfdetr>=1.1.0;python_version>='3.12'",

https://github.com/obss/sahi/blob/main/pyproject.toml#L80-L81

@fcakyon fcakyon removed the help wanted Extra attention is needed label Jun 25, 2025
@fcakyon fcakyon enabled auto-merge June 25, 2025 09:53
@fcakyon fcakyon merged commit fa07909 into obss:main Jun 25, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants