Answer the question
In order to leave comments, you need to log in
ImportError: cannot import name 'BatchNormalization' from 'keras.layers.normalization' (C:\Users\HP\AppData\Roaming\Python\Python39\site-packages\ker?
Good afternoon! I wrote the code for the video (link to the video, if necessary https://www.youtube.com/watch?v=Uj4O2_dwRiA ), but when I run it, I get an error
Traceback (most recent call last):
File "C:\Users\HP\Desktop\python\__pycache__\parsing\musik\test.py", line 1, in <module>
from imageai.Detection import ObjectDetection
File "C:\Users\HP\AppData\Roaming\Python\Python39\site-packages\imageai\Detection\__init__.py", line 17, in <module>
from imageai.Detection.YOLOv3.models import yolo_main, tiny_yolo_main
File "C:\Users\HP\AppData\Roaming\Python\Python39\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\HP\AppData\Roaming\Python\Python39\site-packages\keras\layers\normalization\__init__.py)
from imageai.Detection import ObjectDetection
import os
exect_path=os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath(os.path.join(exect_path, "resnet50_coco_best_v2.1.0.h5"))
detector.loadModel()
list_ = detector.detectObjectsFromImage(
input_image=os.path.join(exect_path, "scale_1200.jpg"),
output_image_path=os.path.join(exect_path, "img.png")
)
Answer the question
In order to leave comments, you need to log in
Author, have you already overcome the problem?) I also came from YouTube
UPD: Everything works fine with this config
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question