fix(perception): disable PaddleOCR doc-unwarping for screenshots
Tests / Test tests.test_device_config.test_device_config_store_settings_get_set_and_defaults failed
Tests / Test tests.test_device_config.test_device_config_store_settings_get_set_and_defaults failed
PaddleOCR's OCR.yaml pipeline defaults to use_doc_orientation_classify
and use_doc_unwarping enabled, which are meant for photographed paper
documents. Applied to a flat, upright device screenshot, UVDoc
geometrically warps the image before detection, and returns box
coordinates in that warped space with no inverse mapping back to the
original image.
Verified on a real screenshot: with unwarping on, the same detected
element ("新项目") shifts from y=158 to y=71 versus the original image,
and 2 boxes near the top edge (status bar time/battery) are dropped
entirely. Disabling both flags by default (still overridable via
explicit kwargs) makes detected boxes match the original screenshot.
This commit is contained in:
@@ -33,6 +33,16 @@ class OCRBox:
|
||||
|
||||
class PaddleOCREngine:
|
||||
def __init__(self, **kwargs: Any) -> None:
|
||||
# Device screenshots are already upright, flat digital captures, not
|
||||
# photographed paper documents, so PaddleOCR's document-preprocessing
|
||||
# models (orientation classification + UVDoc unwarping) have nothing
|
||||
# real to correct. Left at their library defaults (True), they still
|
||||
# run, geometrically warp the image, and detect/recognize text against
|
||||
# that warped image, returning box coordinates that no longer line up
|
||||
# with the original screenshot. Callers can still opt back in via an
|
||||
# explicit kwarg.
|
||||
kwargs.setdefault("use_doc_orientation_classify", False)
|
||||
kwargs.setdefault("use_doc_unwarping", False)
|
||||
self.kwargs = kwargs
|
||||
self._engine: Any | None = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user