Помогите переписать код для tensorflow 2.0; ImageAI; Python

Хочу распознавать образы на видео, для этого установил все пакеты, как на этом сайте https://imageai.readthedocs.io/en/latest/ после чего, скачав все нужные файлы, как показано здесь https://imageai.readthedocs.io/en/latest/video/index.html, вставил вот этот код к себе и пытался запустить

from imageai.Detection import VideoObjectDetection
import os
import cv2

execution_path =  os.getcwd()

camera = cv2.VideoCapture(0) 

 detector= VideoObjectDetection()
.setModelTypeAsYOLOv3()
.setModelPath(os.path.join( execution_path ,  "yolo.h5")) 
detector.loadModel() 

video_path =  detector.detectObjectsFromVideo( camera_input= camera, 
    output_file_path= os.path.join( execution_path,  "camera_detected_video")
    ,  frames_per_second= 20,  log_progress= True,  minimum_percentage_probability= 30) 

print( video_path)

при попытке запуска, он выдает вот это:

Using TensorFlow backend.
2020-05-01 18:33:20.415776: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-05-01 18:33:20.415940: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "S:/Media/Programming/Python/untitled/test1.py", line 25, in <module>
    detector = VideoObjectDetection()
  File "C:\Users\uneen\AppData\Local\Programs\Python\Python38\lib\site-packages\imageai\Detection\__init__.py", line 984, in __init__
    self.sess = K.get_session()
  File "C:\Users\uneen\AppData\Local\Programs\Python\Python38\lib\site-packages\keras\backend\tensorflow_backend.py", line 378, in get_session
    raise RuntimeError(
RuntimeError: `get_session` is not available when using TensorFlow 2.0.

Я так понял, ему не нравится, что tensorflow у меня второй версии, так как он делает на это проверку в стоке с detector= VideoObjectDetection() Вот и возникает вопрос: Как заставить его работать? Всем спасибо!


Ответы (1 шт):

Автор решения: Георгий Яшин

Проблема оказалось в том, что я дурак, и библиотека ImageAI, как написано разработчиком на страничке riddit, не поддерживает TF2 на данный момент (3.05.2020).

→ Ссылка