Yolov5+DeepSort 统计数量

GitHub - mikel-brostrom/Yolov5_DeepSort_Pytorch: Real-time multi-object tracker using YOLO v5 and deep sorticon-default.png?t=M0H8https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch

1、安装python3.8

1apt-get install python3.8-distutils -y
2apt-get install python3.8-tk -y
3apt-get install curl -y
4curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
5python3.8 get-pip.py

2、下载代码

git clone --recurse-submodules https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch.git

3、安装依赖

pip install -r requirements.txt

这里的torch需要针对你的显卡和CUDA版本来进行安装。

python3.8 -m pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.tun
a.tsinghua.edu.cn/simple

我的是3070显卡。

4、开始检测视频

python3.8 track.py --source 1.mp4  --save-vid --save-txt --classes 0

5、分析结果

id_dict = {}
for line in open('../exp11/1.txt'):
    id = line.split(' ')[1]
    if id not in id_dict:
        id_dict[id] = 1
    else:
        id_dict[id] += 1
print(len(id_dict))
{'1': 468,
 '2': 5,
 '3': 768,
 '7': 3,
 '9': 6,
 '10': 110,
 '11': 7,
 '19': 2,
 '21': 2,
 '23': 86,
 '27': 46,
 '29': 378,
 '34': 222,
 '35': 194,
 '43': 120}

 

很明显,出现少于10次的数据可以舍弃掉。

最终检测到9个人。

与人眼分析的结果一致!!

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值