B
B
Bebronyukh Savory2020-04-05 11:32:29
Python
Bebronyukh Savory, 2020-04-05 11:32:29

python imageAi code not working?

I have python 3.7.0.
I use imageAI for object recognition.
The code:

import imageai
from imageai.Detection import ObjectDetection
import os

exec_path = os.getcwd()

detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath(os.path.join(
  exec_path, "D:/MyProjects/Python/SearchObject/ObjShot/resnet50_coco_best_v2.0.1.h5/")
)
detector.loadModel()

list = detector.detectObjectsFromImage(
  input_image=os.path.join(exec_path, "objects.jpg"),
  output_image_path=os.path.join(exec_path, "new_objects.jpg"),
  minimum_percentage_probability=90,
  display_percentage_probability=True,
  display_object_name=False
)

I know it's because of version 2 of tenser flow .
How to solve it???
Mistake:
RuntimeError: `get_session` is not available when using TensorFlow 2.0.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question