Skip to main content

midv-500-models

The repository contains a model for binary semantic segmentation of the documents.

  • Left: input.
  • Center: prediction.
  • Right: overlay of the image and predicted mask.

Installation

pip install -U midv500models

For more details: Example notebook

Dataset

Model is trained on MIDV-500: A Dataset for Identity Documents Analysis and Recognition on Mobile Devices in Video Stream.

Preparation

Download the dataset from the ftp server with

wget -r ftp://smartengines.com/midv-500/

Unpack the dataset

cd smartengines.com/midv-500/dataset/
unzip \*.zip

The resulting folder structure will be

smartengines.com
    midv-500
        dataset
            01_alb_id
                ground_truth
                    CA
                        CA01_01.tif
                    ...
                images
                    CA
                        CA01_01.json
                    ...
                ...
            ...
        ...
    ...

To preprocess the data use the script

python midv500models/preprocess_data.py -i <input_folder> \
                                          -o <output_folder>

where input_folder corresponds to the file with the unpacked dataset and output folder will look as:

images
    CA01_01.jpg
    ...
masks
    CA01_01.png

target binary masks will have values [0, 255], where 0 is background and 255 is the document.

Training

python midv500models/train.py -c midv500models/configs/2020-05-19.yaml \
                              -i <path to train>

Inference

python midv500models/inference.py -c midv500models/configs/2020-05-19.yaml \
                                  -i <path to images> \
                                  -o <path to save preidctions>
                                  -w <path to weights>

Example notebook

Example notebook

Weights

Unet with Resnet34 backbone: Config Weights

Metadata

Release files for midv500models 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for midv500models 0.0.2
File Size Uploaded
midv500models-0.0.2.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for midv500models 0.0.2
File Interpreter ABI Platform
midv500models-0.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 20.4 kB

Release files / midv500models-0.0.2.tar.gz

Download URL midv500models-0.0.2.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6f315800d64a54bea9095b23e9d6da70c7c698d0973637e0be9fc0a3f10f2bb4
BLAKE2b-256 checksum
How to use checksums
fb17ae70bf3aacbb6f028c91946b24c181061f072a4a88a7b9efa748d5a7a1a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.3

Release files / midv500models-0.0.2-py2.py3-none-any.whl

Download URL midv500models-0.0.2-py2.py3-none-any.whl
Size 11.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
af01509ce2d119ec6e08c052748b284cd4f1f1d64cdca831cef779a49dbef016
BLAKE2b-256 checksum
How to use checksums
ca2f66d12db9daa6f7d72f33a576f07999d40a409a253b3913199d145e9fc338
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page