# Contents
- [CNNCTC Description](#CNNCTC-description)
- [Model Architecture](#model-architecture)
- [Dataset](#dataset)
- [Features](#features)
- [Mixed Precision](#mixed-precision)
- [Environment Requirements](#environment-requirements)
- [Quick Start](#quick-start)
- [Script Description](#script-description)
- [Script and Sample Code](#script-and-sample-code)
- [Script Parameters](#script-parameters)
- [Training Process](#training-process)
- [Training](#training)
- [Distributed Training](#distributed-training)
- [Evaluation Process](#evaluation-process)
- [Evaluation](#evaluation)
- [Inference Process](#inference-process)
- [Export MindIR](#export-mindir)
- [Infer on Ascend310](#infer-on-ascend310)
- [result](#result)
- [Model Description](#model-description)
- [Performance](#performance)
- [Training Performance](#training-performance)
- [Evaluation Performance](#evaluation-performance)
- [Inference Performance](#inference-performance)
- [How to use](#how-to-use)
- [Inference](#inference)
- [Continue Training on the Pretrained Model](#continue-training-on-the-pretrained-model)
- [Transfer Learning](#transfer-learning)
- [Description of Random Situation](#description-of-random-situation)
- [ModelZoo Homepage](#modelzoo-homepage)
# [CNNCTC Description](#contents)
This paper proposes three major contributions to addresses scene text recognition (STR).
First, we examine the inconsistencies of training and evaluation datasets, and the performance gap results from inconsistencies.
Second, we introduce a unified four-stage STR framework that most existing STR models fit into.
Using this framework allows for the extensive evaluation of previously proposed STR modules and the discovery of previously
unexplored module combinations. Third, we analyze the module-wise contributions to performance in terms of accuracy, speed,
and memory demand, under one consistent set of training and evaluation datasets. Such analyses clean up the hindrance on the current
comparisons to understand the performance gain of the existing modules.
[Paper](https://arxiv.org/abs/1904.01906): J. Baek, G. Kim, J. Lee, S. Park, D. Han, S. Yun, S. J. Oh, and H. Lee, “What is wrong with scene text recognition model comparisons? dataset and model analysis,” ArXiv, vol. abs/1904.01906, 2019.
# [Model Architecture](#contents)
This is an example of training CNN+CTC model for text recognition on MJSynth and SynthText dataset with MindSpore.
# [Dataset](#contents)
Note that you can run the scripts based on the dataset mentioned in original paper or widely used in relevant domain/network architecture. In the following sections, we will introduce how to run the scripts using the related dataset below.
The [MJSynth](https://www.robots.ox.ac.uk/~vgg/data/text/) and [SynthText](https://github.com/ankush-me/SynthText) dataset are used for model training. The [The IIIT 5K-word dataset](https://cvit.iiit.ac.in/research/projects/cvit-projects/the-iiit-5k-word-dataset) dataset is used for evaluation.
- step 1:
All the datasets have been preprocessed and stored in .lmdb format and can be downloaded [**HERE**](https://drive.google.com/drive/folders/192UfE9agQUMNq6AgU3_E05_FcPZK4hyt).
- step 2:
Uncompress the downloaded file, rename the MJSynth dataset as MJ, the SynthText dataset as ST and the IIIT dataset as IIIT.
- step 3:
Move above mentioned three datasets into `cnnctc_data` folder, and the structure should be as below:
```text
|--- CNNCTC/
|--- cnnctc_data/
|--- ST/
data.mdb
lock.mdb
|--- MJ/
data.mdb
lock.mdb
|--- IIIT/
data.mdb
lock.mdb
......
```
- step 4:
Preprocess the dataset by running:
```bash
python src/preprocess_dataset.py
```
This takes around 75 minutes.
# [Features](#contents)
## Mixed Precision
The [mixed precision](https://mindspore.cn/tutorials/en/master/advanced/mixed_precision.html) training method accelerates the deep learning neural network training process by using both the single-precision and half-precision data formats, and maintains the network precision achieved by the single-precision training at the same time. Mixed precision training can accelerate the computation process, reduce memory usage, and enable a larger model or batch size to be trained on specific hardware.
For FP16 operators, if the input data type is FP32, the backend of MindSpore will automatically handle it with reduced precision. Users could check the reduced-precision operators by enabling INFO log and then searching ‘reduce precision’.
# [Environment Requirements](#contents)
- Hardware(Ascend/GPU)
- Prepare hardware environment with Ascend or GPU processor.
- Framework
- [MindSpore](https://www.mindspore.cn/install/en)
- For more information, please check the resources below:
- [MindSpore tutorials](https://www.mindspore.cn/tutorials/en/master/index.html)
- [MindSpore Python API](https://www.mindspore.cn/docs/en/master/index.html)
# [Quick Start](#contents)
- Install dependencies:
```bash
pip install lmdb
pip install Pillow
pip install tqdm
pip install six
```
```default_config.yaml
TRAIN_DATASET_PATH: /home/DataSet/MJ-ST-IIIT/ST-MJ/
TRAIN_DATASET_INDEX_PATH: /home/DataSet/MJ-ST-IIIT/st_mj_fixed_length_index_list.pkl
TEST_DATASET_PATH: /home/DataSet/MJ-ST-IIIT/IIIT5K_3000
Modify the parameters according to the actual path
```
- Standalone Ascend Training:
```bash
bash scripts/run_standalone_train_ascend.sh $DEVICE_ID $PRETRAINED_CKPT(options)
# example: bash scripts/run_standalone_train_ascend.sh 0
```
- Standalone GPU Training:
```bash
bash scripts/run_standalone_train_gpu.sh $PRETRAINED_CKPT(options)
```
- Distributed Ascend Training:
```bash
bash scripts/run_distribute_train_ascend.sh $RANK_TABLE_FILE $PRETRAINED_CKPT(options)
# example: bash scripts/run_distribute_train_ascend.sh ~/hccl_8p.json
```
- Distributed GPU Training:
```bash
bash scripts/run_distribute_train_gpu.sh $PRETRAINED_CKPT(options)
```
- Ascend Evaluation:
```bash
bash scripts/run_eval_ascend.sh $DEVICE_ID $TRAINED_CKPT
# example: scripts/run_eval_ascend.sh 0 /home/model/cnnctc/ckpt/CNNCTC-1_8000.ckpt
```
- GPU Evaluation:
```bash
bash scripts/run_eval_gpu.sh $TRAINED_CKPT
```
# [Script Description](#contents)
## [Script and Sample Code](#contents)
The entire code structure is as following:
```text
|--- CNNCTC/
|---README.md // descriptions about cnnctc
|---README_cn.md // descriptions about cnnctc
|---default_config.yaml // config file
|---train.py // train scripts
|---eval.py // eval scripts
|---export.py // export scripts
|---preprocess.py // preprocess scripts
|---postprocess.py // postprocess scripts
|---ascend310_infer // application for 310 inference
|---scripts
|---run_infer_310.sh // shell script for infer on ascend310
|---run_standalone_train_ascend.sh // shell script for standalone on ascend
|---run_standalone_train_gpu.sh // shell script for standalone on gpu
|---run_distribute_train_ascend.sh // shell script for distributed on ascend
|---run_distribute_train_gpu.sh // shell script for distributed on gpu
|---run_eval_ascend.sh // shell script for eval on ascend
|---src
|---__init__.py // init file
|---cnn_ctc.py // cnn_ctc network
|---callback.py // loss callback file
|---dataset.py // process dataset
|---util.py // routine operation
|---preprocess_dataset.py // preprocess dataset
|--- model_utils
|---config.py // Parameter config
|---moxing_adapter.py // modelarts device configuration
|---device_adapter.py // Device Config
|---local_ada
没有合适的资源?快使用搜索试试~ 我知道了~
MindSpore用户增强模型安全性和可信度的工具箱 关注AI的安全和隐私问题
共381个文件
py:290个
rst:24个
md:23个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 122 浏览量
2023-11-24
11:47:39
上传
评论
收藏 34.48MB ZIP 举报
温馨提示
MindArmour关注AI的安全和隐私问题。致力于增强模型的安全可信、保护用户的数据隐私。主要包含3个模块:对抗样本鲁棒性模块、Fuzz Testing模块、隐私保护与评估模块。
资源推荐
资源详情
资源评论
收起资源包目录
MindSpore用户增强模型安全性和可信度的工具箱 关注AI的安全和隐私问题 (381个子文件)
checkpoint_lenet-10_1875.ckpt 483KB
.gitignore 377B
.gitkeep 0B
.gitkeep 0B
target1.jpg 638KB
input1.jpg 86KB
labels.json 205B
settings.json 36B
LICENSE 11KB
README.md 25KB
对OCR模型CNN-CTC的鲁棒性评测.md 21KB
README_CN.md 20KB
README.md 11KB
RELEASE.md 8KB
README.md 8KB
scc_readme.md 8KB
README.md 5KB
README.md 3KB
README.md 3KB
README.md 3KB
README.md 3KB
README.md 2KB
RELEASE_CN.md 2KB
README.md 1KB
README.md 1KB
README.md 1KB
bug-report.md 966B
PULL_REQUEST_TEMPLATE.md 691B
PULL_REQUEST_TEMPLATE.md 668B
RFC.md 504B
task-tracking.md 284B
README.md 130B
NOTICE 69B
100_test_audio_list.npy 51.45MB
test_images.npy 39MB
concept_train_lenet.npy 3.91MB
concept_test_lenet2.npy 1.56MB
concept_test_lenet.npy 400KB
concept_test_lenet1.npy 400KB
test_labels.npy 39KB
OWNERS 83B
fuzzer_architecture_en.png 385KB
fuzzer_architecture_cn.png 385KB
privacy_leakage_en.png 363KB
privacy_leakage_cn.png 326KB
adversarial_robustness_en.png 290KB
adv.png 260KB
adversarial_robustness_cn.png 232KB
differential_privacy_architecture_cn.png 231KB
differential_privacy_architecture_en.png 213KB
result_demo.png 44KB
catalog.png 14KB
name_format.png 8KB
iterative_gradient_method.py 52KB
conctrl.py 42KB
fuzzing.py 39KB
model.py 32KB
model_coverage_metrics.py 30KB
monitor.py 25KB
pso_attack.py 24KB
transforms.py 24KB
gradient_method.py 21KB
hop_skip_jump_attack.py 21KB
genetic_attack.py 21KB
mechanisms.py 20KB
faster_rcnn_r50.py 19KB
natural_evolutionary_strategy.py 19KB
dataset.py 18KB
carlini_wagner.py 18KB
yolo.py 18KB
test_natural_robustness.py 16KB
test_iterative_gradient_method.py 16KB
_check_param.py 16KB
deep_fool.py 15KB
concept_drift_check_time_series.py 15KB
util.py 15KB
resnet.py 14KB
transformation.py 14KB
cnn_ctc.py 14KB
pointwise_attack.py 14KB
fault_injection.py 14KB
rpn.py 13KB
mnist_evaluation.py 13KB
inversion_attack.py 13KB
membership_inference.py 13KB
deepspeech2.py 12KB
test_mechanisms.py 12KB
luminance.py 12KB
similarity_detector.py 12KB
test_gradient_method.py 11KB
dataset.py 11KB
attack.py 11KB
adversarial_defense.py 11KB
model.py 11KB
query_detector.py 11KB
attack.py 11KB
sensitivity_convergence_coverage.py 11KB
test_fault_injection.py 10KB
lbfgs.py 10KB
mag_net.py 10KB
共 381 条
- 1
- 2
- 3
- 4
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6649
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功