tobybreckon / fire-detection-cnn

real-time fire detection in video imagery using a convolutional neural network (deep learning) - from our ICIP 2018 paper (Dunnings / Breckon) + ICMLA 2019 paper (Samarth / Bhowmik / Breckon)
MIT License
543 stars 172 forks source link

Error while executing firenet.py- TensorFlow 2.0 #47

Open grtdeveloper opened 4 years ago

grtdeveloper commented 4 years ago

while issuing command python3 firenet.py models/test.mp4 got the following error. All necessary packages are installed.

import tflearn File "/usr/local/lib/python3.6/dist-packages/tflearn/init.py", line 4, in from . import config File "/usr/local/lib/python3.6/dist-packages/tflearn/config.py", line 5, in from .variables import variable File "/usr/local/lib/python3.6/dist-packages/tflearn/variables.py", line 7, in from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/init.py", line 27, in from tensorflow.contrib import cudnn_rnn File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/cudnn_rnn/init.py", line 28, in from tensorflow.contrib.cudnn_rnn.python.ops.cudnn_rnn_ops import CudnnGRU File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py", line 21, in from tensorflow.contrib.cudnn_rnn.ops import gen_cudnn_rnn_ops File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/cudnn_rnn/ops/gen_cudnn_rnn_ops.py", line 940, in _op_def_lib = _InitOpDefLibrary() File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/cudnn_rnn/ops/gen_cudnn_rnn_ops.py", line 365, in _InitOpDefLibrary _op_def_registry.register_op_list(op_list) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_registry.py", line 35, in register_op_list assert _registered_ops[op_def.name] == op_def AssertionError

Computing Environment (please complete the following information):

tobybreckon commented 4 years ago

In essence we do not (and cannot easily) support TensorFlow 2.0 because TFlearn, which this project is based upon, is not available with TensorFlow > 1.15 (google: "tensorflow 2.0 tflearn" for the background).

As you an see - your failure is at the import tflearn line even before you get to the code specific to this project.

[ Why did we use TFlearn ? - because it was 2017 and Pytorch et al., was not mature enough yet and this was the goto "easy to use" package for this type of work ]

A workflow to make this repo work on your system is via a Tensorflow 1 virtual environment. Install the required packages for virtualenv on Linux Ubuntu 18.10 and then ...

virtualenv --system-site-packages -p python3 ./venv/tf-1.1.5-gpu
source ~/venv/tf-1.1.5-gpu/bin/activate
pip install tensorflow-gpu==1.15
pip install tflearn
....
python3 firenet.py models/test.mp4

I am more than happy to be corrected if someone can post a pull request for a set of TF 2.0 fixes (but as far as I can tell the complexity of such a fix is way beyond the TF 1.x -> TF 2.x translation scripts etc).