Commit Graph

64 Commits (16864c7495c7620116c3ac2bc8d56993bc95df9a)

Author SHA1 Message Date
Ma Zerun b39885d953
[Feature] Support K-fold cross-validation (#563)
* Support to use `indices` to specify which samples to evaluate.

* Add KFoldDataset wrapper

* Rename 'K' to 'num_splits' accroding to sklearn

* Add `kfold-cross-valid.py`

* Add unit tests

* Add help doc and docstring
2022-01-19 18:32:55 +08:00
mzr1996 321ad09e6d Merge remote-tracking branch 'origin/master' into dev 2022-01-13 19:27:23 +08:00
Rejnald Lleshi c07f8326e3
[Feature] Add conversion script from pytroch to mlmodel (#597) 2022-01-13 12:32:52 +08:00
imyhxy 32d606e1a1
[Refactor] Save class names in best checkpoint created by evaluation hook (#641)
* Save class names in best checkpoint created by evaluation hook

* Save meta info into runner instaed of checkpoint_config
2022-01-13 12:20:59 +08:00
Ezra-Yu 131d8c6296
[Feature] Add CAM visualization tool (#577)
* add cam-grad tool

* refactor cam-grad tool

* add docs

* update docs

* Update docs and support Transformer

* remove pictures and use link

* replace example img and finish EN docs

* improve docs

* improve code

* Fix MobileNet V3 configs

* Refactor to support more powerful feature extraction.

* Add unit tests

* Fix unit test

* fix distortion of visualization exapmles in docs

* fix distortion

* fix distortion

* fix distortion

* merge master

* merge fix conficts

* Imporve the tool

* Support use both attribute name and index to get layer

* add default get_target-layers

* add default get_target-layers

* update docs

* update docs

* add additional printt info when not using target-layers

* Imporve docs

* Fix enumerate list.

Co-authored-by: mzr1996 <mzr1996@163.com>
2021-12-23 18:53:40 +08:00
Ma Zerun 894a82ea4f
[Refactor] Change `load_json_logs` to `load_json_log`. (#602) 2021-12-14 18:03:27 +08:00
Ezra-Yu fdb178303b
[Docs] Add analysis&misc docs (#525)
* refactor ananlysis_log and add docs

* refactor ananlysis_log and fix lint

* improve docs

* improve docs

* improve docs

* fix bugs and refactor analysis_log

* rename analysis folder to analysis_tools

* fix failure link

* add result analysis docs

* add eval-metrics docs

* add misc doc

* fix lint

* improve docs

* improve misc docs

* fix docs

* Change the `eval_options` in `tools/analysis_tools/eval_metric.py` to
`metric_options`

* Improve tutorials

Co-authored-by: mzr1996 <mzr1996@163.com>
2021-12-07 11:27:34 +08:00
Ezra-Yu 7b37bc5bf5
[Refactor] Refactor `analysis_log.py`. (#529)
* fix bugs and refactor analysis_log

* update some names
2021-12-03 16:02:50 +08:00
Ma Zerun d25a78d547
[Enchance] Set a random seed when the user does not set a seed. (#554) 2021-12-02 18:09:55 +08:00
Ma Zerun 78d6d8503f
[Refactor] Use new API of matplotlib to handle blocking input in visualization. (#568)
* [Refactor] Use new API of matplotlib to handle blocking input in
visualization.

* Modify unit tests
2021-12-02 17:46:40 +08:00
Zhicheng Chen fc8adbc149
[Enhance] Add metafile, readme and converted models for MLP-Mixer (#539)
* add pth converter

* minor update on config files, add metafile and readme

* add missing readme and minor fixes

* minor fixes

* Update config names and checkpoint download link

* Update model_zoo.md

Co-authored-by: mzr1996 <mzr1996@163.com>
2021-11-24 19:04:19 +08:00
Ma Zerun a55324c453
[Refactor] Remove useless `import_modules_from_string`. (#544) 2021-11-22 14:01:26 +08:00
imyhxy dc35eb62b6
[Fix] Fix an error on indexing scalar metrics in `analyze_result.py` (#518)
* [Fix] Error on indexing scalar metrics

* [Fix] Error on indexing scalar metrics

Co-authored-by: Ma Zerun <mzr1996@163.com>

Co-authored-by: Ma Zerun <mzr1996@163.com>
2021-11-05 11:57:49 +08:00
imyhxy abb5a222cf
[Fix] Fix wrong condition judgment in `analyze_logs.py` and prevent empty curve. (#510)
* [Fix] Analyze logs with single training iteration

* [Fix] Make `plot_curve` with 'accuracy' metric

* [Fix] Assert length of training log records of each epoch is larger than 1

Co-authored-by: Ma Zerun <mzr1996@163.com>

Co-authored-by: Ma Zerun <mzr1996@163.com>
2021-11-03 11:37:51 +08:00
Ezra-Yu b486bb23f8
[Feature] Add a tool to visualize learning rate in each iterations (#498)
* add vis lr

* add doc

* Update doc and rm load_json_log in analysis

* Update docs

* add unit tests and update docstring

* fix unit-tests

* Use DummyIterBasedRunner and DummyEpochBasedRunner to simulate training
process.

* rm function val and add judge

* update docs

* improve english expression

* Update docs/tools/visualization.md

Co-authored-by: Ma Zerun <mzr1996@163.com>

* fix typo and ImageNet datasize

* fix typo

* update example

Co-authored-by: mzr1996 <mzr1996@163.com>
2021-11-03 10:48:56 +08:00
Ezra-Yu 52e62560d4
[Feature] Add a tool to find broken files. (#482)
* add verify dataset

* add phase

* rm attr of single_process

* Use `mmcv.track_parallel_progress` to track the validation.

Co-authored-by: mzr1996 <mzr1996@163.com>
2021-10-27 10:14:19 +08:00
Ezra-Yu 9dbe58bf8e
[Feature] Add pipeline visualization tools. (#406)
* add vis

* add tool vis-pipeline

* add docs

* Update docs

* pre-commit

* enhence english expression

* Add `BaseImshowContextmanager` and `ImshowInfosContextManager` to reuse
matplotlib figure.

* Use context manager to implement `imshow_infos`

* Add unit tests.

* More general base context manager.

* unit tests for context manager.

* Improve docstring.

* Fix context manager exit cannot close figure when matplotlib>=3.4.0

* Fix unit tests

* fix lint

* fix lint

* add adaptive

* add adaptive

* update adaptive

* add GAP

* improve doc and docstring

* add visualization in doc index

* Update doc

* Update doc

* Update doc

* Update doc

* Update doc

* Update doc

* update docs and docstring

* add progressbar

* add progressbar

* add images

* add images

* Delete .DS_Store

* replace images

* replace images and modify rgb2bgr

* add picture size

* mv pictures

* update img display

* add doc_zh-CN images

* Update vis_pipeline.py

* Update visualization.md

* Update visualization.md

* fix lint

* Improve docs.

Co-authored-by: mzr1996 <mzr1996@163.com>
2021-10-20 10:28:21 +08:00
Ma Zerun 10e8495055
[Tool] Add a tool to test TorchServe. (#468)
* Add `title` option in `show_result_pyplot`.

* Add test_torchserver.py

* Add docs about test torchserve

* Update docs and result output.

* Update chinese docs.
2021-10-14 17:56:32 +08:00
Ma Zerun 2e6c7cf87d
[Docs] Add code-spell pre-commit hook and fix a large mount of typos. (#470)
* Add code spell check hook

* Add codespell config

* Fix a lot of typos.

* Add formating.py to keep compatibility.
2021-10-13 14:33:07 +08:00
Shane Zhao e166ee7c0c
[Fix] Fix format error in `test.py` when metric returns `np.ndarray` (#441)
* Update test.py

Fix the output format error when metric-options is specified

* Update tools/test.py

Co-authored-by: Ma Zerun <mzr1996@163.com>

* Update test.py

delete "," after round(out, 2)

* Update test.py

delete else

* Update tools/test.py

Co-authored-by: Ma Zerun <mzr1996@163.com>

Co-authored-by: Ma Zerun <mzr1996@163.com>
2021-09-29 11:51:19 +08:00
zhangrui_wolf 90496b4687
[Feature] Add RepVGG backbone and checkpoints. (#414)
* Add RepVGG code.

* Add se_module as plugin.

* Add the repvggA0 primitive config

* Change repvggA0.py to fit mmcls

* Add RepVGG configs

* Add repvgg_to_mmcls

* Add tools/deployment/convert_repvggblock_param_to_deploy.py

* Change configs/repvgg/README.md

* Streamlining the number of configuration files.

* Fix lints

* Delete plugins

* Delete code about plugin.

* Modify the code for using se module.

* Modify config to fit repvgg with se.

* Change se_cfg to allow loading of pre-training parameters.

* Reduce the complexity of the configuration file.

* Finsh unitest for repvgg.

* Fix bug about se in repvgg_to_mmcls.

* Rename convert_repvggblock_param_to_deploy.py to reparameterize_repvgg.py, and delete setting about device.

* test commit

* test commit

* test commit command

* Modify repvgg.py to make the code more readable.

* Add value=0 in F.pad()

* Add se_cfg to arch_settings.

* Fix bug.

* modeify some attr name and Update unit tests

* rename stage_0 to stem and branch_identity to branch_norm

* update unit tests

* add m.eval in unit tests

* [Enhance] Enhence SE layer to support custom squeeze channels. (#417)

* add enhenced SE

* Update

* rm basechannel

* fix docstring

* Update se_layer.py

fix docstring

* [Docs] Add algorithm readme and update meta yml (#418)

* Add README.md for models without checkpoints.

* Update model-index.yml

* Update metafile.yml of seresnet

* [Enhance] Add `hparams` argument in `AutoAugment` and `RandAugment` and some other improvement. (#398)

* Add hparams argument in `AutoAugment` and `RandAugment`.

And `pad_val` supports sequence instead of tuple only.

* Add unit tests for `AutoAugment` and `hparams` in `RandAugment`.

* Use smaller test image to speed up uni tests.

* Use hparams to simplify RandAugment config in swin-transformer.

* Rename augment config name from `pipeline` to `pipelines`.

* Add some commnet ad docstring.

* [Feature] Support classwise weight in losses (#388)

* Add classwise weight in losses:CE,BCE,softBCE

* Update unit test

* rm some extra code

* rm some extra code

* fix broadcast

* fix broadcast

* update unit tests

* use new_tensor

* fix lint

* [Enhance] Better result visualization (#419)

* Imporve result visualization to support wait time and change the backend
to matplotlib.

* Add unit test for visualization

* Add adaptive dpi function

* Rename `imshow_cls_result` to `imshow_infos`.

* Support str in `imshow_infos`

* Improve docstring.

* Bump version to v0.15.0 (#426)

* [CI] Add PyTorch 1.9 and Python 3.9 build workflow, and remove some CI. (#422)

* Add PyTorch 1.9 build workflow, and remove some CI.

* Add Python 3.9 CI

* Show Python 3.9 support.

* [Enhance] Rename the option `--options` in some tools to `--cfg-options`. (#425)

* [Docs] Fix sphinx version (#429)

* [Docs] Add `CITATION.cff` (#428)

* Add CITATION.cff

* Fix typo in setup.py

* Change author in setup.py

* modeify some attr name and Update unit tests

* rename stage_0 to stem and branch_identity to branch_norm

* update unit tests

* add m.eval in unit tests

* Update unit tests

* refactor

* refactor

* Alignment inference accuracy

* Update configs, readme and metafile

* Update readme

* return tuple and fix metafile

* fix unit test

* rm regnet and classifiers changes

* update auto_aug

* update metafile & readme

* use delattr

* rename cfgs

* Update checkpoint url

* Update readme

* Rename config files.

* Update readme and metafile

* add comment

* Update mmcls/models/backbones/repvgg.py

Co-authored-by: Ma Zerun <mzr1996@163.com>

* Update docstring

* Improve docstring.

* Update unittest_testblock

Co-authored-by: Ezra-Yu <1105212286@qq.com>
Co-authored-by: Ma Zerun <mzr1996@163.com>
2021-09-29 11:06:23 +08:00
Ma Zerun c076a97d54
[Fix] Fix `publish_model` bug if no parent of `out_file`. (#463) 2021-09-26 11:21:19 +08:00
Ma Zerun c5374854aa
[Fix] Fix num_classes bug in pytorch2onnx.py (#458)
* Fix num_classes bug in pytorch2onnx.py

* Fix `num_classes=-1`.
2021-09-25 09:25:58 +08:00
Ma Zerun cb09ed54e5
[Enhance] Support setting `--out-items` in `tools/test.py`. (#437)
* Support setting out_details in `tools/test.py`.

* Add assertion in `eval_metric` and `analyze_results`.
2021-09-15 11:06:16 +08:00
yushu 617932dd59
[Fix] Fix simplified model saving in ONNX export tool. (#438)
* Update pytorch2onnx.py

* Update pytorch2onnx.py

Please check the check_ok result.

* Update pytorch2onnx.py

* Update pytorch2onnx.py
2021-09-10 11:47:05 +08:00
Ezra-Yu fe25c8d3fb
[Enchence] Add datetime info and saving model using torch<1.6 format (#439)
* Add date and save ckpt usingg torch<1.6 format

* fix lint

* use digit_version and rasie error when there is no target out_dir

* add '.'
2021-09-10 11:42:38 +08:00
Ma Zerun ae40c45c55
[Enhance] Rename the option `--options` in some tools to `--cfg-options`. (#425) 2021-09-01 12:49:03 +08:00
Ma Zerun f9eb9b409b
[Docs] Add Copyright information. (#413) 2021-08-17 19:52:42 +08:00
Ma Zerun aad796ae6f
Modify test tools and add some new tools (#322)
* Refactor tools folder structure.

* Modify tools/test.py and add eval_metric.py to analysis test output.

* Add new tools `analyze_logs.py` and `print_config.py`.

* Add comment for analysis_tools functions.
2021-06-30 20:51:16 +08:00
AllentDan a24a9f6faa
[Fix] Build compatible with low pytorch versions (#301)
* add version compatible for torchscript

* doc

* doc again

* fix lint

* fix lint isort
2021-06-14 23:25:35 +08:00
WRH b99bd4fa88
Fix bug for CPU training (#286)
* remove MMDataParallel when using cpu

* support cpu testing

* fix lint
2021-06-12 22:26:33 +08:00
AllentDan c2f01e0dcd
[Feature] Add torchscript deployment (#279)
* add torchscript deploy

* fix lint

* add check and delete \
2021-06-12 21:50:48 +08:00
q.yao dbddde52ef
[Feature] TensorRT test tools. (#284)
* first commit

* update resnext result

* update docs

* update docstring
2021-06-12 21:47:10 +08:00
David de la Iglesia Castro e2507cae97
Add mmcls2torchserve (#292)
* Add mmcls2torchserve

* Update docs
2021-06-12 21:45:45 +08:00
LXXXXR 6de635a81c
[Bug] Missing test data when num_imgs can not be evenly divided by num_gpus (#299)
* fix bug in test

* remove unneccesary code
2021-06-11 15:53:23 +08:00
Miao Zheng 4ca21c7d03
[WIP] Refactoring weights initialization (#270)
* [WIP] Refactoring weights initialization

* fix lint and constant init cfg

* fix pretrained bug

* fix typo

* fix isort

* revise model utils
2021-06-10 10:54:34 +08:00
LXXXXR 5066e32306
dump config before training (#282) 2021-06-04 16:26:13 +08:00
Forsaken 0a92a81198
Update analyze_results.py (#237)
correct spelling mistake(sucess->success)
2021-05-10 15:04:08 +08:00
QingChuanWS 01d2849b76
[Feature]: add onnxruntime test tool (#212)
* [draft] add onnxruntime accuruacy verification

* fix a bug

* update code

* fix lint

* fix lint

* update code and doc

* update doc

* update code

* update code

* updata doc and updata code

* update doc and fix some bug

* update doc

* update doc

* update doc

* update doc

* update doc

* update doc

* fix bug

* update doc

* update code

* move CUDAExecutionProvider to first place

* update resnext accuracy

* update doc

Co-authored-by: maningsheng <maningsheng@sensetime.com>
2021-04-26 13:57:08 +08:00
WRH 9be435846c
Support training on CPU (#219)
* draft

* add parameter for training tools

* Update .pre-commit-config.yaml
2021-04-26 13:56:45 +08:00
agim-a 3affc481c8
[Fix] check for CLASSES in checkpoint meta (#207)
- check for CLASSES in checkpoint meta when key meta does not exists
2021-04-15 22:19:23 +08:00
mzr1996 b7b520881f
Update CONTRIBUTING.md according to mmcv (#210)
* Update CONTRIBUTING.md according to mmcv

* Docstring formatting by docformatter

* Update openmmlab website.
2021-04-14 21:22:37 +08:00
QingChuanWS 2bd28435cf
Add simplify option in pytorch2onnx.py and Update doc (#200)
* add simplify option in pytorch2onnx.py and update relevant doc

* update doc about pytorch2onnx

* update code

* update docs
2021-04-09 13:05:25 +08:00
LXXXXR e76c5a368d
[Feature] Support fp16 training (#178)
* change mmcls fp16 to mmcv hook

* support fp16

* clean unnessary stuff
2021-03-17 15:53:55 +08:00
QingChuanWS 8eb845e718
support dynamic shape export to onnx (#175)
* support dynamic shape export to onnx

* update the code and reset the simple_test() of image.py

* fix dynamic_axes name is not a valid input/output name
2021-03-17 15:50:03 +08:00
David de la Iglesia Castro fb11a23cfe
Show results in test api (#162)
* Initial support show in single_gpu_test

* Add result_show

* Add ori_filename meta_key

* test ori_filename

* Add show, show-dir, show-options
2021-02-25 16:00:22 +08:00
RunningLeon f0d358e340
add onnx2tensorrt (#153) 2021-02-05 17:48:37 +08:00
LXXXXR ddc2a14177
[Feature] Add --eval-options in test.py (#158)
* add --eval-options in test.py

* fix typo

* revise according to commnets
2021-02-05 17:46:43 +08:00
LXXXXR a7d4739d2b
[Fix] Fix test.py (#155)
* modeify test.py

* modeify test.py

* revise according to comments
2021-01-31 15:53:43 +08:00
LXXXXR 4f8fc9cbf3
[Feature] Add analyze_results.py to select imgs for success/fail (#142)
* add analyze_results.py to select imgs for success/fail

* minor change

* save imgs
2021-01-19 15:49:14 +08:00