AttributeError: module ‘keras.backend‘ has no attribute ‘get_session‘ 问题解决
·
一、问题
Traceback (most recent call last):
File "video.py", line 9, in <module>
ssd = SSD()
File "/home/pi/Desktop/Mobilenet-SSD-Essay-master/ssd.py", line 37, in __init__
self.sess = K.get_session()
AttributeError: module 'keras.backend' has no attribute 'get_session'
原因:TensorFlow和 Keras 的版本太高导致的,我的版本如下:TensorFlow2.3.0、Keras2.4.3
二、解决方法
先定位到这行代码
from keras import backend as K
改为
from tensorflow.compat.v1.keras import backend as K
更多推荐
所有评论(0)