__all__ = ["Args", "ArgType"] class Args: def __init__(self, **kwargs): self.__update( use_gpu=False, precision="fp32", use_tensorrt=False, # gpu gpu_mem=500, max_batch_size=6, min_subgraph_size=15, # cpu enable_mkldnn=True, cpu_threads=16, # detector det_model_dir="hmOCR/static/det", det_algorithm="DB", det_limit_side_len=960, det_limit_type="max", det_db_thresh=0.3, det_db_box_thresh=0.6, det_db_unclip_ratio=1.5, det_use_dilation=False, det_db_score_mode="fast", det_box_type="quad", # classifier cls_model_dir="hmOCR/static/cls", cls_image_shape="3, 48, 192", cls_batch_num=6, cls_thresh=0.9, cls_label_list=["0", "180"], # recognizer rec_model_dir="hmOCR/static/rec", rec_algorithm="SVTR_LCNet", rec_image_shape="3, 48, 320", rec_batch_num=8, max_text_length=25, rec_char_dict_path="hmOCR/static/key-set.txt", use_space_char=False, # OCR drop_score=0.5, workers=5 ) self.__update(**kwargs) def __update(self, **kwargs): for k, v in kwargs.items(): self.__dict__[k] = v def __getattr__(self, key: "str"): return self.__dict__[key] def __setattr__(self, key: "str", value): self.__dict__[key] = value ArgType = Args