作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
请帮忙解决这个问题我用 ImageAI 来检测汽车,但它没有用,我是新手,抱歉
from imageai.Detection import ObjectDetection
import os
execution_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()
detections, objects_path = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image3.jpg"), output_image_path=os.path.join(execution_path , "image3new.jpg"), minimum_percentage_probability=30, extract_detected_objects=True)
for eachObject, eachObjectPath in zip(detections, objects_path):
print(eachObject["name"] , " : " , eachObject["percentage_probability"], " : ", eachObject["box_points"] )
print("Object's image saved in " + eachObjectPath)
print("--------------------------------")
使用 TensorFlow 后端。
Traceback (most recent call last):
File "/home/maxim/PycharmProjects/ImageAI/venv/image.py", line 7, in <module>
detector = ObjectDetection()
File "/home/maxim/.virtualenvs/ImageAI/lib/python3.5/site-packages/imageai/Detection/__init__.py", line 88, in __init__
self.sess = K.get_session()
File "/home/maxim/.virtualenvs/ImageAI/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 174, in get_session
default_session = tf.get_default_session()
AttributeError: module 'tensorflow' has no attribute 'get_default_session'
Process finished with exit code 1
最佳答案
https://github.com/OlafenwaMoses/ImageAI/issues/563
你是对的,它(ImageAI)与 Collecting keras==2.1.6 一起工作,在 colob 上检查过,谢谢
关于python - 如何修复模块 'tensorflow' 没有属性 'get_default_session',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56961839/
这个问题是关于在 TensorFlow 中运行 session 的。 我对 tf.get_default_session().run(...) 为 tf.Session().run(...) 服务的目
请帮忙解决这个问题我用 ImageAI 来检测汽车,但它没有用,我是新手,抱歉 from imageai.Detection import ObjectDetection import os exec
我试图找出为什么 tf.get_default_session() 总是返回 None 类型: import tensorflow as tf tf.reset_default_graph() ini
我是一名优秀的程序员,十分优秀!