Closed vpolimenov closed 5 years ago
ImageAI currently supports Tensorflow as the backend for Keras.
I am having difficulties to set the first video example.
Here are the version of all dependencies:
tensorflow==1.8.0
numpy==1.13.3
scipy==0.19.1
keras==2.1.5
opencv-python==3.4.3.18
h5py==2.8.0
imageai==2.0.2
I managed to overcome the error above by forking the repo and changing this line of code. However, I don't think this would be the proper solution as now I am getting:
Traceback (most recent call last):
File "object_detection.py", line 9, in <module>
execution_path = os.getcwd()
File "/Users/ventsislav/Venci/Development/ImageAI/imageai/Detection/__init__.py", line 1076, in loadModel
iou_threshold=self.__yolo_iou)
File "/Users/ventsislav/anaconda/envs/py3/lib/python3.6/site-packages/imageai/Detection/YOLOv3/utils.py", line 87, in yolo_eval
anchors[anchor_mask[l]], num_classes, input_shape, image_shape)
File "/Users/ventsislav/anaconda/envs/py3/lib/python3.6/site-packages/imageai/Detection/YOLOv3/utils.py", line 64, in yolo_boxes_and_scores
anchors, num_classes, input_shape)
File "/Users/ventsislav/anaconda/envs/py3/lib/python3.6/site-packages/imageai/Detection/YOLOv3/utils.py", line 15, in yolo_head
[1, grid_shape[1], 1, 1])
File "/Users/ventsislav/anaconda/envs/py3/lib/python3.6/site-packages/keras/backend/theano_backend.py", line 975, in tile
if n.ndim == 0:
AttributeError: 'list' object has no attribute 'ndim'
when loading the yolo
pre-trained model.
EDIT Forgot to mention it's a python 3 environment.
ok got it.
the solution was to set the keras backend variable to use tensorflow.
KERAS_BACKEND=tensorflow python video_detection.py
I am glad you got it fixed.
Here is the error I am getting:
I see that in the
__init__.py
there is this and found out that it should be changed toimport keras.backend.tensorflow_backend as K
.Here is the link that helped me find that out.