如何修复模块'tensorflow'没有属性'get_default_session'

时间:2019-07-10 00:04:57

标签: python tensorflow neural-network

请帮助解决该问题 我使用ImageAI来检测汽车,但没有用,我是新手,对不起

const fn = ({ target }) => {
  const img = target.nextElementSibling;
  img.src = '/images/index/menu/poetry_over_static.jpg';
}
['mouseover', 'mouseout', 'mousedown', 'mouseup'].forEach((eventType) => {
  a.addEventListener(eventType, fn);
});

使用TensorFlow后端。

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("--------------------------------")

1 个答案:

答案 0 :(得分:0)

this issue

您是对的(ImageAI)与Collecting keras == 2.1.6配合使用,已在colob中选中,谢谢