# Object Detection with Yolo, OpenCV and Python via Real Time Streaming Protocol (RTSP)
Object detection using deep learning with Yolo, OpenCV and Python via Real Time Streaming Protocol (`RTSP`)
Recognized objects are stored in date seperated in folders per class for further training or face recognition.
OpenCV `dnn` module supports running inference on pre-trained deep learning models from popular frameworks like Caffe, Torch and TensorFlow.
When it comes to object detection, popular detection frameworks are
* YOLO
* SSD
* Faster R-CNN
Support for running YOLO/DarkNet has been added to OpenCV dnn module recently.
## Dependencies
* opencv
* numpy
* imageio-ffmpeg
`pip install numpy opencv-python imageio-ffmpeg`
**Note: Python 2.x is not supported**
## YOLO (You Only Look Once)
Download the pre-trained YOLO v3 weights file from this [link](https://pjreddie.com/media/files/yolov3.weights) or for tiny weights for slower machines [link](https://pjreddie.com/media/files/yolov3-tiny.weights) and place it in the current directory or you can directly download to the current directory in terminal using
`$ wget https://pjreddie.com/media/files/yolov3.weights`
`$ wget https://pjreddie.com/media/files/yolov3-tiny.weights`
Provided all the files are in the current directory, below command will apply object detection on the input video `commuters.mp4`.
`$ python yolo_opencv.py --input sampledata/commuters.mp4 --config cfg/yolov3-tiny.cfg --weights yolov3-tiny.weights --classes cfg/yolov3.txt`
For RTSP simply put the RTSP URL as --input
`$ python yolo_opencv.py --input rtsp://xxxxx:1935/live/sys.stream --framestart 100 --framelimit 100 --config cfg/yolov3-tiny.cfg --weights yolov3-tiny.weights --classes cfg/yolov3.txt`
**Arguments**
| parameter | type | description |
| --------- | ------- | ------------------------------------------------ |
| `input` | String | /path/to/input/stream |
| `outputfile` | String | /path/to/outputfile |
| `outputdir` | String | /path/to/outputdir |
| `framestart` | Int | start detecting at frame x (int) |
| `framelimit` | Int | stop after x (int) frames and save the video in case of streams. 0 no limit |
| `config` | String | /path/to/config/file |
| `weights` | String | /path/to/weights/file |
| `classes` | String | /path/to/classes/file |
| `invertcolor` | Boolean | in case of BGR streams |
| `fpsthrottle` | Int | in case of slower machines to keep up with a stream |
### sample output :
![](object-detection.png)
Checkout the object detection implementation available in [cvlib](http:cvlib.net) which enables detecting common objects in the context through a single function call `detect_common_objects()`.
## Credits
This project is based on [Arun Ponnusamy's Object Detection OpenCV](https://github.com/arunponnusamy/object-detection-opencv)
Sample video footage from [Videvo - Free Stock Video Footage](https://www.videvo.net/video/people-crossing-road-in-hong-kong-cbd/8162/)
没有合适的资源?快使用搜索试试~ 我知道了~
yolo-python-rtsp:通过实时流协议 (RTSP) 使用 Yolo、OpenCV 和 Python 的深度学习进行对...
共14个文件
xml:3个
cfg:2个
iml:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 63 下载量 165 浏览量
2021-05-29
14:56:57
上传
评论 13
收藏 56.34MB ZIP 举报
温馨提示
通过实时流协议 (RTSP) 使用 Yolo、OpenCV 和 Python 进行对象检测 通过实时流协议 ( RTSP ) 使用 Yolo、OpenCV 和 Python 的深度学习进行对象检测 识别出的对象按日期存储在每个类的文件夹中,以供进一步培训或人脸识别。 OpenCV dnn模块支持在来自 Caffe、Torch 和 TensorFlow 等流行框架的预训练深度学习模型上运行推理。 在对象检测方面,流行的检测框架是 优洛 固态硬盘 更快的 R-CNN 最近在 OpenCV dnn 模块中添加了对运行 YOLO/DarkNet 的支持。 依赖关系 opencv 麻木 imageio-ffmpeg pip install numpy opencv-python imageio-ffmpeg 注意:不支持 Python 2.x YOLO(你只看一次) 从此下载预训练的
资源推荐
资源详情
资源评论
收起资源包目录
yolo-python-rtsp-master.zip (14个子文件)
yolo-python-rtsp-master
cfg
yolov3.txt 624B
yolov3.cfg 8KB
yolov3-tiny.cfg 2KB
.DS_Store 6KB
yolo-python.iml 338B
object-detection.png 10.58MB
yolo_opencv.py 7KB
.idea
misc.xml 313B
modules.xml 262B
vcs.xml 167B
LICENSE 1KB
README.md 3KB
sampledata
commuters.mp4 45.76MB
.gitignore 1KB
共 14 条
- 1
汪纪霞
- 粉丝: 35
- 资源: 4700
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页