(cfg)
| 156 | |
| 157 | |
| 158 | def build_rec_process(cfg): |
| 159 | transforms = [] |
| 160 | ratio_resize_flag = True |
| 161 | for op in cfg['Eval']['dataset']['transforms']: |
| 162 | op_name = list(op)[0] |
| 163 | if 'Resize' in op_name or 'Processor' in op_name: |
| 164 | ratio_resize_flag = False |
| 165 | if 'Label' in op_name: |
| 166 | continue |
| 167 | elif op_name in ['RecResizeImg']: |
| 168 | op[op_name]['infer_mode'] = True |
| 169 | elif op_name == 'KeepKeys': |
| 170 | if cfg['Architecture']['algorithm'] in ['SAR', 'RobustScanner']: |
| 171 | if 'valid_ratio' in op[op_name]['keep_keys']: |
| 172 | op[op_name]['keep_keys'] = ['image', 'valid_ratio'] |
| 173 | else: |
| 174 | op[op_name]['keep_keys'] = ['image'] |
| 175 | else: |
| 176 | op[op_name]['keep_keys'] = ['image'] |
| 177 | transforms.append(op) |
| 178 | return transforms, ratio_resize_flag |
| 179 | |
| 180 | |
| 181 | def set_device(device, numId=0): |
no outgoing calls
no test coverage detected