Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
windaway 903da0d91a | 2 years ago | |
---|---|---|
ascend310_infer | 2 years ago | |
scripts | 2 years ago | |
src | 2 years ago | |
AdvancedEast.network.png | 2 years ago | |
README.md | 2 years ago | |
eval.py | 2 years ago | |
export.py | 2 years ago | |
postprocess.py | 2 years ago | |
prepare_data.py | 2 years ago | |
preprocess.py | 2 years ago | |
requirements.txt | 2 years ago | |
train.py | 2 years ago | |
train_single_size.py | 2 years ago |
AdvancedEAST is inspired by EAST EAST:An Efficient and Accurate Scene Text Detector.
The architecture of AdvancedEAST is showed below.
This project is inherited by huoyijie/AdvancedEAST(preprocess, network architecture, predict) and BaoWentz/AdvancedEAST-PyTorch(performance).
.
└──advanced_east
├── README.md
├── scripts
├── run_distribute_train_ascend.sh # launch ascend distributed training(8 pcs)
├── run_standalone_train_ascend.sh # launch ascend standalone training(1 pcs)
├── run_distribute_train_gpu.sh # launch gpu distributed training(8 pcs)
└── run_standalone_train_gpu.sh # launch gpu standalone training(1 pcs)
└── eval.sh # evaluate model(1 pcs)
├── src
├── cfg.py # parameter configuration
├── dataset.py # data preprocessing
├── label.py # produce label info
├── logger.py # generate learning rate for each step
├── model.py # define network
├── nms.py # non-maximum suppression
├── predict.py # predict boxes
├── preprocess.py # pre-process data
└── score.py # scoring
└── vgg.py # vgg model
├── export.py # export model for inference
├── prepare_data.py # exec data preprocessing
├── eval.py # eval net
├── train.py # train net on multi-size input
└── train_single_size.py # train net on fix-size input
ICPR MTWI 2018 challenge 2:Text detection of network image,Link. It is not available to download dataset on the origin webpage,
the dataset is now provided by the author of the original project,Baiduyun link, password: ye9y. There are 10000 images and corresponding label
information in total in the dataset, which is divided into 2 directories with 9000 and 1000 samples respectively. In the origin training setting, training set and validation set are partitioned at the ratio
of 9:1. If you want to use your own dataset, please modify the configuration of dataset in /src/config.py. The organization of dataset file is listed as below:
. └─data_dir ├─images # dataset └─txt # vertex of text boxes
Some parameters in config.py:
'validation_split_ratio': 0.1, # ratio of validation dataset
'total_img': 10000, # total number of samples in dataset
'data_dir': './icpr/', # dir of dataset
'train_fname': 'train.txt', # the file which stores the images file name in training dataset
'val_fname': 'val.txt', # the file which stores the images file name in validation dataset
'mindsrecord_train_file': 'advanced-east.mindrecord', # mindsrecord of training dataset
'mindsrecord_test_file': 'advanced-east-val.mindrecord', # mindsrecord of validation dataset
'origin_image_dir_name': 'images_9000/', # dir which stores the original images.
'train_image_dir_name': 'images_train/', # dir which stores the preprocessed images.
'origin_txt_dir_name': 'txt_9000/', # dir which stores the original text verteices.
'train_label_dir_name': 'labels_train/', # dir which stores the preprocessed text verteices.
Resize all the images to fixed size, and convert the label information(the vertex of text box) into the format used in training and evaluation, then the Mindsrecord files are generated.
python preparedata.py
Prepare the VGG16 pre-training model. Due to copyright restrictions, please go to https://github.com/machrisaa/tensorflow-vgg to download the VGG16 pre-training model and place it in the src folder.
If you have the checkpoint of VGG16, you can load the parameters in this way, the training training time can be shorten obviously.
python train.py --device_target="Ascend" --is_distributed=0 --device_id=0 > output.train.log 2>&1 &
python train.py --device_target="GPU" --is_distributed=0 --device_id=0 > output.train.log 2>&1 &
python train_single_size.py --device_target="Ascend" --is_distributed=0 --device_id=2 --size=256 > output.train.log 2>&1 &
# running on distributed environment(8p)
bash run_distribute_train.sh [DATSET_PATH] [RANK_TABLE_FILE]
The detailed training parameters are in /src/config.py。
# running on distributed environment(8p)
bash scripts/run_distribute_train_gpu.sh
The detailed training parameters are in /src/config.py。
config.py:
'initial_epoch': 0, # epoch to init
'learning_rate': 1e-4, # learning rate when initialization
'decay': 5e-4, # weightdecay parameter
'epsilon': 1e-4, # the value of epsilon in loss computation
'batch_size': 8, # batch size
'lambda_inside_score_loss': 4.0, # coef of inside_score_loss
'lambda_side_vertex_code_loss': 1.0, # coef of vertex_code_loss
"lambda_side_vertex_coord_loss": 1.0, # coef of vertex_coord_loss
'max_train_img_size': 448, # max size of training images
'max_predict_img_size': 448, # max size of the images to predict
'ckpt_save_max': 10, # maximum of ckpt in dir
'saved_model_file_path': './saved_model/', # dir of saved model
'norm': 'BN', # normalization in feature merging branch
The above python command will run in the background, you can view the results through the file output.eval.log. You will get the accuracy as following.
You can get loss, accuracy, recall, F1 score and the box vertices of an image.
# evaluate loss of the model
bash scripts/run_distribute_train_gpu.sh
# evaluate loss of the model
bash scripts/run_distribute_train_gpu.sh
# get prediction of an image
bash run_eval.sh 0_8-24_1012.ckpt pred ./demo/001.png
python export.py --ckpt_file [CKPT_PATH] --file_name [FILE_NAME] --file_format [FILE_FORMAT]
The ckpt_file parameter is required,
file_format
should be in ["AIR", "MINDIR"]
Before performing inference, the mindir file must be exported by export.py
script. We only provide an example of inference using MINDIR model.
Current batch_size can only be set to 1.
# Ascend310 inference
bash run_infer_310.sh [MINDIR_PATH] [NEED_PREPROCESS] [DEVICE_ID]
NEED_PREPROCESS
means weather need preprocess or not, it's value is 'y' or 'n'.
DEVICE_ID
is optional, default value is 0.
Inference result is saved in current path, you can find result in acc.log file.
The performance listed below are acquired with the default configurations in /src/config.py.
The Normalization of model training on Ascend is GN, the model training on GPU is used BN.
Parameters | single Ascend | 8 GPUs |
---|---|---|
Model Version | AdvancedEAST | AdvancedEAST |
Resources | Ascend 910 | Tesla V100S-PCIE 32G |
MindSpore Version | 1.1 | 1.1 |
Dataset | MTWI-2018 | MTWI-2018 |
Training Parameters | epoch=6, batch_size=2, lr=1e-4 | epoch=6, batch_size=2, lr=1e-3 |
Optimizer | AdamWeightDecay | AdamWeightDecay |
Loss Function | QuadLoss | QuadLoss |
Outputs | matrix with size of 3x64x64,3x96x96,3x112x112 | matrix with size of 3x64x64,3x96x96,3x112x112 |
Loss | 0.1 | 0.1 |
Total Time | 28 mins, 60 mins, 90 mins | 4.9 mins, 10.3 mins, 14.5 mins |
Checkpoints | 173MB(.ckpt file) | 173MB(.ckpt file) |
On the default
Parameters | single Ascend | 8 GPUs |
---|---|---|
Model Version | AdvancedEAST | AdvancedEAST |
Resources | Ascend 910 | Tesla V100S-PCIE 32G |
MindSpore Version | 1.1 | 1.1 |
Dataset | 1000 images | 1000 images |
batch_size | 8 | 8 |
Outputs | precision, recall, F score | precision, recall, F score |
performance | 94.35, 55.45, 66.31 | 92.53 55.49 66.01 |
Please check the official homepage.
No Description
Python Shell C++ Text
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》