Ask Your Question

Revision history [back]

how to run BING(salience detection) by python

Hello All, I would like to run BING to detect the object proposal in python. Here is my sample code.

import cv2
bing = cv2.saliency.ObjectnessBING_create()
bing.setTrainingPath(r'modelpath')
bing.setBase(2)
bing.setW(8)
bing.setNSS(2)
bing.setTrainingPath(r'modelpath')
img = cv2.imread('1.jpg')
ret = bing.computeSaliency(img.astype(np.float32))

However, I meet the following erros:

cv2.error: D:\Build\OpenCV\opencv_contrib-3.3.0\modules\saliency\src\BING\FilterTIG.cpp:74: error: (-215) w1f.cols * w1f.rows == D && w1f.type() == CV_32F && w1f.isContinuous() in function cv::saliency::ObjectnessBING::FilterTIG::update

I guess the last condition is not met. (w1f.isContinuous())

How to make the image in opencv to continuous? thanks in advance.

best, xueliang