Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
felixdittrich92 committed Apr 23, 2024
1 parent 84f2d91 commit 50c35ca
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 30 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
coverage run -m pytest tests/common/
coverage xml -o coverage-common.xml
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: coverage-common
path: ./coverage-common.xml
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
run: |
coverage run -m pytest tests/tensorflow/
coverage xml -o coverage-tf.xml
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: coverage-tf
path: ./coverage-tf.xml
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
flags: unittests
fail_ci_if_error: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/references.yml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ jobs:
pip install -e .[torch,viz,html] --upgrade
- if: matrix.framework == 'tensorflow'
name: Benchmark latency (TF)
run: TF_USE_LEGACY_KERAS=1 python references/recognition/latency_tensorflow.py crnn_mobilenet_v3_small --it 5
run: python references/recognition/latency_tensorflow.py crnn_mobilenet_v3_small --it 5
- if: matrix.framework == 'pytorch'
name: Benchmark latency (PT)
run: python references/recognition/latency_pytorch.py crnn_mobilenet_v3_small --it 5
Expand Down Expand Up @@ -408,7 +408,7 @@ jobs:
pip install -e .[torch,viz,html] --upgrade
- if: matrix.framework == 'tensorflow'
name: Benchmark latency (TF)
run: TF_USE_LEGACY_KERAS=1 python references/detection/latency_tensorflow.py db_mobilenet_v3_large --it 5 --size 512
run: python references/detection/latency_tensorflow.py db_mobilenet_v3_large --it 5 --size 512
- if: matrix.framework == 'pytorch'
name: Benchmark latency (PT)
run: python references/detection/latency_pytorch.py db_mobilenet_v3_large --it 5 --size 512
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies = [

[project.optional-dependencies]
tf = [
# cf. https://github.com/mindee/doctr/pull/1461
"tensorflow>=2.15.0",
"tf-keras>=2.15.0", # Keep keras 2 compatibility
"tf2onnx>=1.16.0,<2.0.0", # cf. https://github.com/onnx/tensorflow-onnx/releases/tag/v1.16.0
Expand Down Expand Up @@ -93,6 +94,7 @@ docs = [
]
dev = [
# Tensorflow
# cf. https://github.com/mindee/doctr/pull/1461
"tensorflow>=2.15.0",
"tf-keras>=2.15.0", # Keep keras 2 compatibility
"tf2onnx>=1.16.0,<2.0.0", # cf. https://github.com/onnx/tensorflow-onnx/releases/tag/v1.16.0
Expand Down
4 changes: 2 additions & 2 deletions references/classification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ python references/classification/train_pytorch_character.py mobilenet_v3_large -
You can start your training in TensorFlow:

```shell
TF_USE_LEGACY_KERAS=1 python references/classification/train_tensorflow_orientation.py path/to/your/train_set path/to/your/val_set resnet18 page --epochs 5
python references/classification/train_tensorflow_orientation.py path/to/your/train_set path/to/your/val_set resnet18 page --epochs 5
```

or PyTorch:
Expand Down Expand Up @@ -61,7 +61,7 @@ Feel free to inspect the multiple script option to customize your training to yo
Character classification:

```shell
TF_USE_LEGACY_KERAS=1 python references/classification/train_tensorflow_character.py --help
python references/classification/train_tensorflow_character.py --help
```

Orientation classification:
Expand Down
9 changes: 4 additions & 5 deletions references/classification/latency_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
import os
import time

import numpy as np
import tensorflow as tf

os.environ["USE_TF"] = "1"
os.environ["TF_USE_LEGACY_KERAS"] = "1" # docTR requires Keras v2
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

from doctr.models import classification
from doctr.models import classification # isort: skip

import numpy as np
import tensorflow as tf


def main(args):
Expand Down
1 change: 0 additions & 1 deletion references/classification/train_tensorflow_character.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os

os.environ["USE_TF"] = "1"
os.environ["TF_USE_LEGACY_KERAS"] = "1" # docTR requires Keras v2
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

import datetime
Expand Down
1 change: 0 additions & 1 deletion references/classification/train_tensorflow_orientation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os

os.environ["USE_TF"] = "1"
os.environ["TF_USE_LEGACY_KERAS"] = "1" # docTR requires Keras v2
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

import datetime
Expand Down
2 changes: 1 addition & 1 deletion references/detection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pip install -r references/requirements.txt
You can start your training in TensorFlow:

```shell
TF_USE_LEGACY_KERAS=1 python references/detection/train_tensorflow.py path/to/your/train_set path/to/your/val_set db_resnet50 --epochs 5
python references/detection/train_tensorflow.py path/to/your/train_set path/to/your/val_set db_resnet50 --epochs 5
```

or PyTorch:
Expand Down
1 change: 0 additions & 1 deletion references/detection/evaluate_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from doctr.file_utils import CLASS_NAME

os.environ["USE_TF"] = "1"
os.environ["TF_USE_LEGACY_KERAS"] = "1" # docTR requires Keras v2
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

import multiprocessing as mp
Expand Down
9 changes: 4 additions & 5 deletions references/detection/latency_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
import os
import time

import numpy as np
import tensorflow as tf

os.environ["USE_TF"] = "1"
os.environ["TF_USE_LEGACY_KERAS"] = "1" # docTR requires Keras v2
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

from doctr.models import detection
from doctr.models import detection # isort: skip

import numpy as np
import tensorflow as tf


def main(args):
Expand Down
1 change: 0 additions & 1 deletion references/detection/train_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os

os.environ["USE_TF"] = "1"
os.environ["TF_USE_LEGACY_KERAS"] = "1" # docTR requires Keras v2
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

import datetime
Expand Down
2 changes: 1 addition & 1 deletion references/recognition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pip install -r references/requirements.txt
You can start your training in TensorFlow:

```shell
TF_USE_LEGACY_KERAS=1 python references/recognition/train_tensorflow.py crnn_vgg16_bn --train_path path/to/your/train_set --val_path path/to/your/val_set --epochs 5
python references/recognition/train_tensorflow.py crnn_vgg16_bn --train_path path/to/your/train_set --val_path path/to/your/val_set --epochs 5
```

or PyTorch:
Expand Down
1 change: 0 additions & 1 deletion references/recognition/evaluate_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os

os.environ["USE_TF"] = "1"
os.environ["TF_USE_LEGACY_KERAS"] = "1" # docTR requires Keras v2
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

import multiprocessing as mp
Expand Down
9 changes: 4 additions & 5 deletions references/recognition/latency_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
import os
import time

import numpy as np
import tensorflow as tf

os.environ["USE_TF"] = "1"
os.environ["TF_USE_LEGACY_KERAS"] = "1" # docTR requires Keras v2
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

from doctr.models import recognition
from doctr.models import recognition # isort: skip

import numpy as np
import tensorflow as tf


def main(args):
Expand Down
1 change: 0 additions & 1 deletion references/recognition/train_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os

os.environ["USE_TF"] = "1"
os.environ["TF_USE_LEGACY_KERAS"] = "1" # docTR requires Keras v2
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

import datetime
Expand Down

0 comments on commit 50c35ca

Please sign in to comment.