Skip to content

Commit 3d4544a

Browse files
Add compatibility for TF2
1 parent 676757d commit 3d4544a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

generate_tfrecord.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
import os
1515
import io
1616
import pandas as pd
17-
import tensorflow as tf
17+
18+
from tensorflow.python.framework.versions import VERSION
19+
if VERSION >= "2.0.0a0":
20+
import tensorflow.compat.v1 as tf
21+
else:
22+
import tensorflow as tf
1823

1924
from PIL import Image
2025
from object_detection.utils import dataset_util

0 commit comments

Comments
 (0)