赞
踩
参考项目地址:https://github.com/Tossy0423/yolov4-for-darknet_ros 该项目在darknet_ros项目基础上添加了yolov4。注意原始项目没有yolov4的tiny版本,如想使用需要自己添加。
首先建立一个新的空间:
- ## Create workspace for ROS, Change directory
- $ mkdir -p workspace/src && cd workspace/src
-
- ## init workspace
- $ catkin_init_workspace
-
- ## Make
- $ cd ../
- $ catkin_make
安装:
- $ cd src
- $ git clone --recursive https://github.com/Tossy0423/yolov4-for-darknet_ros.git
编译:
$ catkin_make
编译工作有一处需要注意:编译时会自动下载几个权重文件,而这些文件比较大,可Ctrl+C终端编译后继续,如此几次后跳过下载过程。编译后单独下载后放置于规定文件夹中。下载地址在https://github.com/AlexeyAB/darknet#pre-trained-models中。
- [gazebo-2] process has died [pid 2671, exit code 127,cmd /usr/local/share/drcsim-2.7/ros/atlasutils/scripts/
- rungazebo vrctask1.world -q -r --recordencoding=zlib --recordpath=/tmp/vrctask1 _name:=gazebo _log:=/home/
- tania/.ros/log/5704913c-0b8c-11e3-ba22-6c8814fca2c8/gazebo-2.log]. log file: /home/tania/.ros/log/57049
- 13c-0b8c-11e3-ba22-6c8814fca2c8/gazebo-2*.log
-
- [gazebo_gui-3] process has died [pid 15649, exit code 139, cmd /home/usr/catkin_ws/src/gazebo_ros_pkgs/gazebo_ros/scripts/gzclient __name:=gazebo_gui __log:=/home/shahed/.ros/log/8981441a-03ea-11e3-8d2b-0017c4a8146b/gazebo_gui-3.log].
- log file: /home/usr/.ros/log/8981441a-03ea-11e3-8d2b-0017c4a8146b/gazebo_gui-3*.log
这是因为Gazebo得版本过低,升级一下Gazebo即可。
可参考链接:http://www.manongjc.com/article/80217.html
关于如何配置CUDA的项目:https://github.com/Musyue/darknet_ros_yolov4
在这项工作中只需要将YOLO的文件组织结构弄清晰即可完成。有以下几个文件需要注意:cfg/weights/yaml/launch
cfg是网络结构的设置文件,顾名思义它规定了网络长什么样。
yolov4-ting.cfg:
- [net]
- # Testing
- #batch=1
- #subdivisions=1
- # Training
- batch=64
- subdivisions=1
- width=416
- height=416
- channels=3
- momentum=0.9
- decay=0.0005
- angle=0
- saturation = 1.5
- exposure = 1.5
- hue=.1
-
- learning_rate=0.00261
- burn_in=1000
- max_batches = 500200
- policy=steps
- steps=400000,450000
- scales=.1,.1
-
- [convolutional]
- batch_normalize=1
- filters=32
- size=3
- stride=2
- pad=1
- activation=leaky
weights文件是训练的结果
yolov4-tiny.weights打开后时一堆乱码
yaml是ROS的配置文件,里面加载了上面两个文件的路径以及标签描述
yolov4-tiny.yaml文件
- yolo_model:
-
- config_file:
- name: yolov4-tiny.cfg
- weight_file:
- name: yolov4-tiny.weights
- threshold:
- value: 0.3
- detection_classes:
- names:
- - person
- - bicycle
- - car
- - motorbike
- - aeroplane
- - bus
- - train
- - truck
- - boat
- - traffic light
- - fire hydrant
- - stop sign
- - parking meter
- - bench
launch文件就比较熟悉了,里面调用了yaml文件,注意修改下路径
这里需要注意一下cfg文件与weights文件在项目https://github.com/AlexeyAB/darknet中直接下载即可,yaml文件与launch文件在yolov4或者yolov3文件的基础上修改即可。也可直接在我的百度盘https://pan.baidu.com/share/init?surl=LRFCyf7CtNTnJUgeXAbWUQ中下载,密码为1zb9
如出现超出cuda-memory的错误,注意修改cfg文件中的batch_size参数
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。