hello! I am doing object recognition in python. Here is my code:
from imageai.Detection import ObjectDetection
detector = ObjectDetection()
model_path = “./models/yolo-tiny.h5”
input_path = “./input/test45.jpg”
output_path = “./output/newimage.jpg”
detector.setModelTypeAsTinyYOLOv3()
detector.setModelPath(model_path)
detector.loadModel()
detection = detector.detectObjectsFromImage(input_image=input_path, output_image_path=output_path)
for eachItem in detection:
print(eachItem , “ : ”, eachItem)
This code throws an error:
Traceback (most recent call last):
File “C:\Users\Даниил\PycharmProjects\object_detection\main.py”, line 1, in <module>
from imageai.Detection import ObjectDetection
File “C:\Users\Даниил\PycharmProjects\object_detection\venv\lib\site-packages\imageai\Detection\__init__.py”, line 17, in <module>
from imageai.Detection.YOLOv3.models import yolo_main, tiny_yolo_main
File “C:\Users\Даниил\PycharmProjects\object_detection\venv\lib\site-packages\imageai\Detection\YOLOv3\models.py”, line 8, in <module>
from keras.layers.normalization import BatchNormalization
ImportError: cannot import name ‘BatchNormalization’ from ‘keras.layers.normalization’ (C:\Users\Даниил\PycharmProjects\object_detection\venv\lib\site-packages\keras\layers\normalization\__init__.py)
Help solve the problem. Thanks in advance.