# websocket-yolo-client **Repository Path**: smart-traffic-experiment/websocket-yolo-client ## Basic Information - **Project Name**: websocket-yolo-client - **Description**: 使用 yolov5 进行车辆检测并通过 socketio 客户端传输数据 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-20 - **Last Updated**: 2026-05-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 使用 yolov5 进行车辆检测并通过 socket 客户端传输数据 发出“YOLO_EVENT”以及数组:[PC_ID, passed lane, vehicle class] 消息,该消息将以字符串的形式出现。 Region Of Interests的数量和车道数量可以作为参数设置。如果没有传递 --web-socket 参数,则 websocket 将被禁用。 为了在 csv 中保存景象视频的投资回报率和/或航道坐标,以便下次运行时使用,工具目录里有脚本。生成的 csv 会依赖于视频名称或 URL(如果传递 URL 的话)。这对摄像头不适用。 ## 示例用法: - ### 启用 Websocket 客户端开始检测 `python detectvehicles.py --source "~/Downloads/traffic.mp4" --web-socket` - ### 车道数的传递 `python detectvehicles.py --source "~/Downloads/traffic.mp4" --web-socket --number-of-lanes 3` - ### 传递投资回报率的数字 `python detectvehicles.py --source "~/Downloads/traffic.mp4" --web-socket --number-of-lanes 3 --number-of-rois 2` - ### 将投资回报率和通道坐标保存为 csv `python tools/generateroicsv.py --generate-lanes-csv --source ~/Downloads/traffic.mp4 --number-of-rois 1 --number-of-lanes 3` ## 监听事件(服务器或客户端) ``` @socketio.on("YOLO_EVENT") def handle_yolo_event(received_data): print(received_data) ```