Package: ocrd-modelfactory
OCR-D/corePython modules implementingOCR-D specsand related toolsIntroductionInstallationCommand line toolsocrdCLIocrd-dummyCLIConfigurationPackagesocrd_utilsocrd_modelsocrd_modelfactoryocrd_validatorsocrd_networkocrdbash libraryTestingSee AlsoIntroductionThis repository contains the python packages that form the base for tools within theOCR-D ecosphere.All packages are also published toPyPI.InstallationNOTEUnless you want to contribute to OCR-D/core, we recommend installation
as part ofocrd_allwhich installs a
complete stack of OCR-D-related software.The easiest way to install is viapip:pipinstallocrd# or just the functionality you need, e.g.pipinstallocrd_modelfactoryAll python software released byOCR-Drequires Python 3.7 or higher.NOTESome OCR-D-Tools (or even test cases)mightreveal an unintended behavior if you have specific environment modifications, like:using a custom build ofImageMagick, whose format delegates are different from what OCR-D supposescustom Python logging configurations in your personal accountCommand line toolsNOTE:All OCR-D CLI tools support a--helpflag which shows usage and
supported flags, options and arguments.ocrdCLICLI usageIntroduction toocrd workspaceOCR-D user guideocrd-dummyCLIA minimalOCR-D processorthat copies from-I/-input-file-grpto-O/-output-file-grpConfigurationAlmost all behaviour of the OCR-D/core software is configured via CLI options and flags, which can be listed with the--helpflag that all CLI support.Some parts of the software are configured via environement variables:OCRD_METS_CACHING: If set totrue, access to the METS file is cached, speeding in-memory search and modification.OCRD_PROFILE: This variable configures the built-in CPU and memory profiling. If empty, no profiling is done. Otherwise expected to contain any of the following tokens:CPU: Enable CPU profiling of processor runsRSS: Enable RSS memory profilingPSS: Enable proportionate memory profilingOCRD_PROFILE_FILE: If set, then the CPU profile is written to this file for later peruse with a analysis tools likesnakevizPATH: Search path for processor executables (affectsocrd processandocrd resmgr).HOME: Directory to look forocrd_logging.conf, fallback for unset XDG variables (see below).XDG_CONFIG_HOME: Directory to look for./ocrd/resources.yml(i.e.ocrd resmgruser database) – defaults to$HOME/.config.XDG_DATA_HOME: Directory to look for./ocrd-resources/*(i.e.ocrd resmgrdata location) – defaults to$HOME/.local/share.OCRD_DOWNLOAD_RETRIES: Number of times to retry failed attempts for downloads of workspace files.OCRD_DOWNLOAD_TIMEOUT: Timeout in seconds for connecting or reading (comma-separated) when downloading.OCRD_METS_CACHING: Whether to enable in-memory storage of OcrdMets data structures for speedup during processing or workspace operations.OCRD_MAX_PROCESSOR_CACHE: Maximum number of processor instances (for each set of parameters) to be kept in memory (including loaded models) for processing workers or processor servers.OCRD_NETWORK_SERVER_ADDR_PROCESSING: Default address of Processing Server to connect to (forocrd network client processing).OCRD_NETWORK_SERVER_ADDR_WORKFLOW: Default address of Workflow Server to connect to (forocrd network client workflow).OCRD_NETWORK_SERVER_ADDR_WORKSPACE: Default address of Workspace Server to connect to (forocrd network client workspace).OCRD_NETWORK_WORKER_QUEUE_CONNECT_ATTEMPTS: Number of attempts for a worker to create its queue. Helpfull if the rabbitmq-server needs time to be fully started.Packagesocrd_utilsContains utilities and constants, e.g. for logging, path normalization, coordinate calculation etc.SeeREADME forocrd_utilsfor further information.ocrd_modelsContains file format wrappers for PAGE-XML, METS, EXIF metadata etc.SeeREADME forocrd_modelsfor further information.ocrd_modelfactoryCode to instantiatemodelsfrom existing data.SeeREADME forocrd_modelfactoryfor further information.ocrd_validatorsSchemas and routines for validating BagIt,ocrd-tool.json, workspaces, METS, page, CLI parameters etc.SeeREADME forocrd_validatorsfor further information.ocrd_networkComponents related to OCR-D Web APISeeREADME forocrd_networkfor further information.ocrdDepends on all of the above, also contains decorators and classes for creating OCR-D processors and CLIs.Also contains the command line toolocrd.SeeREADME forocrdfor further information.bash libraryBuilds a bash script that can be sourced by other bash scripts to create OCRD-compliant CLI.SeeREADME forbashlibfor further information.TestingDownload assets (make assets)Test with local files:make testTest with remote assets:make test OCRD_BASEURL='https://github.com/OCR-D/assets/raw/master/data/'See AlsoOCR-D Specifications(Repo)OCR-D core API documentation(built here viamake docs)OCR-D Website(Repo)