Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
felixdittrich92 committed Apr 24, 2024
1 parent 06de30d commit 0cab9d0
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 5 deletions.
5 changes: 5 additions & 0 deletions doctr/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@
)


def ensure_keras_v2() -> None: # pragma: no cover
if not os.environ.get("TF_USE_LEGACY_KERAS") == "1":
os.environ["TF_USE_LEGACY_KERAS"] = "1"


def requires_package(name: str, extra_message: Optional[str] = None) -> None: # pragma: no cover
"""
package requirement helper
Expand Down
8 changes: 6 additions & 2 deletions references/classification/latency_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@
import os
import time

from doctr.file_utils import ensure_keras_v2

ensure_keras_v2()

os.environ["USE_TF"] = "1"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

from doctr.models import classification # isort: skip

import numpy as np
import tensorflow as tf

from doctr.models import classification


def main(args):
if args.gpu:
Expand Down
4 changes: 4 additions & 0 deletions references/classification/train_tensorflow_character.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

import os

from doctr.file_utils import ensure_keras_v2

ensure_keras_v2()

os.environ["USE_TF"] = "1"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

Expand Down
4 changes: 4 additions & 0 deletions references/classification/train_tensorflow_orientation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

import os

from doctr.file_utils import ensure_keras_v2

ensure_keras_v2()

os.environ["USE_TF"] = "1"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

Expand Down
4 changes: 4 additions & 0 deletions references/detection/evaluate_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

import os

from doctr.file_utils import ensure_keras_v2

ensure_keras_v2()

from doctr.file_utils import CLASS_NAME

os.environ["USE_TF"] = "1"
Expand Down
7 changes: 6 additions & 1 deletion references/detection/latency_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@
import os
import time

from doctr.file_utils import ensure_keras_v2

ensure_keras_v2()

os.environ["USE_TF"] = "1"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

from doctr.models import detection # isort: skip

import numpy as np
import tensorflow as tf

from doctr.models import detection


def main(args):
if args.gpu:
Expand Down
4 changes: 4 additions & 0 deletions references/detection/train_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

import os

from doctr.file_utils import ensure_keras_v2

ensure_keras_v2()

os.environ["USE_TF"] = "1"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

Expand Down
4 changes: 4 additions & 0 deletions references/recognition/evaluate_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

import os

from doctr.file_utils import ensure_keras_v2

ensure_keras_v2()

os.environ["USE_TF"] = "1"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

Expand Down
8 changes: 6 additions & 2 deletions references/recognition/latency_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@
import os
import time

from doctr.file_utils import ensure_keras_v2

ensure_keras_v2()

os.environ["USE_TF"] = "1"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

from doctr.models import recognition # isort: skip

import numpy as np
import tensorflow as tf

from doctr.models import recognition


def main(args):
if args.gpu:
Expand Down
4 changes: 4 additions & 0 deletions references/recognition/train_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

import os

from doctr.file_utils import ensure_keras_v2

ensure_keras_v2()

os.environ["USE_TF"] = "1"
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

Expand Down

0 comments on commit 0cab9d0

Please sign in to comment.