3

Help solve that problem please I use ImageAI to detect cars , but it didn't works , i'm newbee in this , sorry

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

Using TensorFlow backend.

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
4
  • Please organize your question better.its not clear at all the structure of your code and the error Commented Jul 10, 2019 at 0:06
  • Organized . sorry i'm first day on that platform. :c Commented Jul 10, 2019 at 0:10
  • Are you using tensorflow 2.0? Commented Jul 10, 2019 at 8:41
  • Yeah , i'm install 2.0 because on 1.14 was a lot of errors , and i find recommendation to install 2.0 Commented Jul 10, 2019 at 8:46

1 Answer 1

2

https://github.com/OlafenwaMoses/ImageAI/issues/563

You're right it (ImageAI) works with Collecting keras==2.1.6, checked on colob, Thanks

Sign up to request clarification or add additional context in comments.

1 Comment

You can test it: (keras==2.1.6, tensorflow==1.15.3) github.com/maxkleiner/maXbox4/blob/master/objectdetector3.ipynb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.