Ошибка get_session с использованием модуля imageai для обнаружения объектов с помощью tensorflow 2.0 на Jupyter Notebook

from imageai.Detection import ObjectDetection
import os

detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image.jpg"), 
output_image_path=os.path.join(execution_path , "imagenew.jpg"))

for eachObject in detections:
   print(eachObject["name"] , " : " , eachObject["percentage_probability"] )`

Выше мой полный код. Я получил ошибку RuntimeError: get_sessionнедоступно при использовании TensorFlow 2.0. с причиной из-за кода ниже

детектор = ObjectDetection()

Я пытаюсь выполнить миграцию в документе tensorflow, но все еще не могу и не знаю, что делать снова, помогите мне исправить ошибку. Спасибо.

0 ответов

Другие вопросы по тегам