Skip to content

Commit 380386c

Browse files
authored
Merge branch 'mindspore-lab:main' into swin_trans
2 parents 899b878 + 8bc296a commit 380386c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2218
-178
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
run: |
3535
python -m pip install --upgrade pip
3636
pip install -r requirements/dev.txt
37+
pip install "Pillow==9.1.1"
3738
# MindSpore must be installed following the instruction from official web, but not from pypi.
3839
# That's why we exclude mindspore from requirements.txt. Does this work?
3940
pip install "mindspore>=1.8,<=1.10"

.github/workflows/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
run: |
2222
python -m pip install --upgrade pip
2323
pip install -r requirements/docs.txt
24+
pip install "Pillow==9.1.1"
25+
pip install "mindspore>=1.8,<=1.10"
2426
- name: Build site
2527
run: mkdocs build
2628
- name: Deploy to gh-pages

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
run: |
2525
python -m pip install --upgrade pip
2626
pip install -r requirements/dev.txt
27+
pip install "Pillow==9.1.1"
2728
pip install "mindspore>=1.8,<=1.10"
2829
pip install build twine
2930
- name: Build package

README.md

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,22 @@
1313
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
1414
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
1515

16-
English | [中文](README_CN.md)
16+
[📝Documentation](https://mindspore-lab.github.io/mindcv/) |
17+
[🚀Installation](https://mindspore-lab.github.io/mindcv/installation/) |
18+
[🎁Model Zoo](https://mindspore-lab.github.io/mindcv/modelzoo/) |
19+
[🎉Update News](https://github.com/mindspore-lab/mindcv/blob/main/RELEASE.md) |
20+
[🐛Reporting Issues](https://github.com/mindspore-lab/mindcv/issues/new/choose)
1721

18-
[Introduction](#introduction) |
19-
[Installation](#installation) |
20-
[Get Started](#get-started) |
21-
[Tutorials](#tutorials) |
22-
[Model List](#model-list) |
23-
[Supported Algorithms](#supported-algorithms)
22+
English | [中文](README_CN.md)
2423

2524
</div>
2625

2726
## Introduction
2827

2928
MindCV is an open-source toolbox for computer vision research and development based on [MindSpore](https://www.mindspore.cn/en). It collects a series of classic and SoTA vision models, such as ResNet and SwinTransformer, along with their pre-trained weights and training strategies. SoTA methods such as auto augmentation are also provided for performance improvement. With the decoupled module design, it is easy to apply or adapt MindCV to your own CV tasks.
3029

30+
The main branch works with **MindSpore 1.8+**, including **MindSpore 2.0🔥**.
31+
3132
### Major Features
3233

3334
- **Easy-to-Use.** MindCV decomposes the vision framework into various configurable components. It is easy to customize your data pipeline, models, and learning pipeline with MindCV:
@@ -76,9 +77,11 @@ Below are a few code snippets for your taste.
7677
['swin_tiny']
7778
# Create the model object
7879
>>> network = mindcv.create_model('swin_tiny', pretrained=True)
80+
```
81+
```shell
7982
# Validate its accuracy
80-
>>> !python validate.py --model=swin_tiny --pretrained --dataset=imagenet --val_split=validation
81-
{'Top_1_Accuracy': 0.808343989769821, 'Top_5_Accuracy': 0.9527253836317136, 'loss': 0.8474242982580839}
83+
python validate.py --model=swin_tiny --pretrained --dataset=imagenet --val_split=validation
84+
# {'Top_1_Accuracy': 0.80824, 'Top_5_Accuracy': 0.94802, 'loss': 1.7331367141008378}
8285
```
8386

8487
**Image classification demo**
@@ -91,9 +94,9 @@ Right click on the image below and save as `dog.jpg`.
9194

9295
Classify the downloaded image with a pretrained SoTA model:
9396

94-
```pycon
95-
>>> !python infer.py --model=swin_tiny --image_path='./dog.jpg'
96-
{'Labrador retriever': 0.5700152, 'golden retriever': 0.034551315, 'kelpie': 0.010108651, 'Chesapeake Bay retriever': 0.008229004, 'Walker hound, Walker foxhound': 0.007791956}
97+
```shell
98+
python infer.py --model=swin_tiny --image_path='./dog.jpg'
99+
# {'Labrador retriever': 0.5700152, 'golden retriever': 0.034551315, 'kelpie': 0.010108651, 'Chesapeake Bay retriever': 0.008229004, 'Walker hound, Walker foxhound': 0.007791956}
97100
```
98101
The top-1 prediction result is labrador retriever, which is the breed of this cut dog.
99102

@@ -292,9 +295,22 @@ Please see [configs](./configs) for the details about model performance and pret
292295
293296
## What is New
294297
295-
- 2023/6/2
296-
1. New version: `0.2.1` is released!
297-
2. New [documents](https://mindspore-lab.github.io/mindcv/) is online!
298+
- 2023/6/16
299+
1. New version `0.2.2` is released! We upgrade to support `MindSpore` v2.0 while maintaining compatibility of v1.8
300+
2. New models:
301+
- [ConvNextV2](configs/convnextv2)
302+
- mini of [CoAT](configs/coat)
303+
- 1.3 of [MnasNet](configs/mnasnet)
304+
- AMP(O3) version of [ShuffleNetV2](configs/shufflenetv2)
305+
3. New features:
306+
- Gradient Accumulation
307+
- DynamicLossScale for customized [TrainStep](mindcv/utils/train_step.py)
308+
- OneCycleLR and CyclicLR learning rate scheduler
309+
- Refactored Logging
310+
- Pyramid Feature Extraction
311+
4. Bug fixes:
312+
- Serving Deployment Tutorial(mobilenet_v3 doesn't work on ms1.8 when using Ascend backend)
313+
- Some broken links on our documentation website.
298314
299315
See [RELEASE](RELEASE.md) for detailed history.
300316

README_CN.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,22 @@
1313
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
1414
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
1515

16-
[English](README.md) | 中文
16+
[📝使用文档](https://mindspore-lab.github.io/mindcv/zh/) |
17+
[🚀安装教程](https://mindspore-lab.github.io/mindcv/zh/installation/) |
18+
[🎁模型仓库](https://mindspore-lab.github.io/mindcv/zh/modelzoo/) |
19+
[🎉更新日志](https://github.com/mindspore-lab/mindcv/blob/main/RELEASE.md) |
20+
[🐛报告问题](https://github.com/mindspore-lab/mindcv/issues/new/choose)
1721

18-
[简介](#简介) |
19-
[安装](#安装) |
20-
[快速入门](#快速入门) |
21-
[教程](#教程) |
22-
[模型列表](#模型列表) |
23-
[支持算法](#支持算法)
22+
[English](README.md) | 中文
2423

2524
</div>
2625

2726
## 简介
2827

2928
MindCV是一个基于 [MindSpore](https://www.mindspore.cn/) 开发的,致力于计算机视觉相关技术研发的开源工具箱。它提供大量的计算机视觉领域的经典模型和SoTA模型以及它们的预训练权重和训练策略。同时,还提供了自动增强等SoTA算法来提高模型性能。通过解耦的模块设计,您可以轻松地将MindCV应用到您自己的CV任务中。
3029

30+
主分支代码目前支持 **MindSpore 1.8+** 以上的版本,包含 **MindSpore 2.0🔥** 版本。
31+
3132
### 主要特性
3233

3334
- **高易用性** MindCV将视觉任务分解为各种可配置的组件,用户可以轻松地构建自己的数据处理和模型训练流程。
@@ -76,9 +77,12 @@ MindCV是一个基于 [MindSpore](https://www.mindspore.cn/) 开发的,致力
7677
['swin_tiny']
7778
# 创建模型
7879
>>> network = mindcv.create_model('swin_tiny', pretrained=True)
79-
# 验证模型的准确率
80-
>>> !python validate.py --model=swin_tiny --pretrained --dataset=imagenet --val_split=validation
81-
{'Top_1_Accuracy': 0.808343989769821, 'Top_5_Accuracy': 0.9527253836317136, 'loss': 0.8474242982580839}
80+
```
81+
82+
```shell
83+
# 验证模型的准确度
84+
python validate.py --model=swin_tiny --pretrained --dataset=imagenet --val_split=validation
85+
# {'Top_1_Accuracy': 0.80824, 'Top_5_Accuracy': 0.94802, 'loss': 1.7331367141008378}
8286
```
8387

8488
**图片分类示例**
@@ -91,9 +95,9 @@ MindCV是一个基于 [MindSpore](https://www.mindspore.cn/) 开发的,致力
9195

9296
使用加载了预训练参数的SoTA模型对图片进行推理。
9397

94-
```pycon
95-
>>> !python infer.py --model=swin_tiny --image_path='./dog.jpg'
96-
{'Labrador retriever': 0.5700152, 'golden retriever': 0.034551315, 'kelpie': 0.010108651, 'Chesapeake Bay retriever': 0.008229004, 'Walker hound, Walker foxhound': 0.007791956}
98+
```shell
99+
python infer.py --model=swin_tiny --image_path='./dog.jpg'
100+
# {'Labrador retriever': 0.5700152, 'golden retriever': 0.034551315, 'kelpie': 0.010108651, 'Chesapeake Bay retriever': 0.008229004, 'Walker hound, Walker foxhound': 0.007791956}
97101
```
98102

99103
预测结果排名前1的是拉布拉多犬,正是这张图片里的狗狗的品种。
@@ -294,6 +298,23 @@ python train.py --model=resnet50 --dataset=cifar10 \
294298

295299
## 更新
296300

301+
- 2023/6/16
302+
1. 新版本 `0.2.2` 发布啦!我们将`MindSpore`升级到了2.0版本,同时保持了对1.8版本的兼容
303+
2. 新模型:
304+
- [ConvNextV2](configs/convnextv2)
305+
- [CoAT](configs/coat)的mini规格
306+
- [MnasNet](configs/mnasnet)的1.3规格
307+
- [ShuffleNetV2](configs/shufflenetv2)的混合精度(O3)版本
308+
3. 新特性:
309+
- 梯度累加
310+
- 自定义[TrainStep](mindcv/utils/train_step.py)支持了动态损失缩放
311+
- `OneCycleLR``CyclicLR`学习率调度器
312+
- 更好的日志打印与记录
313+
- 金字塔特征抽取
314+
4. 错误修复:
315+
- `Serving`部署教程(mobilenet_v3在昇腾后端的MindSpore1.8版本上不支持)
316+
- 文档网站上的损坏链接
317+
297318
- 2023/6/2
298319
1. 新版本:`0.2.1` 发布
299320
2. 新[文档](https://mindspore-lab.github.io/mindcv/zh/)上线

RELEASE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Release Note
22

3+
## 0.2.2 (2023/6/16)
4+
5+
1. New version `0.2.2` is released! We upgrade to support `MindSpore` v2.0 while maintaining compatibility of v1.8
6+
2. New models:
7+
- [ConvNextV2](configs/convnextv2)
8+
- mini of [CoAT](configs/coat)
9+
- 1.3 of [MnasNet](configs/mnasnet)
10+
- AMP(O3) version of [ShuffleNetV2](configs/shufflenetv2)
11+
3. New features:
12+
- Gradient Accumulation
13+
- DynamicLossScale for customized [TrainStep](mindcv/utils/train_step.py)
14+
- OneCycleLR and CyclicLR learning rate scheduler
15+
- Refactored Logging
16+
- Pyramid Feature Extraction
17+
4. Bug fixes:
18+
- Serving Deployment Tutorial(mobilenet_v3 doesn't work on ms1.8 when using Ascend backend)
19+
- Some broken links on our documentation website.
20+
321
## 0.2.1
422

523
- 2023/6/2

config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ def create_parser():
232232
'Choice: O0 - all FP32, O1 - only cast ops in white-list to FP16, '
233233
'O2 - cast all ops except for blacklist to FP16, '
234234
'O3 - cast all ops to FP16. (default="O0").')
235+
group.add_argument('--val_amp_level', type=str, default='O0',
236+
help='Amp level used in validation '
237+
'Choice: O0 - all FP32, O1 - only cast ops in white-list to FP16, '
238+
'O2 - cast all ops except for blacklist to FP16, '
239+
'O3 - cast all ops to FP16. (default="O0").')
235240
group.add_argument('--loss_scale_type', type=str, default='fixed',
236241
choices=['fixed', 'dynamic', 'auto'],
237242
help='The type of loss scale (default="fixed")')

configs/bit/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ python validate.py -c configs/bit/bit_resnet50_ascend.yaml --data_dir /path/to/i
8181

8282
### Deployment
8383

84-
Please refer to the [deployment tutorial](https://github.com/mindspore-lab/mindcv/blob/main/tutorials/deployment.md) in MindCV.
84+
Please refer to the [deployment tutorial](https://mindspore-lab.github.io/mindcv/tutorials/deployment/) in MindCV.
8585

8686
## References
8787

configs/coat/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ python validate.py -c configs/coat/coat_lite_tiny_ascend.yaml --data_dir /path/t
7474

7575
### Deployment
7676

77-
To deploy online inference services with the trained model efficiently, please refer to the [deployment tutorial](https://github.com/mindspore-lab/mindcv/blob/main/tutorials/deployment.md).
77+
To deploy online inference services with the trained model efficiently, please refer to the [deployment tutorial](https://mindspore-lab.github.io/mindcv/tutorials/deployment/).
7878

7979
## References
8080

configs/coat/coat_mini_ascend.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ val_interval: 1
77

88
# dataset
99
dataset: 'imagenet'
10-
data_dir: '/path/to/imagenet/'
10+
data_dir: '/path/to/imagenet'
1111
shuffle: True
1212
dataset_download: False
1313
batch_size: 32
@@ -59,3 +59,4 @@ filter_bias_and_bn: True
5959
loss_scale: 4096
6060
use_nesterov: False
6161
loss_scale_type: dynamic
62+
drop_overflow_update: True

0 commit comments

Comments
 (0)