Skip to content

Commit 4c30e76

Browse files
committed
sync with main
2 parents d96d737 + 26b66ef commit 4c30e76

File tree

11 files changed

+114
-151
lines changed

11 files changed

+114
-151
lines changed

.github/scripts/quantize_to_ncnn.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/workflows/backend-ncnn.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,58 @@ jobs:
7979
python -m pip install mmcv-lite
8080
python tools/scripts/build_ubuntu_x64_ncnn.py 8
8181
python -c 'import mmdeploy.apis.ncnn as ncnn_api; assert ncnn_api.is_available(with_custom_ops=True)'
82+
83+
test_ncnn_ptq:
84+
runs-on: [self-hosted, linux-3090]
85+
container:
86+
image: openmmlab/mmdeploy:ubuntu20.04-cuda11.3
87+
options: "--gpus=all --ipc=host"
88+
steps:
89+
- name: Checkout repository
90+
uses: actions/checkout@v3
91+
with:
92+
submodules: recursive
93+
- name: Install dependencies
94+
run: |
95+
apt-get update
96+
apt-get install ninja-build -y
97+
python3 -V
98+
python3 -m pip install openmim
99+
python3 -m pip install -r requirements.txt
100+
python3 -m mim install $(cat requirements/codebases.txt | grep mmpretrain)
101+
python3 -m pip install numpy==1.22.0
102+
python3 -m pip list
103+
- name: Install mmdeploy
104+
run: |
105+
rm -rf .eggs && python3 -m pip install -e .
106+
python3 tools/check_env.py
107+
- name: Install ppq
108+
run: |
109+
git clone -b v0.6.6 --depth 1 https://github.com/openppl-public/ppq
110+
cd ppq
111+
python3 -m pip install -r requirements.txt
112+
python3 setup.py install
113+
- name: Test ncnn + ppq pipeline
114+
run: |
115+
export PYTHONPATH=${PWD}/ppq:${PYTHONPATH}
116+
export LD_LIBRARY_PATH="/root/workspace/mmdeploy/build/lib:${LD_LIBRARY_PATH}"
117+
export LD_LIBRARY_PATH="/root/workspace/mmdeploy/mmdeploy/lib:${LD_LIBRARY_PATH}"
118+
export work_dir=./work_dir
119+
mkdir -p $work_dir
120+
export model_cfg=$work_dir/resnet18_8xb32_in1k.py
121+
export deploy_cfg=configs/mmpretrain/classification_ncnn-int8_static.py
122+
export checkpoint=$work_dir/resnet18_8xb32_in1k_20210831-fbbb1da6.pth
123+
export input_img=tests/data/tiger.jpeg
124+
python3 -m mim download mmpretrain --config resnet18_8xb32_in1k --dest $work_dir
125+
python3 tools/torch2onnx.py $deploy_cfg $model_cfg $checkpoint $input_img --work-dir $work_dir
126+
wget https://media.githubusercontent.com/media/tpoisonooo/mmdeploy-onnx2ncnn-testdata/main/dataset.tar
127+
tar xvf dataset.tar
128+
python3 tools/onnx2ncnn_quant_table.py \
129+
--onnx $work_dir/end2end.onnx \
130+
--deploy-cfg $deploy_cfg \
131+
--model-cfg $model_cfg \
132+
--out-onnx $work_dir/quant.onnx \
133+
--out-table $work_dir/ncnn.table \
134+
--image-dir ./dataset
135+
ls -sha $work_dir/quant.onnx
136+
cat $work_dir/ncnn.table

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
python -m pip install -r requirements/backends.txt
4949
python -m mim install "mmcv>=2.0.0"
5050
python -m mim install -r requirements/codebases.txt
51-
python -m pip install -U numpy clip numba transformers
51+
python -m pip install clip numba transformers numpy==1.23
5252
python -m pip list
5353
- name: Install mmyolo
5454
run: |

.github/workflows/quantize.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/stale.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'Close stale issues and PRs'
2+
3+
on:
4+
schedule:
5+
# check issue and pull request once at 01:30 a.m. every day
6+
- cron: '30 1 * * *'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
stale:
13+
permissions:
14+
issues: write
15+
pull-requests: write
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/stale@v7
19+
with:
20+
stale-issue-message: 'This issue is marked as stale because it has been marked as invalid or awaiting response for 7 days without any further response. It will be closed in 5 days if the stale label is not removed or if there is no further response.'
21+
stale-pr-message: 'This PR is marked as stale because there has been no activity in the past 45 days. It will be closed in 10 days if the stale label is not removed or if there is no further updates.'
22+
close-issue-message: 'This issue is closed because it has been stale for 5 days. Please open a new issue if you have similar issues or you have any new updates now.'
23+
close-pr-message: 'This PR is closed because it has been stale for 10 days. Please reopen this PR if you have any updates and want to keep contributing the code.'
24+
# only issues/PRS with following labels are checked
25+
any-of-labels: 'invalid, awaiting response, duplicate'
26+
days-before-issue-stale: 7
27+
days-before-pr-stale: 45
28+
days-before-issue-close: 5
29+
days-before-pr-close: 10
30+
# automatically remove the stale label when the issues or the pull requests are updated or commented
31+
remove-stale-when-updated: true
32+
operations-per-run: 50

