So I trained a model using https://teachablemachine.withgoogle.com/ and it gave me a keras_model.h5
file and a labels.txt
and I want to use it with OpenCV for some object detection but I've only used OpenCV with .pb
files. So I'm thinking that I would have to convert it somehow. So I started looking around and I found this. https://github.com/amir-abdi/keras_to_tensorflow and when I try to run the script in my conda environment it throws this exception.
WARNING:tensorflow:From keras_to_tensorflow.py:23: set_learning_phase (from tensorflow.python.keras.backend) is deprecated and will be removed after 2020-10-11.
Instructions for updating:
Simply pass a True/False value to the `training` argument of the `__call__` method of your layer or model.
2021-01-23 05:58:15.012748: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
I0123 05:58:16.157379 5660 keras_to_tensorflow.py:145] Converted output node names are: ['sequential_3/dense_Dense2/Softmax']
Traceback (most recent call last):
File "keras_to_tensorflow.py", line 182, in <module>
app.run(main)
File "C:Usersdeveloperminiconda3envsf1libsite-packagesabslapp.py", line 303, in run
_run_main(main, args)
File "C:Usersdeveloperminiconda3envsf1libsite-packagesabslapp.py", line 251, in _run_main
sys.exit(main(argv))
File "keras_to_tensorflow.py", line 148, in main
sess = K.get_session()
AttributeError: module 'keras.backend' has no attribute 'get_session'
Why is that and how do I properly convert it?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…