From dd6e2b8874c95def580a9207c2cd103953439c7f Mon Sep 17 00:00:00 2001 From: Alex Severin Date: Sun, 15 Dec 2024 15:02:09 +0300 Subject: [PATCH] change imgs layout --- README.md | 28 +++++++++++-------- {tests => assets}/data/mklovin.png | 0 {tests => assets}/data/us_card.png | 0 assets/{result.png => us_card.result.png} | 0 tests/test_samples.py | 4 +-- .../truth => truth/seg_model}/mklovin.png | 0 .../truth => truth/seg_model}/us_card.png | 0 7 files changed, 19 insertions(+), 13 deletions(-) rename {tests => assets}/data/mklovin.png (100%) rename {tests => assets}/data/us_card.png (100%) rename assets/{result.png => us_card.result.png} (100%) rename tests/{data/truth => truth/seg_model}/mklovin.png (100%) rename tests/{data/truth => truth/seg_model}/us_card.png (100%) diff --git a/README.md b/README.md index d5516f6..e8a0c3f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,23 @@ # 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. + +

+ + +

+ +## Usage + +### Python ```sh pip install microwink ``` - -## Usage ```python from microwink import SegModel from microwink.common import draw_mask, draw_box @@ -14,17 +25,12 @@ 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") ``` - -

- -

diff --git a/tests/data/mklovin.png b/assets/data/mklovin.png similarity index 100% rename from tests/data/mklovin.png rename to assets/data/mklovin.png diff --git a/tests/data/us_card.png b/assets/data/us_card.png similarity index 100% rename from tests/data/us_card.png rename to assets/data/us_card.png diff --git a/assets/result.png b/assets/us_card.result.png similarity index 100% rename from assets/result.png rename to assets/us_card.result.png diff --git a/tests/test_samples.py b/tests/test_samples.py index 46c57f8..fdfe9b7 100644 --- a/tests/test_samples.py +++ b/tests/test_samples.py @@ -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 diff --git a/tests/data/truth/mklovin.png b/tests/truth/seg_model/mklovin.png similarity index 100% rename from tests/data/truth/mklovin.png rename to tests/truth/seg_model/mklovin.png diff --git a/tests/data/truth/us_card.png b/tests/truth/seg_model/us_card.png similarity index 100% rename from tests/data/truth/us_card.png rename to tests/truth/seg_model/us_card.png