当前位置:网站首页>deepsort源码解读(一)
deepsort源码解读(一)
2022-07-27 05:24:00 【德林恩宝】
detection.py文件
# vim: expandtab:ts=4:sw=4
import numpy as np
# 用于保存通过目标检测器得到的一个检测框
class Detection(object):
"""
This class represents a bounding box detection in a single image.
Parameters
----------
tlwh : array_like
Bounding box in format `(x, y, w, h)`.
confidence : float
Detector confidence score.
feature : array_like
A feature vector that describes the object contained in this image.
Attributes
----------
tlwh : ndarray
Bounding box in format `(top left x, top left y, width, height)`.
confidence : ndarray
.
feature : ndarray | NoneTypeDetector confidence score
A feature vector that describes the object contained in this image.
"""
def __init__(self, tlwh, confidence, feature):
self.tlwh = np.asarray(tlwh, dtype=np.float)
self.confidence = float(confidence)
self.feature = np.asarray(feature, dtype=np.float32)
# 将坐标转换成左上顶点与右下顶点
def to_tlbr(self):
"""Convert bounding box to format `(min x, min y, max x, max y)`, i.e.,
`(top left, bottom right)`.
"""
ret = self.tlwh.copy()
ret[2:] += ret[:2]
return ret
# 将坐标转换成中心坐标,宽/高,高
def to_xyah(self):
"""Convert bounding box to format `(center x, center y, aspect ratio,
height)`, where the aspect ratio is `width / height`.
"""
# 原检测框的坐标为左上角坐标与宽高
# 转换成中心坐标与宽/高,高
ret = self.tlwh.copy()
ret[:2] += ret[2:] / 2
ret[2] /= ret[3]
return ret
边栏推荐
- Tips - completely delete the files on the USB flash drive
- LVM与磁盘配额
- Redis fast learning
- Sunflower: don't worry when you encounter computer vulnerabilities, understand clearly and then judge sunflower: don't worry when you encounter computer vulnerabilities, understand clearly and then ju
- PXE efficient batch network installation
- FTX.US推出股票和ETF交易服务,让交易更透明
- What if the website server is attacked? Sunflower tips that preventing loopholes is the key
- Problems related to compilation and training of Darknet yolov3 and Yolo fast using CUDA environment of rtx30 Series graphics card on win10 platform
- pymysql查询查询结果转换json
- ESXI虚拟机启动,模块“MonitorLoop”打开电源失败
猜你喜欢

Alibaba cloud SMS authentication third-party interface (fast use)

How can chrome quickly transfer a group of web pages (tabs) to another device (computer)

Disk management and file system

Linux Installation and uninstallation of MySQL

Soul continues to make efforts to list its social channels in Hong Kong. Why is "soul style social" popular?

EasyCVR平台播放设备录像时,拖动时间轴播放无效是什么原因?

LVM与磁盘配额

Redis fast learning

Detection and identification data set and yolov5 model of helmet reflective clothing

Linux安装与卸载MySql
随机推荐
Express框架
Linux安装Redis操作
众多世界500强企业集聚第二届数博会,数字产业大幕即将开启!
px4源码编译之 建立自己的程序模块
Iptables firewall
Lamp -- source code compilation and installation
According to SQL, you must know and learn SQL (MySQL)
TS学习(八) :TS中的类
What is the reason why the channel list is empty on the intelligent security video platform easycvr?
A cross domain problem of golang
Build cloud native operating environment
Summary of frequently asked questions in the interview [summarized after painstaking work all night]
gin-vue-admin 使用docker容器中的数据库
创建一个不依赖于任何基础镜像的容器
关于ES6的新特性
FTX US推出FTX Stocks,向主流金融行业迈进
Shell sentence judgment exercise
EasyCVR平台播放设备录像时,拖动时间轴播放无效是什么原因?
Sok: the faults in our asrs: an overview of attacks against automatic speech recognition
torch加载自定义模型的问题