Error using caffemodel Jupiter notebook

asked 2020-02-19 12:30:13 -0500

Nativate gravatar image


I launch Caffe Models from

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\
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('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"
  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!

edit retag flag offensive close merge delete