Tensorflow2.*环境 YOLOV4代码

亲测window10系统Tensorflow2.0.0、 2.1.0、 2.1.0环境 YOLOV4代码,十分好用。
从GitHub链接,clone到本地后

安装两个程序包

pip install tensorflow_addons==0.9.1
pip install easydict

下载权重文件

下载yolov4.weights文件,并放到./data/yolov4.weights目录下

链接:https://pan.baidu.com/s/1B_4GU5TtLsOhOlNKFHVx0g
提取码:pmks

预测

预测图像,运行detect.py,将flags.DEFINE_string(‘image’, ‘./data/kite.jpg’, ‘path to input image’)更改为需要预测的图像数据即可

flags.DEFINE_string('framework', 'tf', '(tf, tflite')
flags.DEFINE_string('weights', './data/yolov4.weights',
                    'path to weights file')
flags.DEFINE_integer('size', 608, 'resize images to')
flags.DEFINE_boolean('tiny', False, 'yolo or yolo-tiny')
flags.DEFINE_string('model', 'yolov4', 'yolov3 or yolov4')
flags.DEFINE_string('image', './data/kite.jpg', 'path to input image')
flags.DEFINE_string('output', 'result.png', 'path to output image')

预测视频,运行detectvideo.py,将flags.DEFINE_string(‘video’, ‘./data/road.avi’, ‘path to input video’)flags.DEFINE_string(‘video’, ‘./data/road.avi’, ‘path to input video’)更改为需要预测的视频数据即可

flags.DEFINE_string('framework', 'tf', '(tf, tflite')
flags.DEFINE_string('weights', './data/yolov4.weights',
                    'path to weights file')
flags.DEFINE_integer('size', 608, 'resize images to')
flags.DEFINE_boolean('tiny', False, 'yolo or yolo-tiny')
flags.DEFINE_string('model', 'yolov4', 'yolov3 or yolov4')
flags.DEFINE_string('video', './data/road.avi', 'path to input video')

训练等可以参看原作者的内容https://github.com/hunglc007/tensorflow-yolov4-tflite

你可能感兴趣的:(Tensorflow,计算机视觉)