Metadata-Version: 2.3
Name: microwink
Version: 0.0.2
Summary: Lightweight instance segmentation of card IDs
Project-URL: Repository, https://github.com/cospectrum/microwink
Author-email: cospectrum <severinalexeyv@gmail.com>
License: Apache-2.0
Requires-Python: >=3.10
Requires-Dist: numpy>=2.2.0
Requires-Dist: onnxruntime>=1.20.1
Requires-Dist: pillow>=11.0.0
Description-Content-Type: text/markdown

# microwink
[![github]](https://github.com/cospectrum/microwink)
[![ci]](https://github.com/cospectrum/microwink/actions)

[github]: https://img.shields.io/badge/github-cospectrum/microwink-8da0cb?logo=github
[ci]: https://github.com/cospectrum/microwink/workflows/ci/badge.svg

Lightweight instance segmentation of card IDs.

<p>
  <img src="assets/data/us_card.png" width="49%">
  <img src="assets/us_card.result.png" width="49%">
</p>

## Usage

### Python
```sh
pip install microwink
```
```python
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")
```
