未验证 提交 0e9c6630 编写于 作者: H huangjun12 提交者: GitHub

fix det v4 bug in dynamic ratio (#9874)

* fix set bug

* refine 960 to 640

* fix details

* add epoch num

* add rep export

* use db head
上级 096fd271
Global: Global:
debug: false debug: false
use_gpu: true use_gpu: true
epoch_num: 500 epoch_num: &epoch_num 500
log_smooth_window: 20 log_smooth_window: 20
print_batch_step: 100 print_batch_step: 100
save_model_dir: ./output/ch_PP-OCRv3_mv3_cbnlocal_shrink/ save_model_dir: ./output/ch_PP-OCRv4
save_epoch_step: 10 save_epoch_step: 10
eval_batch_step: eval_batch_step:
- 0 - 0
...@@ -31,9 +31,8 @@ Architecture: ...@@ -31,9 +31,8 @@ Architecture:
out_channels: 96 out_channels: 96
shortcut: True shortcut: True
Head: Head:
name: PFHeadLocal name: DBHead
k: 50 k: 50
mode: "small"
Loss: Loss:
name: DBLoss name: DBLoss
...@@ -96,19 +95,19 @@ Train: ...@@ -96,19 +95,19 @@ Train:
- 3 - 3
- EastRandomCropData: - EastRandomCropData:
size: size:
- 960 - 640
- 960 - 640
max_tries: 50 max_tries: 50
keep_ratio: true keep_ratio: true
- MakeBorderMap: - MakeBorderMap:
shrink_ratio: 0.4 shrink_ratio: 0.4
thresh_min: 0.3 thresh_min: 0.3
thresh_max: 0.7 thresh_max: 0.7
total_epoch: 500 total_epoch: *epoch_num
- MakeShrinkMap: - MakeShrinkMap:
shrink_ratio: 0.4 shrink_ratio: 0.4
min_text_size: 8 min_text_size: 8
total_epoch: 500 total_epoch: *epoch_num
- NormalizeImage: - NormalizeImage:
scale: 1./255. scale: 1./255.
mean: mean:
......
Global: Global:
debug: false debug: false
use_gpu: true use_gpu: true
epoch_num: 500 epoch_num: &epoch_num 500
log_smooth_window: 20 log_smooth_window: 20
print_batch_step: 100 print_batch_step: 100
save_model_dir: ./output/ch_PP-OCRv3_mv3_cbnlocal_shrink/ save_model_dir: ./output/ch_PP-OCRv4
save_epoch_step: 10 save_epoch_step: 10
eval_batch_step: eval_batch_step:
- 0 - 0
...@@ -96,19 +96,19 @@ Train: ...@@ -96,19 +96,19 @@ Train:
- 3 - 3
- EastRandomCropData: - EastRandomCropData:
size: size:
- 960 - 640
- 960 - 640
max_tries: 50 max_tries: 50
keep_ratio: true keep_ratio: true
- MakeBorderMap: - MakeBorderMap:
shrink_ratio: 0.4 shrink_ratio: 0.4
thresh_min: 0.3 thresh_min: 0.3
thresh_max: 0.7 thresh_max: 0.7
total_epoch: 500 total_epoch: *epoch_num
- MakeShrinkMap: - MakeShrinkMap:
shrink_ratio: 0.4 shrink_ratio: 0.4
min_text_size: 8 min_text_size: 8
total_epoch: 500 total_epoch: *epoch_num
- NormalizeImage: - NormalizeImage:
scale: 1./255. scale: 1./255.
mean: mean:
......
...@@ -51,22 +51,22 @@ class SimpleDataSet(Dataset): ...@@ -51,22 +51,22 @@ class SimpleDataSet(Dataset):
if self.mode == "train" and self.do_shuffle: if self.mode == "train" and self.do_shuffle:
self.shuffle_data_random() self.shuffle_data_random()
self.set_epoch_as_seed(self.seed) self.set_epoch_as_seed(self.seed, dataset_config)
self.ops = create_operators(dataset_config['transforms'], global_config) self.ops = create_operators(dataset_config['transforms'], global_config)
self.ext_op_transform_idx = dataset_config.get("ext_op_transform_idx", self.ext_op_transform_idx = dataset_config.get("ext_op_transform_idx",
2) 2)
self.need_reset = True in [x < 1 for x in ratio_list] self.need_reset = True in [x < 1 for x in ratio_list]
def set_epoch_as_seed(self, seed): def set_epoch_as_seed(self, seed, dataset_config):
if self.mode is 'train': if self.mode == 'train':
try: try:
dataset_config['transforms'][5]['MakeBorderMap'][ dataset_config['transforms'][5]['MakeBorderMap'][
'epoch'] = seed if seed is not None else 0 'epoch'] = seed if seed is not None else 0
dataset_config['transforms'][6]['MakeShrinkMap'][ dataset_config['transforms'][6]['MakeShrinkMap'][
'epoch'] = seed if seed is not None else 0 'epoch'] = seed if seed is not None else 0
except Exception as E: except Exception as E:
logger.info(E) print(E)
return return
def get_image_info_list(self, file_list, ratio_list): def get_image_info_list(self, file_list, ratio_list):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册