Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

DNN forwards only first image

I make input for neural network with cv.dnn.blobFromImages, and then run forward function. Number of input images = 20. But I always get only one output, for first blob. I saw documentation of blobFromImages and forward fucntions but it didn't help. I got the same result on Python and C++

imgs = [cv.imread(e) for e in os.listdir()] #20 images
cv_input = cv.dnn.blobFromImages(imgs, 1, (64,64))
cvNet.setInput(cv_input)
pred = cvNet.forward()
pred # array([[1.]], dtype=float32)

DNN forwards only first image

I make input for neural network with cv.dnn.blobFromImages, and then run forward function. Number of input images = 20. But I always get only one output, for first blob. I saw documentation of blobFromImages and forward fucntions but it didn't help. I got the same result on Python and C++

imgs = [cv.imread(e) for e in os.listdir()] #20 images
cv_input = cv.dnn.blobFromImages(imgs, 1, (64,64))
cvNet.setInput(cv_input)
pred = cvNet.forward()
pred # array([[1.]], dtype=float32)

.............

    vector<vector<cv::Mat>> pred;
    // images = vector of cv::Mat
    cv::Mat inp = cv::dnn::blobFromImages(images, 1. / 255, cv::Size(64, 64), cv::Scalar(), true);
    cnn_cl.setInput(inp);
    cnn_cl.forward(pred);

DNN forwards only first image

I make input for neural network with cv.dnn.blobFromImages, and then run forward function. Number of input images = 20. But I always get only one output, for first blob. I saw documentation of blobFromImages and forward fucntions but it didn't help. I got the same result on Python and C++

imgs = [cv.imread(e) for e in os.listdir()] #20 images
cv_input = cv.dnn.blobFromImages(imgs, 1, (64,64))
cvNet.setInput(cv_input)
pred = cvNet.forward()
pred # array([[1.]], dtype=float32)

.............

 vector<vector<cv::Mat>> pred;
 // images = vector of cv::Mat
 cv::Mat inp = cv::dnn::blobFromImages(images, 1. / 255, cv::Size(64, 64), cv::Scalar(), true);
 cnn_cl.setInput(inp);
 cnn_cl.forward(pred);