面试常问算法
bo.qiu_xbw
Talking is cheap ,show me the code.
展开
-
mAP的计算代码
1.计算mapAP的计算需要针对具体类别的,通常我们表示的是AP50(IOU大于0.5就是tp,反之就是fp。)precision=TP/(TP+FP)分母表示所有的预测框recall = TP/(TP+FN) 分母表示gt的个数参考:https://blog.csdn.net/qq_35916487/article/details/89076570画出PR曲线,横坐标是recall,纵坐标是precision,求面积就是precision,但是积分很难求,于是用了插值法。参考https://原创 2020-08-17 11:53:17 · 1400 阅读 · 0 评论 -
手写Maxpooling,无padding(python)
import numpy as npdef max_pooling(feature_map, size=2, stride=2): """max_pooling""" #feature_map (h,w) height = feature_map.shape[0] width = feature_map.shape[1] # 确定最后的输出形状 out_height = np.uint16((height - size) // stride + 1)原创 2020-08-14 11:39:29 · 668 阅读 · 0 评论 -
手写卷积前向过程(无反向)
import numpy as npdef convv(feature, conv, stride): # (x+2p - kernel)//2 + 1 conv_l = conv.shape[0] rows = feature.shape[0] cols = rows out_size = (rows - conv_l) // stride + 1 outcome = np.zeros((out_size,out_size)) i = j = 0原创 2020-08-14 11:17:18 · 164 阅读 · 2 评论 -
手写NMS
def NMS(dects,threshhold): """ detcs:二维数组(n_samples,5) 5列:x1,y1,x2,y2,score threshhold: IOU阈值 """ x1=dects[:,0] y1=dects[:,1] x2=dects[:,2] y2=dects[:,3] score=dects[:,4] ndects=dects.shape[0]#box的数量 area=(x2原创 2020-08-12 17:50:00 · 492 阅读 · 0 评论