上图看测试效果
youtube 上有视频展示:https://www.youtube.com/watch?v=2KxNnEV-Zes
demo链接:https://gitlab.com/irafm-ai/poly-yolo
提示:论文所用的python3.5作者已经试过,发现不能安装tensorflow-gpu 1.15.0版本,换成python3.6成功:
详细环境:
1、conda 环境安装:
wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
bash Anaconda3-2020.11-Linux-x86_64.sh
一路敲 Enter 键 和输入yes ,然后验证PATH环境变量是否生效,出现conda版本则安装成功
source ~/.bashrc
conda -V
2、conda虚拟环境创建
conda create -n POLY_YOLO python=3.6
conda activate POLY_YOLO
3、虚拟环境中python包的安装
PS:执行以下命令的时候如果出现,添加channel的提示,请换源https://blog.csdn.net/weixin_38705903/article/details/106168366
conda install tensorflow-gpu==1.15.0
conda install keras==2.3.0
conda install numpy
conda install pillow
conda install opencv
conda install matplotlib
准备数据集,制作成train.txt val.txt test.txt放到路径poly-yolo-master/poly_yolo下
论文代码中,将coco数据集转成yolo需要的数据集格式,脚本已给出:
/poly-yolo-master/poly_yolo/conversion_scripts/coco_to_yolo.py
poly_yolo数据格式为:
(path_to\image1.jpg x1,y1,x2,y2,class,p1x,p1y,pnx,pny x1,y1,x2,y2,class,p1x,p1y,pnx,pny),
其中x1,y1,x2,y2为bbox框的左上角和右下角,class为类别标签,p1x,p1y,pnx,pny为语义分割的vertexes。
模型训练:
python poly_yolo.py
模型预测:使用jupyter执行poly_yolo_inference.ipynb
1、K.learning_phase(): 0此处报错:
Etensorflow/stream_executor/cuda/cuda_dnn.cc:329] Could not create cudnn handle: CUDNN_STATUS_INTER
解决方法:
import tensorflow as tf
#=======
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.Session(config=config)
#======
2、由于博主主机之前安装了ROS,因而不能引入cv2报错:
解决方法:
import sys
ros_path = '/opt/ros/kinetic/lib/python2.7/dist-packages'
if ros_path in sys.path:
sys.path.remove(ros_path)
import cv2
sys.path.append('/opt/ros/kinetic/lib/python2.7/dist-packages')