qqwweee / keras-yolo3

A Keras implementation of YOLOv3 (Tensorflow backend)
MIT License
7.14k stars 3.45k forks source link

Load yolo9000 #348

Open AlbertoSabater opened 5 years ago

AlbertoSabater commented 5 years ago

Is there any way to load the pretrained yolo9000 with this repository?

I've managed to create the keras model with: https://github.com/allanzelener/YAD2K/blob/master/yad2k.py But it fails when loading the keras model from a python script.

from yolo import YOLO

model = YOLO(
                model_image_size=(img_size, img_size),
                model_path = 'model_data/yolo9000.h5',
                anchors_path = 'model_data/yolo9000_anchors.txt',
                classes_path = 'model_data/9k_names.txt',
            )
File "/home/asabater/projects/keras-yolo3/yolo.py", line 77, in generate
    num_anchors/len(self.yolo_model.output) * (num_classes + 5), \

TypeError: object of type 'Tensor' has no len()
void-robotics commented 5 years ago

see https://github.com/qqwweee/keras-yolo3/issues/93

AlbertoSabater commented 5 years ago

@nathangeorge1 that's the issue my answer is based on. Once you have built the keras model following these instructions, the file 'yolo9000.h5' is generated. Is there any way to load it with the code I provided in my question?

void-robotics commented 5 years ago

I'm not sure; I just decided to use https://github.com/philipperemy/yolo-9000 instead.