keras下配置YOLO

主要步骤参考windows10+keras下的yolov3的快速使用及自己数据集的训练qqwweee/keras-yolo3。说一下他们没说的点,首先配置时要注意Keras,TensorFlow的版本,我被这东西快搞死了!版本不匹配的话,会报错:

AttributeError: module ‘tensorflow.python.ops.nn’ has no attribute ‘leaky_relu’ 

Keras-yolo3的是Keras2.1.5,TensorFlow1.6.0,主要是Keras版本的问题,经过变换版本,我的是Keras2.1.2,TensorFlow1.2.1,可以转换配置文件。之后运行yolo.py不出现图片,主要是因为里面没有写main,在yolo.py的末尾加入以下代码,可以正确运行。(各位大佬都喜欢讲个大概!!):

def detect_img(yolo): 
    while True: 
        img = input('Input image filename:')  
        try:   
            image = Image.open(img)            
        except: 
            print('Open Error! Try again!') 
            continue 
        else: 
            r_image=yolo.detect_image(image) 
            #r_image.show()   
            cv2.imshow("test",r_image)

    yolo.close_session() 

if __name__ == '__main__': 
    detect_img(YOLO())

VS下YOLO的配置:YOLO v3在Windows下的配置(无GPU)+opencv3.2.0+VS2015windows系统yolov3的安装教程(图文)Yolo:Win10+Yolo环境配置+利用Yolov3训练自己的数据集最详细攻略——Jason niu,有时间再弄。

猜你喜欢

转载自blog.csdn.net/qq_40250862/article/details/82953112