Ask Your Question
1

(Object Detection)prior_box_layer.cpp error using Opencv dnn

asked 2018-02-27 00:15:32 -0600

MinxiangLiu gravatar image

I using Ubuntu 16.04.3, built Opencv 3.4.0 from source using this for python 3.5. image description

I try to use Wiki method in myself training data.

I use tf_text_graph_ssd.py script to generate a text graph representation.

On running the sample provided as object-detection-opencv.py

import cv2 as cv

cvNet = cv.dnn.readNetFromTensorflow('frozen_inference_graph.pb', 'out_graph.pbtxt')

img = cv.imread('image2.jpg')
rows = img.shape[0]
cols = img.shape[1]
cvNet.setInput(cv.dnn.blobFromImage(img, 1.0/127.5, (300, 300), (127.5, 127.5, 127.5), swapRB=True, crop=False))
cvOut = cvNet.forward()

for detection in cvOut[0,0,:,:]:
    score = float(detection[2])
    if score > 0.3:
        left = detection[3] * cols
        top = detection[4] * rows
        right = detection[5] * cols
        bottom = detection[6] * rows
        cv.rectangle(img, (int(left), int(top)), (int(right), int(bottom)), (23, 230, 210), thickness=2)

cv.imshow('img', img)
cv.waitKey()

Result: image description

shared here:https://drive.google.com/open?id=1Npu54EGHtqdd6dFb2Ff3TxRb5UpE1xkP

Any fix for this would be very much helpful.

edit retag flag offensive close merge delete

Comments

1

@dkurt seems something for you ;)

StevenPuttemans gravatar imageStevenPuttemans ( 2018-02-27 03:19:46 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-02-27 06:21:45 -0600

dkurt gravatar image

@MinxiangLiu Firstly, I'm very thankful to you for the detailed problem description! The thing is that this script was introduced after OpenCV 3.4.0 release so you need just update a source code. Everything else is fine. image description

edit flag offensive delete link more

Comments

This is very helpful to me.

MinxiangLiu gravatar imageMinxiangLiu ( 2018-02-27 23:44:33 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2018-02-27 00:15:32 -0600

Seen: 422 times

Last updated: Feb 27 '18