title: Forward process fail in ONNX model
body: <p>I want to use <a href="https://github.com/onnx/models/tree/master/vision/body_analysis/emotion_ferplus" rel="nofollow noreferrer">FER+ Emotion Recognition</a> in my project:</p>
  <pre><code>string modelPath = &quot;../data/model.onnx&quot;;
  Mat frame = imread(&quot;../data/Smile-Mood.jpg&quot;);
  
  Mat gray;
  cvtColor(frame, gray, COLOR_BGR2GRAY);
  
  float scale = 1.0;
  int inHeight = 64;
  int inWidth = 64;
  bool swapRB = false;
  
  //Read and initialize network
  cv::dnn::Net net = cv::dnn::readNetFromONNX(modelPath);
  
  Mat blob;
  //Create a 4D blob from a frame
  cv::dnn::blobFromImage(gray, blob, scale, Size(inWidth, inHeight), swapRB, false);
  
  //Set input blob
  net.setInput(blob);
  
  //Make forward pass
  Mat prob = net.forward();
  </code></pre>
  <p>I have this error in last line:</p>
  <p><code>Unhandled exception at 0x00007FFDA25AA799 in FERPlusDNNOpenCV.exe: Microsoft C++ exception: cv::Exception at memory location 0x00000063839BE050. occurred</code></p>
  <p><code>OpenCV(4.1.0) Error: Assertion failed (ngroups &gt; 0 &amp;&amp; inpCn % ngroups == 0 &amp;&amp; outCn % ngroups == 0) in cv::dnn::ConvolutionLayerImpl::getMemoryShapes</code></p>
  <p>how to fix that?</p>
  <p><strong>UPDATE ACCORDING @Micka COMMENT</strong>:</p>
  <pre><code>Mat dstImg = Mat(64, 64, CV_32FC1);
  
  resize(gray, dstImg, Size(64, 64));
  
  std::vector&lt;float&gt; array;
  if (dstImg.isContinuous())
      array.assign(dstImg.data, dstImg.data + dstImg.total());
  else{
      for (int i = 0; i &lt; dstImg.rows; ++i) {
          array.insert(array.end(), dstImg.ptr&lt;float&gt;(i), dstImg.ptr&lt;float&gt;(i) + dstImg.cols);
      }
  }
  
  //Set input blob
  net.setInput(array);
  
  //Make forward pass
  Mat prob = net.forward();
  </code></pre>
  <p>I've got this error: <code>vector subscript out of range.</code></p>
  <p>Should I use another function instead <code>setInput</code>?</p>