Skip to content

Commit

Permalink
Merge pull request #2 from cospectrum/dev
Browse files Browse the repository at this point in the history
change imgs and readme layout
  • Loading branch information
cospectrum authored Dec 15, 2024
2 parents fa0ba60 + dd6e2b8 commit 0a59b9e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
# microwink
Lightweight instance segmentation for card IDs
[![github]](https://github.com/cospectrum/microwink)
[![ci]](https://github.com/cospectrum/microwink/actions)

## Install
[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
```

## Usage
```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("./tests/data/us_card.png").convert("RGB")
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("./assets/result.png")
img.save("./output.png")
```

<p align="middle">
<img src="./assets/result.png">
</p>
File renamed without changes
File renamed without changes
File renamed without changes
4 changes: 2 additions & 2 deletions tests/test_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from microwink.common import Box, draw_mask


DATA_ROOT = Path("./tests/data/")
TRUTH_ROOT = Path("./tests/data/truth/")
DATA_ROOT = Path("./assets/data/")
TRUTH_ROOT = Path("./tests/truth/seg_model/")
BIN_THRESHOLD = 0.5


Expand Down
File renamed without changes
File renamed without changes

0 comments on commit 0a59b9e

Please sign in to comment.