|
|
@@ -12,11 +12,13 @@
|
|
|
# See the License for the specific language governing permissions and
|
|
|
# limitations under the License.
|
|
|
|
|
|
+import copy
|
|
|
+
|
|
|
import PIL
|
|
|
from PIL import Image, ImageDraw, ImageFont
|
|
|
|
|
|
from ....utils.fonts import PINGFANG_FONT_FILE_PATH, create_font
|
|
|
-from ...common.result import BaseCVResult
|
|
|
+from ...common.result import BaseCVResult, StrMixin, JsonMixin
|
|
|
from ...utils.color_map import get_colormap, font_colormap
|
|
|
|
|
|
|
|
|
@@ -107,4 +109,14 @@ class ShiTuResult(BaseCVResult):
|
|
|
if box["rec_scores"] is not None
|
|
|
]
|
|
|
image = draw_box(self["input_img"], boxes)
|
|
|
- return image
|
|
|
+ return {"res": image}
|
|
|
+
|
|
|
+ def _to_str(self, *args, **kwargs):
|
|
|
+ data = copy.deepcopy(self)
|
|
|
+ data.pop("input_img")
|
|
|
+ return StrMixin._to_str(data, *args, **kwargs)
|
|
|
+
|
|
|
+ def _to_json(self, *args, **kwargs):
|
|
|
+ data = copy.deepcopy(self)
|
|
|
+ data.pop("input_img")
|
|
|
+ return JsonMixin._to_json(data, *args, **kwargs)
|