CnOCR: Awesome Chinese/English OCR Python toolkits based on PyTorch. It comes with 20+ well-trained models for different application scenarios and can be used directly after installation. 【基于 PyTorch/MXNet 的中文/英文 OCR Python 包。】
raise TypeError(f"Object of type {type(o).__name__} is not JSON serializable")
TypeError: Object of type float32 is not JSON serializable
经排查发现是此处漏掉了score的类型转换,此处的score类型是np.float32无法序列化
for _one in res:
_one['position'] = _one['position'].tolist()
_one['score'] = float(_one['score']) #此处score也要加上转换
if 'cropped_img' in _one:
_one.pop('cropped_img')
当使用 scripts/flask-serve.py 脚本部署 rec_model_name='ch_PP-OCRv3' 的http服务时会出现如下错误
经排查发现是此处漏掉了score的类型转换,此处的score类型是np.float32无法序列化