深度学习目标检测基础与实现
1. 图像金字塔与滑动窗口
在目标检测中,图像金字塔和滑动窗口是两个重要的基础概念。图像金字塔通过对图像进行不同尺度的缩放,从而可以在不同大小的目标上进行检测。而滑动窗口则是在图像上以固定的步长和大小移动,提取感兴趣区域(ROI)。
以下是构建图像金字塔的代码:
# compute the dimensions of the next image in the pyramid
w = int(image.shape[1] / scale)
image = imutils.resize(image, width=w)
# if the resized image does not meet the supplied minimum
# size, then stop constructing the pyramid
if image.shape[0] < minSize[1] or image.shape[1] < minSize[0]:
break
# yield the next image in the pyramid
yield image
图像金字塔函数 image_pyramid 需要一个参数:要应用金字塔的图像。还可以选择提供 scale 参数,它控制着每一层图像的缩放比例。较小的 scale 会生成更多的金字塔层,而较大的 scale 则会生成较少的层,通常 scale
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



