formula_rec.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. # copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import random
  15. import numpy as np
  16. from PIL import Image, ImageDraw
  17. from .base import CVResult
  18. from ...utils import logging
  19. class FormulaRecResult(CVResult):
  20. _HARD_FLAG = False
  21. def _to_str(self, *args, **kwargs):
  22. return super()._to_str(*args, **kwargs).replace("\\\\", "\\")
  23. def _to_img(
  24. self,
  25. ):
  26. """draw formula result"""
  27. logging.warning("FormulaRecResult don't support save to img!")
  28. return None