title: Implementing mobilenetssd with SNPE
body: <p>I managed to transform the ssd_mobilenet_v1_coco_2017_11_17 model to a dlc file.</p>
  
  <p>The model ran on Android but the output is practically blank (only 1.0 for scores, 0.0 for boxes and classes)</p>
  
  <p>I'm not sure what exactly is wrong. </p>
  
  <pre><code>float[] loadRgbBitmapAsFloat(Bitmap image) {
      final int[] pixels = new int[image.getWidth() * image.getHeight()];
      image.getPixels(pixels, 0, image.getWidth(), 0, 0,
              image.getWidth(), image.getHeight());
  
      final float[] pixelsBatched = new float[pixels.length * 3];
      for (int y = 0; y &lt; image.getHeight(); y++) {
          for (int x = 0; x &lt; image.getWidth(); x++) {
              final int idx = y * image.getWidth() + x;
              final int batchIdx = idx * 3;
  
              final float[] rgb = extractColorChannels(pixels[idx]);
              pixelsBatched[batchIdx]     = rgb[0];
              pixelsBatched[batchIdx + 1] = rgb[1];
              pixelsBatched[batchIdx + 2] = rgb[2];
          }
      }
      return pixelsBatched;
  }
  
  private float[] extractColorChannels(int pixel) {
      float b = ((pixel)       &amp; 0xFF);
      float g = ((pixel &gt;&gt;  8) &amp; 0xFF);
      float r = ((pixel &gt;&gt; 16) &amp; 0xFF);
  
      return new float[] {r,g,b};
  
  }
  </code></pre>
  
  <p>this is how I preprocessed the already cropped Image, which in this case is 300x300. The model is unquantized and I am using FloatTensor. I did try to use UserBufferTensor but I got an error instead saying that the forward propagation did not work.</p>