docs/en/04-supported-codebases/mmdet.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ Besides python API, mmdeploy SDK also provides other FFI (Foreign Function Inter
207207
| [RepPoints](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/reppoints) | Object Detection | N | Y | N | ? | Y |
208208
| [DETR](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/detr) | Object Detection | Y | Y | N | ? | Y |
209209
| [CenterNet](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/centernet) | Object Detection | Y | Y | N | ? | ? |
210-
| [Cascade Mask R-CNN](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/cascade_rcnn) | Instance Segmentation | Y | N | N | N | Y |
210+
| [RTMDet](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/rtmdet) | Object Detection | Y | Y | N | ? | ? |
211+
| [Cascade Mask R-CNN](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/cascade_rcnn) | Instance Segmentation | Y | Y | N | N | Y |
211212
| [Mask R-CNN](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/mask_rcnn) | Instance Segmentation | Y | Y | N | N | Y |
212213
| [Swin Transformer](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/swin) | Instance Segmentation | Y | Y | N | N | N |
213214
| [SOLO](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/solo) | Instance Segmentation | Y | N | N | N | Y |

docs/zh_cn/04-supported-codebases/mmdet.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ cv2.imwrite('output_detection.png', img)
210210
| [RepPoints](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/reppoints) | ObjectDetection | N | Y | N | ? | Y |
211211
| [DETR](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/detr) | ObjectDetection | Y | Y | N | ? | Y |
212212
| [CenterNet](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/centernet) | Object Detection | Y | Y | N | ? | ? |
213-
| [Cascade Mask R-CNN](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/cascade_rcnn) | InstanceSegmentation | Y | N | N | N | Y |
213+
| [RTMDet](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/rtmdet) | Object Detection | Y | Y | N | ? | ? |
214+
| [Cascade Mask R-CNN](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/cascade_rcnn) | InstanceSegmentation | Y | Y | N | N | Y |
214215
| [Mask R-CNN](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/mask_rcnn) | InstanceSegmentation | Y | Y | N | N | Y |
215216
| [Swin Transformer](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/swin) | InstanceSegmentation | Y | Y | N | N | N |
216217
| [SOLO](https://github.com/open-mmlab/mmdetection/tree/3.x/configs/solo) | InstanceSegmentation | Y | N | N | N | Y |

mmdeploy/codebase/mmpose/deploy/pose_detection.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,15 @@ def create_input(self,
197197
from mmcv.transforms import Compose
198198
from mmpose.registry import TRANSFORMS
199199
cfg = self.model_cfg
200-
if isinstance(imgs, str):
201-
imgs = [mmcv.imread(imgs)]
202-
elif isinstance(imgs, (list, tuple)):
203-
img_data = []
204-
for img in imgs:
205-
if isinstance(img, str):
206-
img_data.append(mmcv.imread(img))
207-
else:
208-
img_data.append(img)
200+
if isinstance(imgs, (list, tuple)):
201+
if not isinstance(imgs[0], (np.ndarray, str)):
202+
raise AssertionError('imgs must be strings or numpy arrays')
203+
elif isinstance(imgs, (np.ndarray, str)):
204+
imgs = [imgs]
205+
else:
206+
raise AssertionError('imgs must be strings or numpy arrays')
207+
if isinstance(imgs, (list, tuple)) and isinstance(imgs[0], str):
208+
img_data = [mmcv.imread(img) for img in imgs]
209209
imgs = img_data
210210
person_results = []
211211
bboxes = []

mmdeploy/codebase/mmseg/deploy/segmentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,10 @@ def get_postprocess(self, *args, **kwargs) -> Dict:
303303
params = self.model_cfg.model.decode_head
304304
if isinstance(params, list):
305305
params = params[-1]
306-
postprocess = dict(params=params, type='ResizeMask')
307306
with_argmax = get_codebase_config(self.deploy_cfg).get(
308307
'with_argmax', True)
309-
postprocess['with_argmax'] = with_argmax
308+
params['with_argmax'] = with_argmax
309+
postprocess = dict(params=params, type='ResizeMask')
310310
return postprocess
311311

312312
def get_model_name(self, *args, **kwargs) -> str:

requirements/readthedocs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ onnx>=1.8.0
55
opencv-python==4.5.4.60
66
sphinxcontrib-mermaid
77
torch
8+
urllib3<2.0.0

0 commit comments

Comments
 (0)