Commit Graph

42 Commits (b5797c9e6ceaee23b1d2907e84d87e74bf5899ac)

Author SHA1 Message Date
Yifan Zhou 398bf2b386
[Refactor]: Refactor mmdeploy/core (#140)
* refactor function rewriter

* Pass unit test

* Fix test

* Fix test

* lint

* refactor function rewriter

* Pass unit test

* Fix test

* Fix test

* lint

* support openvino

* update

1. All type hints of cfg are set to Dict
2. Check if kwargs exist when calling patch_model
3. Complement tests
4. key name 'object' is set to '_object'

* lint

* Update docstring

* Fix tests

* Improve test
2021-10-26 10:30:14 +08:00
AllentDan 35b7341766
fix mmocr (#147) 2021-10-25 19:09:28 +08:00
Semyon Bevzyuk ba7ae81d3e
[Unittest]: Test for CascadeRoIHead (#141)
* Fix include and lib paths for onnxruntime.

* Fixes for SSD export test

* Add onnx2openvino and OpenVINODetector. Test models: ssd, retinanet, fcos, fsaf.

* Add support for two-stage models: faster_rcnn, cascade_rcnn

* Add doc

* Add strip_doc_string for openvino.

* Fix openvino preprocess.

* Add OpenVINO to test_wrapper.py.

* Fix

* Add openvino_execute.

* Removed preprocessing.

* Fix onnxruntime cmake.

* Rewrote postprocessing and forward, added docstrings and fixes.

* Added device type change to OpenVINOWrapper.

* Update forward_of_single_roi_extractor_dynamic_openvino and fix doc.

* Update docs.

* Add OpenVINODetector and onn2openvino tests.

* Add input_info to onnx2openvino.

* Add TestOpenVINOExporter and test_single_roi_extractor.

* Moved get_input_shape_from_cfg to openvino_utils.py and added test.

* Added test_cascade_roi_head.

* Add backend.check_env() to tests.

* Add OpenVINO to get_rewrite_outputs and to some tests in test_mmdet_models.

* Moved test_single_roi_extractor to test_mmdet_models.

* Removed TestOpenVINOExporter.

* Added test_cascade_roi_head.

* Fix onnxruntime outputs type.
2021-10-25 15:13:09 +08:00
hanrui1sensetime 9e227b228b
[UnitTest] mmocr unittest (#130)
* WIP test_mmocr 8 out of 20

* test_mmocr_export

* test mmocr apis

* add test data

* add mmocr model unittest 5 passed 1 failed

* finish mmocr unittest

* fix lint

* fix yapf

* fix isort

* fix flake8

* fix docformatter

* fix docformatter

* try to fix unittest after merge master

* Change test.py for backend.DEFAULT

* fix flake8

* fix ut

* fix yapf

* fix ut build

* fix yapf

* fix mmocr_export ut

* fix mmocr_apis ort not cuda

* remove explicit .forward

* remove backendwrapper

* simplify the crnn and dbnet config

* simplify instance_test.json

* add another case of decoder

* increase coverage of test_mmocr_models base_recognizer

* improve coverage

* improve encode_decoder coverage

* reply for grimoire codereview

* what if not check cuda?

* remove image data

* reply to runningleon code review

* fix fpnc

* fix lint

* try to fix CI UT error

* fix fpnc with and wo custom ops

* fix yapf

* skip fpnc when cuda is not ready in ci

* reply for code review

* reply for code review

* fix yapf

* reply for code review

* fix yapf

* fix conflict

* remove unmatched data path

* remove unnecessary comments
2021-10-25 10:15:57 +08:00
Semyon Bevzyuk c5a87fb1bc
[Enhancement]: OpenVINO deployment support for some models (#117)
* Fix include and lib paths for onnxruntime.

* Fixes for SSD export test

* Add onnx2openvino and OpenVINODetector. Test models: ssd, retinanet, fcos, fsaf.

* Add support for two-stage models: faster_rcnn, cascade_rcnn

* Add doc

* Add strip_doc_string for openvino.

* Fix openvino preprocess.

* Add OpenVINO to test_wrapper.py.

* Fix

* Add openvino_execute.

* Removed preprocessing.

* Fix onnxruntime cmake.

* Rewrote postprocessing and forward, added docstrings and fixes.

* Added device type change to OpenVINOWrapper.

* Update forward_of_single_roi_extractor_dynamic_openvino and fix doc.

* Update docs.

* Add OpenVINODetector and onn2openvino tests.

* Add input_info to onnx2openvino.

* Add TestOpenVINOExporter and test_single_roi_extractor.

* Moved get_input_shape_from_cfg to openvino_utils.py and added test.

* Added test_cascade_roi_head.

* Add backend.check_env() to tests.

* Add OpenVINO to get_rewrite_outputs and to some tests in test_mmdet_models.

* Moved test_single_roi_extractor to test_mmdet_models.

* Removed TestOpenVINOExporter.
2021-10-21 16:07:35 +08:00
Yifan Zhou e240c1569f
[Unittest]: Test mmcls (#135)
* Add tests

* lint

* add data

* Remove redundant code
2021-10-19 20:30:51 +08:00
VVsssssk fd75d57175
[Unittest]: Add MMSegmentation test (#125)
* add ncnn test exporter in test_ops.py

* add ncnn test exporter in utils.py

* add onnxruntime and tensorrt ops test

* fix blank line

* fix comment
add nms ops test

* remove nms test

* add test sample
add dockerstring

* remove nms test

* fix grid_sample
add type hind

* fix problem

* fix dockerstring

* add nms batch_nms multi_level_roi_align

* add test data

* fix problem

* rm pkl file dependent

* rm file

* add docstring

* remove multi_level_dependce

* add mmseg module unittest

* add mmseg test

* add mmseg model unit test

* fix blankline

* rename file

* add syncbn2bn unit test

* add apis/export

* lint

* lint

* ??

* delete#

* fix ncnn check

* fix problems

* fix problems

* fix dim problems

* resolve comments

* Fix SwitchBackendWrapper

* fix assert problems

* fix assert

* Remove comment

* merge master

Co-authored-by: SingleZombie <singlezombie@163.com>
2021-10-19 15:25:06 +08:00
Yifan Zhou 6f36717a72
[Unittest]: Test mmdeploy.pytorch (#133)
* add some tests

* Fix topk bug

* Fix bug in test

* Add remaining tests

* Remvoe debug code

* Delete redundant code

* Remove redundant code
2021-10-19 13:14:33 +08:00
VVsssssk 0f1cda0d3e
[Unittest]Add mmcv unit test (#128)
* add ncnn test exporter in test_ops.py

* add ncnn test exporter in utils.py

* add onnxruntime and tensorrt ops test

* fix blank line

* fix comment
add nms ops test

* remove nms test

* add test sample
add dockerstring

* remove nms test

* fix grid_sample
add type hind

* fix problem

* fix dockerstring

* add nms batch_nms multi_level_roi_align

* add test data

* fix problem

* rm pkl file dependent

* rm file

* add docstring

* remove multi_level_dependce

* add mmseg module unittest

* add mmseg test

* add mmseg model unit test

* fix blankline

* rename file

* add syncbn2bn unit test

* add apis/export

* lint

* lint

* ??

* delete#

* fix ncnn check

* fix problems

* fix problems

* add mmcv unit test

* add mmcv unit test

* modify scores

* fix format

* fix scores to rand

* remove blank line

Co-authored-by: SingleZombie <singlezombie@163.com>
2021-10-19 11:43:35 +08:00
Yifan Zhou 26cf2bdf05
[Enhancement]: Clarify the return value of get_rewrite_outputs (#129)
* Modify function and its call

* fix typo
2021-10-15 16:18:32 +08:00
Yifan Zhou 10c4ef4203
[Unittest]: MMEdit unittest (#124)
* add mmedit test

* Solve unittest bug

* lint

* Remove debug code

* add data

* Refine code

* Fix ci

* Fix ci

* follow changes in mmdet test

* try to remove pytest skip

* remove redundant code

* rename

* Fix type hint

* Fix lint

* Refine SwitchBackendWrapper. Fix type hint

* update docstring
2021-10-15 10:25:48 +08:00
hanrui1sensetime 07cb78bb7c
[Unittest] add ncnn unittest expand and fix expand.cpp bugs. (#118)
* add ncnn unittest expand

* rollback utils.py

* remove figures
2021-10-14 10:24:14 +08:00
AllentDan d4828c7836
[Unittests] MMDet unittests (#112)
* add mmdet unittests

* remove redundant img meta info

* import wrapper from backend util

* force add wrapper

* use smaller nuance

* add seed everything

* add create input part and some inference part unittests

* fix lint

* skip ppl

* remove pyppl

* add dataset files

* import ncnn_ext inside ncnn warpper

* use cpu device to create input

* add pssd and ptsd unittests

* clear mmdet unittests

* wrap function to enable rewrite

* refine codes and resolve comments

* move mmdet inside test func

* remove redundant line

* test visualize in mmdeploy.apis

* use less memory

* resolve comments

* fix ci

* move pytest.skip inside test function and use 3 channel input
2021-10-13 17:24:11 +08:00
hanrui1sensetime 1ed6bc0fb5
refactor ncnn ops unittest (#121) 2021-10-12 14:24:56 +08:00
hanrui1sensetime 21f2b047a1
[Unittest] Test ncnn gather op and fix gather.cpp (#114)
* add shape constantofshape unittest for ncnn

* fix lint

* standarize import

* fix lint

* reply for code review

* reply for code review

* fix lint

* remove some hardcode

* fix lint

* reply for code review

* test gather and fix gather cpp code

* fix yapf

* fix clang-format

* reply for code review

* reply for code review

* fix lint
2021-10-09 14:06:49 +08:00
Yifan Zhou f8a70f1d33
[Unittest]: Complement remaining tests in apis/core/utils (#110)
* Add remaining tests

* Use another method to import

* try to fix ppl import error

* try to fix pyppl import bug 2

* try to fix pyppl import error 3

* try to fix pyppl import error 4

* Use test class

* remove ()

* lint

* add else branch
2021-10-09 14:05:48 +08:00
hanrui1sensetime cba43e4c22
[Unittest] Add NCNN tensorslice unittest and fix tensorslice.cpp bugs. (#115)
* add tensorslice unittest

* reply code review

* fix lint

* fix typo
2021-10-09 11:42:32 +08:00
q.yao f56a30025a
[Enhance] Add spell hook (#116)
* add spell hook

* fix code spell
2021-10-09 11:34:14 +08:00
q.yao a335444a49
[Fix]: Remove TensorRT NMS plugin (#113)
* Remove TensorRT NMS plugin

* remove nms test
2021-10-09 11:14:38 +08:00
VVsssssk 43eee77fdd
[Unittest]Add ops test (#108)
* add ncnn test exporter in test_ops.py

* add ncnn test exporter in utils.py

* add onnxruntime and tensorrt ops test

* fix blank line

* fix comment
add nms ops test

* remove nms test

* add test sample
add dockerstring

* remove nms test

* fix grid_sample
add type hind

* fix problem

* fix dockerstring

* add nms batch_nms multi_level_roi_align

* add test data

* fix problem

* rm pkl file dependent

* rm file

* add docstring

* remove multi_level_dependce

* Update test_ops.py
2021-10-09 10:45:03 +08:00
hanrui1sensetime 6318e9fcf9
[Unittest] Add ncnn 'Shape' 'ConstantOfShape' unittest (#107)
* add shape constantofshape unittest for ncnn

* fix lint

* standarize import

* fix lint

* reply for code review

* reply for code review

* fix lint

* remove some hardcode

* fix lint

* reply for code review
2021-09-29 15:02:58 +08:00
AllentDan 5818095fe0
[Unittests] Add a demo for codebase rewrite part unittests (#89)
* save codes

* add test_model

* save codes

* wrap func

* reformat

* fix lint

* refine docstring

* remove pkl in .gitignore

* add pkl

* apply channel 3

* add function and trt backend rewrite unittest

* fix lint and typo

* add skip condition

* fix typo

* define deploy config inside func and keep ortwrapper original

* speed up and remove ctx

* only inference if no backends

* fix ci

* fix ci

* [Fix] Fix test_calibration (#101)

* fix test calibration

* Modify cuda to cpu

* add tensorrt check

* Revert "[Fix] Fix test_calibration (#101)"

This reverts commit 3f8b8384bfd880538050798d2567f1c137a36174.

Co-authored-by: maningsheng <mnsheng@yeah.net>
Co-authored-by: Yifan Zhou <singlezombie@163.com>
2021-09-28 19:29:58 +08:00
VVsssssk 0bef0513c6
[Unittest]: Add ncnn test exporter and topk test (#84)
* add ncnn test exporter in test_ops.py

* add ncnn test exporter in utils.py

* fix ncnn unittest

* fix lint

* fix lint

* fix lint isort

* remove ncnn roi_align pytest

* add ncnn topk unittest

* update to new api

* fix lint

* add comments

* skip class

* skip ncnn

Co-authored-by: hanrui1sensetime <hanrui1@sensetime.com>
Co-authored-by: maningsheng <mnsheng@yeah.net>
2021-09-28 14:20:04 +08:00
Yifan Zhou 2073f3327e
[Fix] Fix test_calibration (#101)
* fix test calibration

* Modify cuda to cpu
2021-09-27 19:51:07 +08:00
RunningLeon 6ba1d45e81
[Fix]: fix ignoring test_ops (#102)
* show message from pytest skip

* skip utility class

Co-authored-by: SingleZombie <singlezombie@163.com>
2021-09-27 19:10:18 +08:00
RunningLeon f9b2cab3fa
[Feature]: Update github CI (#100)
* align mmedit static cfg

* add for test

* update requirments

* add dependencies from mmlab

* change name

* lower thresh for interrogate at first

* update test

* update to skip

* Move import tensorrt

* Move import statement

Co-authored-by: SingleZombie <singlezombie@163.com>
2021-09-27 17:43:41 +08:00
Yifan Zhou 4de5bbb461
[Unittest]: Add demos for core/apis/utils (#91)
* add unittests

* lint

* modify .gitignore, remove useless files

* remove emtpy.py and generate it when use

* Update according to comments

1. Use tempfile
2. Delete inference test (which will be tested in each codebase)
3. Refine calibration test

* update annotation

* Add export_info

* Reduce data scale, fix assert

* update json blank line

* add backend check
2021-09-27 16:10:47 +08:00
VVsssssk b6c16d01db
[Unittest]: Add onnxruntime and tensorrt ops unit test (#96)
* add ncnn test exporter in test_ops.py

* add ncnn test exporter in utils.py

* add onnxruntime and tensorrt ops test

* fix blank line

* fix comment
add nms ops test

* remove nms test

* add test sample
add dockerstring

* remove nms test

* fix grid_sample
add type hind

* fix problem

* fix dockerstring
2021-09-27 11:16:23 +08:00
hanrui1sensetime 01e2240b94
[Fix] Fix RoiAlign Unittest (#90)
* fix roi_align unittest

* fix lint

* remove non must code

* fix isort

* reply for review

* fix lint

* reply code review

* fix docformatter

* fix review

* reuse mmcv.roialignfunction
2021-09-26 11:21:18 +08:00
AllentDan ec66d47057
[Feature] Add speed test components (#86)
* add time counter

* add time-count to all backends

* fix lint

* add docstring and unit tests

* use test instead

* remove enable member

* refinement

* replace runtime error with assert and log speed with a single line

* fix unit tests

* resolve comments and add file output

* remove an argument
2021-09-22 19:42:16 +08:00
VVsssssk 00bfbf8e89
Test ops (#48)
* test_ops_v1

* test_ops_version1.0

* test_ops_version1.1

* test_ops_version1.1

* test_ops_version1.1

* test_ops1.1

* test_ops2.0

* test_ops2.1

* test_ops2.1

* test_ops2.1

* test_ops2.1

* test_ops2.2

* test_ops2.2

* test_ops2.3

* test_ops2.3

* test_ops2.3

* test_ops2.3

* test_2.4

* test_ops2.4
2021-09-08 13:42:15 +08:00
q.yao 5d9c34177f
[Fix] fix test_mark (#60)
* fix mark

* remove useless line
2021-09-06 15:11:10 +08:00
q.yao 2b98040b26
[Feature] Refactor v1 (#56)
* [Refactor] add enum class and use functions to get configuration (#40)

* add task and codebase enum class

* use funcitons to get config

* Refactor wrappers of mmcls and mmseg (#41)

* move wrappers of cls & det to apis

* remove get_classes_from_config

* rename onnx_helper to onnx_utils

* move import to outside of class

* refactor ortwrappers

* Refactor build dataset and dataloader for mmseg (#44)

* refactor build_dataset and build_dataloader for mmcls and mmseg

* remove repeated classes

* set build_dataloader with shuffle=False

* [Refactor] pplwrapper and mmocr refactor (#46)

* add

* add pplwrapper and refactor mmocr

* fix lint

* remove unused arguments

* apply dict input for pplwrapper and ortwrapper

* add condition before import ppl and ort stuff

* update ppl (#51)

* Refactor return value and extract_model (#54)

* remove ret_value

* refactor extract_model

* fix typo

* resolve comments

* [Refactor] Refactor model inference pipeline (#52)

* move attribute_to_dict to extract_model

* simplify the inference and visualization

* remove unused import

* [Feature] Support SRCNN in mmedit with ONNXRuntime and TensorRT (#45)

* finish mmedit-ort

* edit __init__ files

* add noqa

* add tensorrt support

* 1. Rename "base.py"
2. Move srcnn.py to correct directory

* fix bugs

* remove figures

* align to refactor-v1

* update comment in srcnn

* fix lint

* newfunc -> new_func

* Add visualize.py

split visualize() in each codebase

* fix lint

* fix lint

* remove unnecessary code in ORTRestorer

* remove .api

* edit super(), remove dataset

* [Refactor]: Change name of split to partition (#57)

* refactor mmcls configs

* refactor mmdet configs and split params

* rename rest split to partition from master

* remove base.py

* fix init of inference class

* fix mmocr init, add show_result alias

Co-authored-by: AllentDan <41138331+AllentDan@users.noreply.github.com>
Co-authored-by: RunningLeon <maningsheng@sensetime.com>
Co-authored-by: Yifan Zhou <singlezombie@163.com>
2021-09-01 15:43:49 +08:00
hanrui1sensetime e05521c933
[Feature] Merge NCNN deployment to grimoire based on mmcls - revert [#25](https://github.com/grimoire/deploy_prototype/pull/25) (#30)
* add

* change VulkanSDK to 1.2.176.1

* add ncnn cmakelist

* add ncnn source code as third party

* add all ncnn

* ncnn compile passed

* onnx2ncnn correctly

* fix code style

* merge_as_grimoire_design, only backend_ops, manually register.

* remove data and test sh

* remove build example

* remove config ncnn

* remove onnx2ncnn intermediate files

* remove other files auto-generated

* remove vulkan tools

* remove Vulkan, gitignore new rules, __init__ new lines

* rollback __init__ to grimoire

* remove pytorch version pending

* grimoire comments reply 1, 3, 4

* reply comment 5,6,7

* add auto definer, add python register

* fix lint

* add ncnn deploy support

* add model_wrapper, fix a typo bug, and add code comment for onnx2ncnn(WIP)

* add model wrapper ncnn

* fix lint

* fix pep8

* fix pre-commit-config.yaml paths

* fix import

* fix lint

* remove sys.path.append

* remove sys

* isort fix

* fix double quoted

* fix trailing space

* try fix isort

* fix clang-format-9

* fix requests

* fix all comments

* Fix typo

* test code for grimoire

* fix ops register

* new definere

* fix visualization of mmcls

* remove temp

* fix flake8

* fix seed-isort-config

* fix thirdparty

* fix thirdparty

* fix yapf

* fix third_party_sort

* fix third party

* fix clang-format

* try fix clang-format

* try to fix clang format 9 customreshape

* try fix clang-format-9

* try fix clang-format-9

* try fix clang-format-9

* try fix ext

* fix onnx2ncnn

* Fix comments

* Fix Comments

* Fix Comments

* Fix Comments

* Fix conflict

* Fix flake8

* Update .isort.cfg

* Update ncnn_ext.cpp

* Update ncnn_ext.cpp

* fix missing ncnn backend code

* delete out of date comments of gather.cpp

* add DeployBaseClassifier

* add return -100 error

* clear out-of-date to do comments

Co-authored-by: 韩睿 <SENSETIME\hanrui1@cn0614008774l.domain.sensetime.com>
Co-authored-by: grimoire <yaoqian@sensetime.com>
Co-authored-by: grimoire <streetyao@live.com>
2021-08-05 14:06:47 +08:00
RunningLeon 9f0e2d4339
changed codebase structure (#10)
* add delta2bbox rewriter

* rename onnx2trt

* add rewriter: anchor_generator_single_level_grid_priors

* Revert "add rewriter: anchor_generator_single_level_grid_priors"

This reverts commit ac7cf272942c4787bf143c0d67e414b0d2603b75.

* update comments

* remove clamp rewriter

* remove unused func

* reconstruct codes

* remomve mark

* create export package for codebases

* remove grid_sampler symbolic

* reorganize nms parts

* fix conflicts

* update unittest
2021-07-12 16:26:44 +08:00
lzhangzz 66300c0c74
Supports setting input/output names explicitly via mark decorator (#4)
* setting names of inputs and outputs via mark decorator

* fix bug in mark, move extract_model to mmdeploy/apis and add test cases

* remove fsaf rewrite, which is not needed any more after recent changes

* replace print with log and add fixture to clear test tmp file
2021-07-07 14:15:26 +08:00
q.yao 66a099faf9
[Feature] Apis unit test (#7)
* add apis test

* split torch2onnx impl, prepare for codebase test

* add is_available to backend

* lint
2021-07-05 12:51:43 +08:00
grimoire 5b2459570a better register 2021-06-16 19:25:09 +08:00
grimoire 100ba694ce add init 2021-06-16 17:56:17 +08:00
grimoire 93408c7cd8 add type annotation
add onnxruntime plugin support, add more custom ops

update function_rewriter, enable use origin function

add setup.cfg

update setup.cfg
2021-06-16 15:36:58 +08:00
grimoire 1e47821e49 add backend plugin build system 2021-06-15 20:44:45 +08:00
grimoire f90ebf8c2c add register 2021-06-11 13:26:05 +08:00