import os
import cv2
import caffe
import numpy as np
caffe.set_mode_cpu()
TEST_VIDEO = cv2.VideoCapture(os.getcwd() + '/mohan.avi')
MODEL_DEF = '/home/i3innovation/caffe-master/models /bvlc_reference_caffenet/deploy.prototxt'
MODEL_WEIGHTS = '/home/i3innovation/caffe-master/models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel'
net = caffe.Net(MODEL_DEF, MODEL_WEIGHTS,caffe.TEST)
success, image = TEST_VIDEO.read()
if (success):
refObj = None
imageToNet = cv2.resize(image, (300, 300))
image_convert1 = np.swapaxes(imageToNet, 1, 2)
print (image_convert1)
image_convert = np.swapaxes(image_convert1, 0, 1)
net.blobs['data'].data[...] = image_convert
# Forward pass.
detections = net.forward()['detection_out']
问题来源StackOverflow 地址:/questions/59387051/net-blobsdata-data-image-convert-valueerror-could-not-broadcast-inpu
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。