Polygon output with new API? #18330
|
Hi I don't believe there's an option for polygon output rather than bbox in |
Replies: 1 comment
|
You are right — there is no polygon switch on
post_op = self.build_postprocess(**self.config["PostProcess"])
box_type=kwargs.get("box_type", "quad"),and it picks the DB decoder if self.box_type == "poly":
boxes, scores = self.polygons_from_bitmap(...)
elif self.box_type == "quad":
boxes, scores = self.boxes_from_bitmap(...)so flip it on the detector from paddleocr import TextDetection
det = TextDetection()
det.paddlex_predictor.post_op.box_type = "poly"
res = det.predict("img.png")
print(res[0]["dt_polys"]) # N point polygons instead of 4 point quadsor set do not do this inside the full self._sort_boxes = SortQuadBoxes()
self._crop_by_polys = CropByPolys(det_box_type="quad")recognition would then crop N point boxes with a 4 point cropper for poly end to end there is already a poly branch — |
You are right — there is no polygon switch on
PaddleOCR()the wrapper forwards only these detection params
paddleocr/_pipelines/ocr.py:145-152box_typeis not an init arg at allit comes from the model config
paddlex/inference/models/text_detection/predictor.py:118:213and it picks the DB decoder
paddlex/inference/models/text_detection/processors.py:531-540so flip it on the detector