I've got few files with different files:
- main.py
- watch.py
- read.py
- detect.py <-- Uses tensorflow based library
darkflow
that relies on the graph mode - translate.py <-- uses tf eager execution
During darkflow's TFNet initialization I get this error:
Traceback (most recent call last):
File "/home/justin/Projects/comp3931/main.py", line 6, in <module>
watcher = Watcher('res/vid/planet_earth_s01e01/video.mp4', 'res/vid/planet_earth_s01e01/english.srt')
File "/home/justin/Projects/comp3931/watch.py", line 9, in __init__
self.detector = Detector()
File "/home/justin/Projects/comp3931/detect.py", line 6, in __init__
self.tfnet = TFNet(self.options)
File "/usr/local/lib64/python3.6/site-packages/darkflow/net/build.py", line 75, in __init__
self.build_forward()
File "/usr/local/lib64/python3.6/site-packages/darkflow/net/build.py", line 105, in build_forward
self.inp = tf.placeholder(tf.float32, inp_size, 'input')
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1677, in placeholder
raise RuntimeError("tf.placeholder() is not compatible with "
RuntimeError: tf.placeholder() is not compatible with eager execution.
So, I assume that when I instantiate Translator
class from translate.py
file it invokes eager execution on the whole program, which then is not compatible with calls to darkflow's TFNet
class used in Dectector
class from detect.py
If I run translate.py
independently from others it works fine, other modules also work fine if run them without translate.py
involved.
I guess the fact that they use different contexts (graph/eager), the whole thing can't run together in the same program. I've tried looking at the documentation, but could not find a way to switch back to graph mode when needed.
Is there any way I can run both eager and graph modes in the same application in different places?