Skip to content

Commit 985b0e7

Browse files
authored
Update ci package versions for latest mmdet (#1129)
1 parent 7f5901f commit 985b0e7

File tree

5 files changed

+23
-32
lines changed

5 files changed

+23
-32
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
# coco analyse
7373
sahi coco analyse --dataset_json_path tests/data/coco_evaluate/dataset.json --result_json_path tests/data/coco_evaluate/result.json --out_dir tests/data/coco_evaluate/
7474
- name: Test SAHI CLI with MMCV
75-
if: matrix.python-version == '3.8' || matrix.python-version == '3.9' || matrix.python-version == '3.10'
75+
if: matrix.python-version != '3.12'
7676
run: |
7777
source .venv/bin/activate
7878
set -e

README.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ Object detection and instance segmentation are by far the most important applica
9797

9898
- `MMDetection` + `SAHI` walkthrough: <a href="https://colab.research.google.com/github/obss/sahi/blob/main/demo/inference_for_mmdetection.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="sahi-mmdetection"></a>
9999

100-
- `Detectron2` + `SAHI` walkthrough: <a href="https://colab.research.google.com/github/obss/sahi/blob/main/demo/inference_for_detectron2.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="sahi-detectron2"></a>
101-
102100
- `TorchVision` + `SAHI` walkthrough: <a href="https://colab.research.google.com/github/obss/sahi/blob/main/demo/inference_for_torchvision.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="sahi-torchvision"></a>
103101

104102
<a href="https://huggingface.co/spaces/fcakyon/sahi-yolox"><img width="600" src="https://user-images.githubusercontent.com/34196005/144092739-c1d9bade-a128-4346-947f-424ce00e5c4f.gif" alt="sahi-yolox"></a>
@@ -126,39 +124,35 @@ pip install sahi
126124
conda install -c conda-forge shapely
127125
```
128126

129-
- Install your desired version of pytorch and torchvision (cuda 11.3 for detectron2, cuda 11.7 for rest):
127+
- Install your desired version of pytorch and torchvision:
130128

131129
```console
132-
conda install pytorch=1.10.2 torchvision=0.11.3 cudatoolkit=11.3 -c pytorch
130+
pip install torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu126
133131
```
134132

133+
(torch 2.1.2 is required for mmdet support):
134+
135135
```console
136-
conda install pytorch=1.13.1 torchvision=0.14.1 pytorch-cuda=11.7 -c pytorch -c nvidia
136+
pip install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu121
137137
```
138138

139139
- Install your desired detection framework (yolov5):
140140

141141
```console
142-
pip install yolov5==7.0.13
142+
pip install yolov5==7.0.14
143143
```
144144

145145
- Install your desired detection framework (ultralytics):
146146

147147
```console
148-
pip install ultralytics==8.3.50
148+
pip install ultralytics==8.3.86
149149
```
150150

151151
- Install your desired detection framework (mmdet):
152152

153153
```console
154154
pip install mim
155-
mim install mmdet==3.0.0
156-
```
157-
158-
- Install your desired detection framework (detectron2):
159-
160-
```console
161-
pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html
155+
mim install mmdet==3.3.0
162156
```
163157

164158
- Install your desired detection framework (huggingface):
@@ -167,12 +161,6 @@ pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu113
167161
pip install transformers timm
168162
```
169163

170-
- Install your desired detection framework (super-gradients):
171-
172-
```console
173-
pip install super-gradients==3.3.1
174-
```
175-
176164
</details>
177165

178166
### Framework Agnostic Sliced/Standard Prediction

pyproject.toml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ classifiers = [
2828
"Programming Language :: Python :: 3.9",
2929
"Programming Language :: Python :: 3.10",
3030
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
3132
"Topic :: Software Development :: Libraries",
3233
"Topic :: Software Development :: Libraries :: Python Modules",
3334
]
@@ -40,7 +41,7 @@ sahi = "sahi.cli:app"
4041

4142
[tool.uv]
4243
find-links = [
43-
"https://download.openmmlab.com/mmcv/dist/cpu/torch1.13.0/index.html",
44+
"https://download.openmmlab.com/mmcv/dist/cpu/torch2.1.0/index.html"
4445
]
4546
default-groups = ["dev", "ci"]
4647

@@ -54,14 +55,14 @@ dev = [
5455
]
5556
ci = [
5657
# pytorch should be present for all python versions
57-
"torch==1.13.1;python_version<'3.11'",
58-
"torch==2.6.0+cpu;python_version>='3.11'",
59-
"torchvision>=0.14.1;python_version<'3.11'",
60-
"torchvision==0.21.0+cpu;python_version>='3.11'",
61-
# mmcv is available for python < 3.11
62-
"mmengine==0.7.3;python_version<'3.11'",
63-
"mmcv==2.0.0;python_version<'3.11'",
64-
"mmdet==3.0.0;python_version<'3.11'",
58+
"torch==2.6.0+cpu;python_version>='3.12'",
59+
"torchvision==0.21.0+cpu;python_version>='3.12'",
60+
# mmdet is supported for python < 3.12
61+
"torch==2.1.2+cpu;python_version<'3.12'",
62+
"torchvision==0.16.2+cpu;python_version<'3.12'",
63+
"mmengine;python_version<'3.12'",
64+
"mmcv==2.1.0;python_version<'3.12'",
65+
"mmdet==3.3.0;python_version<'3.12'",
6566
# deepsparse is only available for python<3.12
6667
"deepsparse;python_version<'3.12'",
6768
"onnxruntime<1.20;python_version<'3.12'",

sahi/models/mmdet.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ def __init__(
104104
scope: str = "mmdet",
105105
):
106106
if not IMPORT_MMDET_V3:
107-
raise ImportError("Failed to import `DetInferencer`. Please confirm you have installed 'mmdet>=3.0.0'")
107+
raise ImportError(
108+
"Failed to import `DetInferencer`. Please confirm you have installed 'mmdet==3.3.0 mmcv==2.1.0'"
109+
)
108110

109111
self.scope = scope
110112
self.image_size = image_size

tests/test_mmdetectionmodel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from sahi.utils.cv import read_image
1212
from sahi.utils.mmdet import MmdetTestConstants, download_mmdet_cascade_mask_rcnn_model, download_mmdet_yolox_tiny_model
1313

14-
pytestmark = pytest.mark.skipif(sys.version_info[:2] > (3, 10), reason="Requires Python 3.10 or lower")
14+
pytestmark = pytest.mark.skipif(sys.version_info[:2] > (3, 11), reason="MMDet 3.3.0 requires Python 3.11 or lower")
1515
MODEL_DEVICE = "cpu"
1616
CONFIDENCE_THRESHOLD = 0.5
1717
IMAGE_SIZE = 320

0 commit comments

Comments
 (0)