def classify_video_frame(frame, faces, VGG_S_Net, categories=None):
# Handle incorrect image dims for uncropped images
# TODO: Get uncropped images to import correctly
#if frame.shape[0] == 3:
# frame = np.swapaxes(np.swapaxes(frame, 0, 1), 1, 2)
# Convert to float format:
frame = frame.astype(np.float32)
frame /= 255.0
labels = []
for x,y,w,h in faces:
img = frame[y:y+h,x:x+w,:]
# Input image should be WxHxK, e.g. 490x640x3
prediction = VGG_S_Net.predict([img], oversample=False)
labels.append(prediction.argmax())
return labels
caffe_functions.py 文件源码
python
阅读 34
收藏 0
点赞 0
评论 0
评论列表
文章目录