Lightweight instance segmentation of card IDs.
pip install microwink
from microwink import SegModel
from microwink.common import draw_mask, draw_box
from PIL import Image
seg_model = SegModel.from_path("./models/seg_model.onnx")
img = Image.open("./input.png").convert("RGB")
cards = seg_model.apply(img)
for card in cards:
print(f"score={card.score}, box={card.box}")
img = draw_mask(img, card.mask > 0.5)
img = draw_box(img, card.box)
img.save("./output.png")