Document segmentation.
Project description
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.
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
Weights
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
midv500models-0.0.1.tar.gz
(9.0 kB
view hashes)
Built Distribution
Close
Hashes for midv500models-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d24ca83e7858b76c0e752150806fbda7616e17a6993fe88e87313683e3905b7 |
|
MD5 | a3197774a2531ee1cc202626f902ca06 |
|
BLAKE2b-256 | d004cafb9cdde0e713e83c3bfa6c4b1663384e2cf78aba7db8fb8f3dc45d53a1 |