1.github:https://github.com/qqwweee/keras-yolo3
中文使用教程:https://busy.org/@hongtao/yolo
2. keras中文:https://keras.io/zh/getting-started/sequential-model-guide/
3.通過anonconda3安裝keras,tensoflow-gpu環境:https://blog.csdn.net/qq_38901147/article/details/90049666
報錯:
1.運行python yolo_video.py --input
File "/home/zengjun/Resume/yolo_detection/keras_yolov3/keras-yolo3/yolo.py", line 173, in detect_video
import cv2
ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type
原因:https://blog.csdn.net/Changer_sun/article/details/81079756這篇文章講解了問題背景
>>> import sys
>>> sys.path
['', '/usr/lib/python3.5/site-packages', '/home/zengjun/tutorial_ws/devel/lib/python2.7/dist-packages', '/opt/ros/kinetic/lib/python2.7/dist-packages', '/home/zengjun/anaconda3/envs/tensoflow35/lib/python35.zip', '/home/zengjun/anaconda3/envs/tensoflow35/lib/python3.5', '/home/zengjun/anaconda3/envs/tensoflow35/lib/python3.5/plat-linux', '/home/zengjun/anaconda3/envs/tensoflow35/lib/python3.5/lib-dynload', '/home/zengjun/.local/lib/python3.5/site-packages', '/home/zengjun/anaconda3/envs/tensoflow35/lib/python3.5/site-packages']
>>>
環境變量'/opt/ros/kinetic/lib/python2.7/dist-packages'的優先級更高,將其從環境變量刪除就不會報錯
def detect_video(yolo, video_path, output_path=""):
import sys
sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages') #Zen add this
import cv2