Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error using caffemodel Jupiter notebook

Hello!

I launch Caffe Models from http://vision.soic.indiana.edu/projects/egohands/

I get an error:

OpenCV (3.4.2) C: \ projects \ opencv-python \ opencv \ modules \ dnn \ src \ dnn.cpp: 431: error: (-215: Assertion failed) inputs.size () == requiredOutputs in function 'cv :: dnn :: experimental_dnn_v5 :: DataLayer :: getMemoryShapes'

when I run this code in jupiter notebook

%run C:\Users\DNS\Desktop\hand_detector.py
import numpy as np
from PIL import Image
proto_path = r'C:\Users\DNS\Desktop\hand_classifier.prototxt'
caffe_path = r'C:\Users\DNS\Desktop\hand_classifier.caffemodel'

Detector = HandDetector(proto_path, caffe_path)

img = np.array(Image.open(r'C:\Users\DNS\Desktop\_LABELLED_SAMPLES\CARDS_COURTYARD_B_T\frame_0011.jpg'))

boxes = Detector(img)

On the Internet, it is advised to change the first word in prototxt, but I do not know how, the first layer looks like this:

name: "HandsCaffeNet"
layers {
  name: "data"
  type: WINDOW_DATA
  top: "data"
  top: "label"
  window_data_param {
    source: "text_file_accroding_to_window_data_layer_formatting.txt"
    batch_size: 256
    fg_threshold: 0.5
    bg_threshold: 0.5
    context_pad: 16
    crop_mode: "warp"
  }
  transform_param {
    crop_size: 227
    mean_file: "/path_to_caffe/data/ilsvrc12/imagenet_mean.binaryproto"
    mirror: false
  }
  include: { phase: TEST }
}

I also read that you can re-size. However, in other topics in prototxt the height and width are written, for me I do not see this. I will be glad to help anyone. Thanks in advance!