开发者社区> 问答> 正文

net.blobs(“数据”)。data[…]= image_convert ValueError:

   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

展开
收起
kun坤 2019-12-25 21:44:45 570 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
OPEN SOURCE IN A DATA-DRIVEN WORLD 立即下载
The Value of Exploratory Data 立即下载
Using Hadoop to build a Data Quality Service for both real-time and batch data 立即下载