🔧 修复版面分析JSON序列化numpy类型兼容性问题 #4396
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 变更说明
修复了PaddleX版面分析结果JSON序列化时numpy类型不兼容的问题。
🔗 关联Issue
Fixes #4395
🛠️ 主要变更
_format_data
函数中添加了对np.int32
,np.int64
,np.float32
,np.float64
类型的支持✅ 测试
📋 检查清单
🔍 技术细节
修复了
paddlex/inference/common/result/mixin.py
中_format_data
函数对numpy类型的处理:这样可以确保所有常见的numpy数值类型都能正确序列化为JSON。