params.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # -*- coding:utf-8 -*-
  2. from __future__ import absolute_import
  3. from __future__ import division
  4. from __future__ import print_function
  5. class Config(object):
  6. pass
  7. def read_params():
  8. cfg = Config()
  9. #params for text detector
  10. cfg.det_algorithm = "DB"
  11. cfg.det_model_dir = "./utils/PaddleOCR/inference/ch_ppocr_mobile_v2.0_det_infer/"
  12. cfg.det_limit_side_len = 960
  13. cfg.det_limit_type = 'max'
  14. #DB parmas
  15. cfg.det_db_thresh = 0.3
  16. cfg.det_db_box_thresh = 0.5
  17. cfg.det_db_unclip_ratio = 2.0
  18. cfg.use_dilation = False
  19. #EAST parmas
  20. cfg.det_east_score_thresh = 0.8
  21. cfg.det_east_cover_thresh = 0.1
  22. cfg.det_east_nms_thresh = 0.2
  23. #params for text recognizer
  24. cfg.rec_algorithm = "CRNN"
  25. cfg.rec_model_dir = "./utils/PaddleOCR/inference/ch_ppocr_mobile_v2.0_rec_infer/"
  26. cfg.rec_image_shape = "3, 32, 64"
  27. cfg.rec_char_type = 'ch'
  28. cfg.rec_batch_num = 1
  29. cfg.max_text_length = 20
  30. cfg.rec_char_dict_path = "./utils/PaddleOCR/ppocr/utils/ppocr_keys_v1.txt"
  31. cfg.use_space_char = True
  32. #params for text classifier
  33. cfg.use_angle_cls = False
  34. cfg.cls_model_dir = "./utils/PaddleOCR/inference/ch_ppocr_mobile_v2.0_cls_infer/"
  35. cfg.cls_image_shape = "3, 48, 192"
  36. cfg.label_list = ['0', '180']
  37. cfg.cls_batch_num = 30
  38. cfg.cls_thresh = 0.9
  39. cfg.use_pdserving = False
  40. cfg.use_tensorrt = False
  41. cfg.drop_score = 0.5
  42. return cfg