name: references on: push: branches: main pull_request: branches: main jobs: train-char-classification: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest] python: ["3.10"] steps: - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} architecture: x64 - name: Cache python modules uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }}-${{ hashFiles('references/requirements.txt') }} restore-keys: | ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }}- - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e .[viz,html] --upgrade pip install -r references/requirements.txt sudo apt-get update && sudo apt-get install fonts-freefont-ttf -y - name: Train for a short epoch run: python references/classification/train_character.py vit_s -b 32 --val-samples 1 --train-samples 1 --epochs 1 train-orientation-classification: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest] python: ["3.10"] steps: - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} architecture: x64 - name: Cache python modules uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }}-${{ hashFiles('references/requirements.txt') }} restore-keys: | ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }}- - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e .[viz,html] --upgrade pip install -r references/requirements.txt - name: Download and extract detection toy set run: | wget https://github.com/mindee/doctr/releases/download/v0.3.1/toy_detection_set-bbbb4243.zip sudo apt-get update && sudo apt-get install unzip -y unzip toy_detection_set-bbbb4243.zip -d det_set - name: Download and extract recognition toy set run: | wget https://github.com/mindee/doctr/releases/download/v0.3.1/toy_recogition_set-036a4d80.zip sudo apt-get update && sudo apt-get install unzip -y unzip toy_recogition_set-036a4d80.zip -d reco_set - name: Train for a short epoch (document orientation) run: python references/classification/train_orientation.py resnet18 --type page --train_path ./det_set --val_path ./det_set -b 2 --epochs 1 - name: Train for a short epoch (crop orientation) run: python references/classification/train_orientation.py resnet18 --type crop --train_path ./reco_set --val_path ./reco_set -b 4 --epochs 1 train-text-recognition: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest] python: ["3.10"] steps: - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} architecture: x64 - name: Cache python modules uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }}-${{ hashFiles('references/requirements.txt') }} restore-keys: | ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }}- - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e .[viz,html] --upgrade pip install -r references/requirements.txt - name: Download and extract toy set run: | wget https://github.com/mindee/doctr/releases/download/v0.3.1/toy_recogition_set-036a4d80.zip sudo apt-get update && sudo apt-get install unzip -y unzip toy_recogition_set-036a4d80.zip -d reco_set - name: Train for a short epoch run: python references/recognition/train.py crnn_mobilenet_v3_small --train_path ./reco_set --val_path ./reco_set -b 4 --epochs 1 evaluate-text-recognition: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest] python: ["3.10"] steps: - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} architecture: x64 - name: Cache python modules uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e .[viz,html] --upgrade - name: Evaluate text recognition run: python references/recognition/evaluate.py crnn_mobilenet_v3_small --dataset SVT -b 32 latency-text-recognition: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest] python: ["3.10"] steps: - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} architecture: x64 - name: Cache python modules uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e .[viz,html] --upgrade - name: Benchmark latency run: python references/recognition/latency.py crnn_mobilenet_v3_small --it 5 train-text-detection: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest] python: ["3.10"] steps: - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} architecture: x64 - name: Cache python modules uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }}-${{ hashFiles('references/requirements.txt') }} restore-keys: | ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }}- - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e .[viz,html] --upgrade pip install -r references/requirements.txt - name: Download and extract toy set run: | wget https://github.com/mindee/doctr/releases/download/v0.3.1/toy_detection_set-bbbb4243.zip sudo apt-get update && sudo apt-get install unzip -y unzip toy_detection_set-bbbb4243.zip -d det_set - name: Train for a short epoch run: python references/detection/train.py db_mobilenet_v3_large --train_path ./det_set --val_path ./det_set -b 2 --epochs 1 evaluate-text-detection: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest] python: ["3.10"] steps: - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} architecture: x64 - name: Cache python modules uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e .[viz,html] --upgrade pip install -r references/requirements.txt - name: Evaluate text detection run: python references/detection/evaluate.py db_mobilenet_v3_large latency-text-detection: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest] python: ["3.10"] steps: - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} architecture: x64 - name: Cache python modules uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pkg-deps-${{ matrix.python }}-${{ hashFiles('requirements-pt.txt') }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install -e .[viz,html] --upgrade - name: Benchmark latency run: python references/detection/latency.py db_mobilenet_v3_large --it 5 --size 512