Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inference with OpenCV #10

Open
JonathanSamelson opened this issue Jun 28, 2021 · 0 comments
Open

Inference with OpenCV #10

JonathanSamelson opened this issue Jun 28, 2021 · 0 comments

Comments

@JonathanSamelson
Copy link

Hi,

I wanted to use your caffe model trained on DETRAC with OpenCV to do inference on a test image but I get the following error:

cv2.error: OpenCV(4.5.1) C:\Users\samelson\AppData\Local\Temp\pip-req-build-fupgqc0e\opencv\modules\dnn\src\dnn.cpp:3113: error: (-215:Assertion failed) inp.total() in function 'cv::dnn::dnn4_v20201117::Net::Impl::allocateLayers

I tried with both vgg16_eb_1-3-5_final.caffemodel and vgg16_eb_5_final.caffemodel

Here is the code I used:

    model_path = "vgg16_eb_1-3-5_final.caffemodel"
    config_path = "test_1-3-5.prototxt.txt"

    frame = "path/to/test/image.jpg"

    net = cv2.dnn.readNet(model_path, config_path)
# or 
   net = cv2.dnn.readNetFromCaffe(config_path, model_path)

    image = cv2.imread(frame)
    blob = cv2.dnn.blobFromImage(image, 1, (input_width, input_height), (104, 117, 123))

    net.setInput(blob)
    outputs = net.forward()

Does anyone know if it's possible to do inference with OpenCV with those models or is there particular layers that are not implemented in OCV?

Thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant