def sliding_window(num_boxes, image, windowSize, workers=3):
image_batch = None
#'''Guarantee that middle of picture is always covered'''
#data = get_middle_box(image, windowSize)
#img = image[data[1]:data[3],data[0]:data[2]]
#image_batch = img[np.newaxis]
for i in range((num_boxes / workers)):
y = random.randrange(0, image.shape[0] - windowSize[0])
x = random.randrange(0, image.shape[1] - windowSize[1])
img = image[y:y + windowSize[1], x:x + windowSize[0]]
img = resize(img, (299, 299))
if image_batch is None:
image_batch = img[np.newaxis]
else:
image_batch = np.append(image_batch, img[np.newaxis], axis=0)
return image_batch
generate_boxes.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录