返回的数组将至少具有“ndmin”维度。否则,mono-dimensional axes will be squeezed。合法值:0(默认)、1或2。
tolist()方法a = np.array([[1,2,3],[4,5,6],[7,8,9]]) print(a) b = a.tolist() print(b) print(len(b)) #输出结果 [[1 2 3] [4 5 6] [7 8 9]] [[1, 2, 3], [4, 5, 6], [7, 8, 9]] 3np.roll()
链接: https://numpy.org/doc/stable/reference/generated/numpy.roll.html
iloc[] argsort detach() torch.backends.cudnn.benchmarkhttps://blog.csdn.net/byron123456sfsfsfa/article/details/96003317
https://blog.csdn.net/m0_46653437/article/details/110731647
python
pytorch
1.所有框按照类划分,剔除背景
2.对于每个物体的边界框(B_BOX),按照分类置信度降序排列
3.在某一类中,选择置信度最高的边界B_BOX1,将B_BOX1从输入中取出,加入到输入列表
4.逐个计算B_BOX1与其余B_BOX2的交并比IoU,若IoU(B_BOX1,B_BOX2)>阈值TH,则在输入中移除B_BOX2(此时是与B_BOX1计算IOU)
5.在除了B_BOX1的剩下框中重复步骤3~4,直到输入列表为空,完成一个物体类的遍历。
6.重复2~5,直到所有物体类的NMS处理完成。
7.输出列表,算法结束
# IOU计算 # 假设box1维度为[N,4] box2维度为[M,4] def iou(self, box1, box2): N = box1.size(0) M = box2.size(0) #以下计算已经转化为角点模式 lt = torch.max( # 左上角的点 box1[:, :2].unsqueeze(1).expand(N, M, 2), # [N,2]->[N,1,2]->[N,M,2] box2[:, :2].unsqueeze(0).expand(N, M, 2), # [M,2]->[1,M,2]->[N,M,2] ) rb = torch.min( box1[:, 2:].unsqueeze(1).expand(N, M, 2), box2[:, 2:].unsqueeze(0).expand(N, M, 2), ) wh = rb - lt # [N,M,2] wh[wh < 0] = 0 # 两个box没有重叠区域 inter = wh[:,:,0] * wh[:,:,1] # [N,M] area1 = (box1[:,2]-box1[:,0]) * (box1[:,3]-box1[:,1]) # (N,) #高*宽 area2 = (box2[:,2]-box2[:,0]) * (box2[:,3]-box2[:,1]) # (M,) #高*宽 area1 = area1.unsqueeze(1).expand(N,M) # (N,M) area2 = area2.unsqueeze(0).expand(N,M) # (N,M) iou = inter / (area1+area2-inter) return iounp.unique latex示例
Gamma公式展示 Γ ( n ) = ( n − 1 ) ! ∀ n ∈ N Gamma(n) = (n-1)!quadforall ninmathbb N Γ(n)=(n−1)!∀n∈N 是通过 Euler integral
Γ ( z ) = ∫ 0 ∞ t z − 1 e − t d t . Gamma(z) = int_0^infty t^{z-1}e^{-t}dt,. Γ(z)=∫0∞tz−1e−tdt.
z z z
yoloxpython tools/demo.py video -f exps/default/yolox_s.py -c yolox_s.pth.tar --path jianxin.mp4 --conf 0.25 --nms 0.45 --tsize 640 --save_result --device gpu
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)