diff --git a/configs/sr/sr_telescope.yml b/configs/sr/sr_telescope.yml index dc0b195ba6a7e5d3cf34f811bc6bf6e58fd98ea6..33d07e8f2189a042de9541c68b06f6a6366147fb 100644 --- a/configs/sr/sr_telescope.yml +++ b/configs/sr/sr_telescope.yml @@ -80,5 +80,5 @@ Eval: shuffle: False drop_last: False batch_size_per_card: 16 - num_workers: 0 + num_workers: 4 diff --git a/doc/imgs_results/sr_word_52.png b/doc/imgs_results/sr_word_52.png new file mode 100644 index 0000000000000000000000000000000000000000..c983e9ad7a82573e42d9f52248c0ec535c455197 Binary files /dev/null and b/doc/imgs_results/sr_word_52.png differ diff --git a/ppocr/losses/__init__.py b/ppocr/losses/__init__.py index 46d6e81f29bb53fd5bcbfcef6ec183e7e69df76c..cfa9d5fad5811dd3e9f77c28f4c58a95cd15afe8 100755 --- a/ppocr/losses/__init__.py +++ b/ppocr/losses/__init__.py @@ -25,6 +25,8 @@ from .det_east_loss import EASTLoss from .det_sast_loss import SASTLoss from .det_pse_loss import PSELoss from .det_fce_loss import FCELoss +from .det_ct_loss import CTLoss +from .det_drrg_loss import DRRGLoss # rec loss from .rec_ctc_loss import CTCLoss @@ -37,6 +39,7 @@ from .rec_pren_loss import PRENLoss from .rec_multi_loss import MultiLoss from .rec_vl_loss import VLLoss from .rec_spin_att_loss import SPINAttentionLoss +from .rec_rfl_loss import RFLLoss # cls loss from .cls_loss import ClsLoss @@ -69,7 +72,7 @@ def build_loss(config): 'CELoss', 'TableAttentionLoss', 'SARLoss', 'AsterLoss', 'SDMGRLoss', 'VQASerTokenLayoutLMLoss', 'LossFromOutput', 'PRENLoss', 'MultiLoss', 'TableMasterLoss', 'SPINAttentionLoss', 'VLLoss', 'StrokeFocusLoss', - 'SLALoss', 'TelescopeLoss' + 'SLALoss', 'CTLoss', 'RFLLoss', 'DRRGLoss', 'TelescopeLoss' ] config = copy.deepcopy(config) module_name = config.pop('name') diff --git a/test_tipc/configs/sr_telescope/sr_telescope.yml b/test_tipc/configs/sr_telescope/sr_telescope.yml new file mode 100644 index 0000000000000000000000000000000000000000..d3c10448e423ff0305950ea39664379e60f8a113 --- /dev/null +++ b/test_tipc/configs/sr_telescope/sr_telescope.yml @@ -0,0 +1,84 @@ +Global: + use_gpu: true + epoch_num: 2 + log_smooth_window: 20 + print_batch_step: 10 + save_model_dir: ./output/sr/sr_telescope/ + save_epoch_step: 3 + # evaluation is run every 2000 iterations + eval_batch_step: [0, 1000] + cal_metric_during_train: False + pretrained_model: + checkpoints: + save_inference_dir: ./output/sr/sr_telescope/infer + use_visualdl: False + infer_img: doc/imgs_words_en/word_52.png + # for data or label process + character_dict_path: + max_text_length: 100 + infer_mode: False + use_space_char: False + save_res_path: ./output/sr/predicts_telescope.txt + +Optimizer: + name: Adam + beta1: 0.5 + beta2: 0.999 + clip_norm: 0.25 + lr: + learning_rate: 0.0001 + +Architecture: + model_type: sr + algorithm: Telescope + Transform: + name: TBSRN + STN: True + infer_mode: False + +Loss: + name: TelescopeLoss + confuse_dict_path: ./ppocr/utils/dict/confuse.pkl + + +PostProcess: + name: None + +Metric: + name: SRMetric + main_indicator: all + +Train: + dataset: + name: LMDBDataSetSR + data_dir: ./train_data/TextZoom/train + transforms: + - SRResize: + imgH: 32 + imgW: 128 + down_sample_scale: 2 + - KeepKeys: + keep_keys: ['img_lr', 'img_hr', 'label'] # dataloader will return list in this order + loader: + shuffle: False + batch_size_per_card: 16 + drop_last: True + num_workers: 4 + +Eval: + dataset: + name: LMDBDataSetSR + data_dir: ./train_data/TextZoom/test + transforms: + - SRResize: + imgH: 32 + imgW: 128 + down_sample_scale: 2 + - KeepKeys: + keep_keys: ['img_lr', 'img_hr', 'label'] # dataloader will return list in this order + loader: + shuffle: False + drop_last: False + batch_size_per_card: 16 + num_workers: 4 + diff --git a/test_tipc/configs/sr_telescope/train_infer_python.txt b/test_tipc/configs/sr_telescope/train_infer_python.txt new file mode 100644 index 0000000000000000000000000000000000000000..4dcfa29ee146b3b2662122966d859142bb0ed0c5 --- /dev/null +++ b/test_tipc/configs/sr_telescope/train_infer_python.txt @@ -0,0 +1,53 @@ +===========================train_params=========================== +model_name:sr_telescope +python:python3.7 +gpu_list:0|0,1 +Global.use_gpu:True|True +Global.auto_cast:null +Global.epoch_num:lite_train_lite_infer=2|whole_train_whole_infer=300 +Global.save_model_dir:./output/ +Train.loader.batch_size_per_card:lite_train_lite_infer=16|whole_train_whole_infer=16 +Global.pretrained_model:null +train_model_name:latest +train_infer_img_dir:./inference/sr_inference +null:null +## +trainer:norm_train +norm_train:tools/train.py -c test_tipc/configs/sr_telescope/sr_telescope.yml -o +pact_train:null +fpgm_train:null +distill_train:null +null:null +null:null +## +===========================eval_params=========================== +eval:tools/eval.py -c test_tipc/configs/sr_telescope/sr_telescope.yml -o +null:null +## +===========================infer_params=========================== +Global.save_inference_dir:./output/ +Global.checkpoints: +norm_export:tools/export_model.py -c test_tipc/configs/sr_telescope/sr_telescope.yml -o +quant_export:null +fpgm_export:null +distill_export:null +export1:null +export2:null +## +train_model:./inference/sr_telescope_train/best_accuracy +infer_export:tools/export_model.py -c test_tipc/configs/sr_telescope/sr_telescope.yml -o +infer_quant:False +inference:tools/infer/predict_sr.py --sr_image_shape="1,32,128" --rec_algorithm="Telescope" --min_subgraph_size=5 +--use_gpu:True|False +--enable_mkldnn:False +--cpu_threads:6 +--rec_batch_num:1 +--use_tensorrt:False +--precision:fp32 +--rec_model_dir: +--image_dir:./inference/sr_inference +--save_log_path:./test/output/ +--benchmark:True +null:null +===========================infer_benchmark_params========================== +random_infer_input:[{float32,[1,32,128]}]