https://github.com/cospectrum/microwink
Lightweight instance segmentation of card IDs
https://github.com/cospectrum/microwink
id-card id-card-extraction identity-documents
Last synced: about 1 year ago
JSON representation
Lightweight instance segmentation of card IDs
- Host: GitHub
- URL: https://github.com/cospectrum/microwink
- Owner: cospectrum
- License: apache-2.0
- Created: 2024-12-14T19:42:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-11T00:53:10.000Z (over 1 year ago)
- Last Synced: 2025-03-27T19:43:06.879Z (over 1 year ago)
- Topics: id-card, id-card-extraction, identity-documents
- Language: Python
- Homepage:
- Size: 20.1 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
## 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("./assets/data/us_card.png").convert("RGB")
cards = seg_model.apply(img)
for card in cards:
print(f"score={card.score}, box={card.box}")
img = draw_box(img, card.box)
img = draw_mask(img, card.mask > 0.5)
img.save("./output.png")
```
## License
Apache-2.0