最近复习春招,整理了一下之前写的CS231n里的作业的内容方便复习😀
常用运算及其求导
softmax
1 | def softmax_loss_vectorized(W, X, y, reg): |
svm loss
1 | def svm_loss(x, y): |
fully connected
1 | def affine_forward(x, w, b): |
batch norm
1 | def batchnorm_forward(x, gamma, beta, bn_param): |
dropout
1 | def dropout_forward(x, dropout_param): |
conv
1 | def conv_forward_naive(x, w, b, conv_param): |
max pool
1 | def max_pool_forward_naive(x, pool_param): |
常用优化器
sgd
1 | def sgd(w, dw, config=None): |
sgd w/ momentum
1 | def sgd_momentum(w, dw, config=None): |
rmsprop
1 | def rmsprop(w, dw, config=None): |
adam
1 | def adam(w, dw, config=None): |
其他
mAP
$$
\mathrm{mAP} = \frac{\Sigma_{i=1}^{n} \mathrm{AP}_i}{n}
$$
$$
\mathrm{AP}_i = \Sigma_j \mathrm{precision}_j (\mathrm{recall}j - \mathrm{recall}{j-1})
$$
IoU
1 | ixmin = max(pred_bbox[0], gt_bbox[0]) |
nms
1 | def py_cpu_nms(dets, thresh): |
欧式距离
1 | # X, Y: N*D |