-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
82 lines (64 loc) · 1.87 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
exec_name_prefix = ocrd-anybaseocr
testdir = tests
export
SHELL = /bin/bash
PYTHON = python
PIP = pip
LOG_LEVEL = INFO
PYTHONIOENCODING=utf8
# BEGIN-EVAL makefile-parser --make-help Makefile
help:
@echo ""
@echo " Targets"
@echo ""
@echo " deps Install python deps via pip"
@echo " install Install"
@echo " repo/assets Clone OCR-D/assets to ./repo/assets"
@echo " assets-clean Remove assets"
@echo " assets Setup test assets"
@echo " test Run all tests"
@echo " test-binarize Test binarization"
@echo " test-deskew Test deskewing"
@echo " test-crop Test cropping"
@echo ""
@echo " Variables"
@echo ""
# END-EVAL
# Install python deps via pip
deps:
$(PIP) install -r requirements.txt
# Install
install:
$(PIP) install .
#
# Assets
#
# Download sample model
model: ocrd_anybaseocr/models/latest_net_G.pth
ocrd_anybaseocr/models/latest_net_G.pth:
wget -O"$@" "https://cloud.dfki.de/owncloud/index.php/s/3zKza5sRfQB3ygy/download"
# Clone OCR-D/assets to ./repo/assets
repo/assets:
mkdir -p $(dir $@)
git clone https://github.com/OCR-D/assets "$@"
# Remove assets
assets-clean:
rm -rf $(testdir)/assets
# Setup test assets
assets: repo/assets
mkdir -p $(testdir)/assets
cp -r -t $(testdir)/assets repo/assets/data/*
#
# Tests
#
# Run all tests
test: test-binarize test-deskew test-crop
# Test binarization
test-binarize: assets-clean assets
cd $(testdir)/assets/dfki-testdata/data && $(exec_name_prefix)-binarize -m mets.xml -I OCR-D-IMG -O OCR-D-IMG-BIN-TEST
# Test deskewing
test-deskew: assets-clean assets
cd $(testdir)/assets/dfki-testdata/data && $(exec_name_prefix)-deskew -m mets.xml -I OCR-D-IMG -O OCR-D-IMG-DESKEW-TEST
# Test cropping
test-crop: assets-clean assets
cd $(testdir)/assets/dfki-testdata/data && $(exec_name_prefix)-crop -m mets.xml -I OCR-D-IMG -O OCR-D-IMG-CROP-TEST