sbb_binarization/Makefile

64 lines
1.9 KiB
Makefile
Raw Normal View History

2020-10-16 13:31:28 +02:00
# BEGIN-EVAL makefile-parser --make-help Makefile
2024-10-15 12:56:26 +02:00
# should really be core-cuda-tf2, but not as long as we must restrict TF2 minor version
DOCKER_BASE_IMAGE = docker.io/ocrd/core-cuda:v2.69.0
2024-10-14 13:12:29 +02:00
DOCKER_TAG = ocrd/sbb_binarization
2024-09-30 21:27:04 +02:00
2023-04-12 22:55:12 +02:00
.PHONY: help install
2020-10-16 13:31:28 +02:00
help:
@echo ""
@echo " Targets"
@echo ""
@echo " install Install with pip"
2023-04-12 22:55:12 +02:00
@echo " models Downloads the pre-trained models from qurator-data.de"
2020-10-16 13:31:28 +02:00
@echo " test Run tests"
2023-04-12 22:55:12 +02:00
@echo " clean Remove copies/results in test/assets"
2020-10-16 13:31:28 +02:00
@echo ""
2024-09-30 21:27:04 +02:00
@echo " docker Build a Docker image $(DOCKER_TAG) from $(DOCKER_BASE_IMAGE)"
@echo ""
2020-10-16 13:31:28 +02:00
@echo " Variables"
@echo ""
2024-09-30 21:27:04 +02:00
@echo " PYTHON"
@echo " DOCKER_TAG Docker image tag of result for the docker target"
2020-10-16 13:31:28 +02:00
# END-EVAL
# Install with pip
install:
2024-10-01 03:50:46 +02:00
pip install -U setuptools pip
pip install .
2020-10-16 13:31:28 +02:00
# Downloads the pre-trained models from qurator-data.de
2023-04-12 22:55:12 +02:00
.PHONY: models
models:
ocrd resmgr download ocrd-sbb-binarize "*"
repo/assets/data:
2023-04-12 23:31:23 +02:00
git submodule update --init
2023-04-12 22:55:12 +02:00
# Setup test data
test/assets: repo/assets/data
2023-04-12 22:55:12 +02:00
@mkdir -p $@
cp -r -t $@ $</*
2020-10-16 13:31:28 +02:00
# Run tests
2023-04-12 22:55:12 +02:00
.PHONY: test
test: test/assets models
ocrd-sbb-binarize -m test/assets/kant_aufklaerung_1784/data/mets.xml -I OCR-D-IMG -O BIN -P model default
ocrd-sbb-binarize -m test/assets/kant_aufklaerung_1784/data/mets.xml -I OCR-D-IMG -O BIN2 -P model default-2021-03-09
ocrd-sbb-binarize -m test/assets/kant_aufklaerung_1784-page-region/data/mets.xml -g phys_0001 -I OCR-D-GT-SEG-REGION -O BIN -P model default -P operation_level region
ocrd-sbb-binarize -m test/assets/kant_aufklaerung_1784-page-region/data/mets.xml -g phys_0001 -I OCR-D-GT-SEG-REGION -O BIN2 -P model default-2021-03-09 -P operation_level region
2024-09-30 21:27:04 +02:00
.PHONY: docker
docker:
docker build \
--build-arg DOCKER_BASE_IMAGE=$(DOCKER_BASE_IMAGE) \
--build-arg VCS_REF=$$(git rev-parse --short HEAD) \
--build-arg BUILD_DATE=$$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
-t $(DOCKER_TAG) .
2023-04-12 22:55:12 +02:00
.PHONY: clean
clean:
-$(RM) -fr test/assets