Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for tensorflow 2.x #1217

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 6 additions & 1 deletion darkflow/net/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import tensorflow as tf
try: # for tensorflow 1.x
import tensorflow.contrib.slim as slim
import tensorflow as tf
except: # for tensorflow 2.x
import tensorflow.compat.v1 as tf
import tf_slim as slim
import time
from . import help
from . import flow
Expand Down
2 changes: 1 addition & 1 deletion darkflow/net/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def camera(self):
'Cannot capture source'

if file == 0:#camera window
cv2.namedWindow('', 0)
cv2.namedWindow('camera window', 0)
_, frame = camera.read()
height, width, _ = frame.shape
cv2.resizeWindow('', width, height)
Expand Down
7 changes: 6 additions & 1 deletion darkflow/net/ops/baseop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import tensorflow as tf
try: # for tensorflow 1.x
import tensorflow.contrib.slim as slim
import tensorflow as tf
except: # for tensorflow 2.x
import tensorflow.compat.v1 as tf
import tf_slim as slim
import numpy as np

FORM = '{:>6} | {:>6} | {:<32} | {}'
Expand Down
8 changes: 6 additions & 2 deletions darkflow/net/ops/convolution.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import tensorflow.contrib.slim as slim
try: # for tensorflow 1.x
import tensorflow.contrib.slim as slim
import tensorflow as tf
except: # for tensorflow 2.x
import tensorflow.compat.v1 as tf
import tf_slim as slim
from .baseop import BaseOp
import tensorflow as tf
import numpy as np

class reorg(BaseOp):
Expand Down
9 changes: 7 additions & 2 deletions darkflow/net/ops/simple.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import tensorflow.contrib.slim as slim
try: # for tensorflow 1.x
import tensorflow.contrib.slim as slim
import tensorflow as tf
except: # for tensorflow 2.x
import tensorflow.compat.v1 as tf
import tf_slim as slim
tf.disable_v2_behavior()
from .baseop import BaseOp
import tensorflow as tf
from distutils.version import StrictVersion

class route(BaseOp):
Expand Down
8 changes: 6 additions & 2 deletions darkflow/net/yolo/train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import tensorflow.contrib.slim as slim
try: # for tensorflow 1.x
import tensorflow.contrib.slim as slim
import tensorflow as tf
except: # for tensorflow 2.x
import tensorflow.compat.v1 as tf
import tf_slim as slim
import pickle
import tensorflow as tf
from .misc import show
import numpy as np
import os
Expand Down
8 changes: 6 additions & 2 deletions darkflow/net/yolov2/train.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import tensorflow.contrib.slim as slim
try: # for tensorflow 1.x
import tensorflow.contrib.slim as slim
import tensorflow as tf
except: # for tensorflow 2.x
import tensorflow.compat.v1 as tf
import tf_slim as slim
import pickle
import tensorflow as tf
from ..yolo.misc import show
import numpy as np
import os
Expand Down