Skip to main content

Read, process, and integrate data from inventory cards.

Project description

Inventory Card Reader

This repository contains code to read, process, and integrate data from inventory cards. Currently it uses (pero-ocr)[https://github.com/DCGM/pero-ocr] for text recognition.

Installation

  1. Install the package from pip using pip install inventory-card-reader
  2. Or clone the repository and do your thing

Prepare config files

  • Create a config yaml file with the following keys:
xml_output_folder: <<temporary directory to store intermediate xml files>>
region_config: <<path to region config json>>
yolo_weights: <<path to trained yolo model to detect figures>>
output_dir: <<directory to store the resulting csv and extracted images>>
  • Create a region config json file where the inventory card regions are defined. This file is expected to have the following structure:
{
    "regions": 
        <<key1>>: [x1,y1,x2,y2]
        <<key2>>: [x1,y1,x2,y2]
        <<...>>: [...]
}

Where key define the column names to be extracted and x1,y1,x2,y2 denote the relative coordinates of the region where the values for the respective columns can be found in the inventory card. (x1,y1) denote the coordinates of the top left corner of the region, and x2,y2 the bottom right.

For example:

{
    "regions": {
        "Gegenstand": [0.047,0,1,0.077],
        "Inv. Nr.": [0.047,0.077,0.275,0.135],
    }
}
  • Download the pero ocr model weights provided by the pero developers (here)[https://nextcloud.fit.vutbr.cz/s/NtAbHTNkZFpapdJ], unzip the file and store the .pt and .pt.cpu files in the pero_resources folder
  • Start the extraction by invoking read_inventory_cards <<config>> <<input_folder>> where <<config>> is the path to the config yaml file described above and <<input folder>> the path to a directory of scanned jpgs of inventory cards to be processed.

Contributing

I'm happy to receive feedback and code contributions. Feel free to open issues or create pull requests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inventory_card_reader-0.0.5.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

inventory_card_reader-0.0.5-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file inventory_card_reader-0.0.5.tar.gz.

File metadata

  • Download URL: inventory_card_reader-0.0.5.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for inventory_card_reader-0.0.5.tar.gz
Algorithm Hash digest
SHA256 5db4dac73a8b1f6e1366a4f9fbb17c3a4df44f99d904deb6b24afb25e35344ac
MD5 6b9cac0333dfb04566a0b40fc0d01dab
BLAKE2b-256 9a6657d05484280af7f92815fb799ea9117087c0d7b117be3d483d91e93a6b0f

See more details on using hashes here.

File details

Details for the file inventory_card_reader-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for inventory_card_reader-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a8e64415b90b7ac46b9101852ae4f2162995c8b273736167c0a46629d65d1c47
MD5 55b333ed55f2a7d7a9854c9537469e62
BLAKE2b-256 68d5ec5319febd2b83e11abe3db7daf9b865db28475ca704659f0d72597b14ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page