Forums - ssdmobilenet outputting blanks

4 posts / 0 new
Last post
ssdmobilenet outputting blanks
mahendra.norman
Join Date: 13 Jul 18
Posts: 3
Posted: Fri, 2018-08-03 08:32

I managed to transform the ssd_mobilenet_v1_coco_2017_11_17 model to a dlc file.

The model ran on Android but the output is practically blank (only 1.0 for scores, 0.0 for boxes and classes)

I'm not sure what exactly is wrong.

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 < image.getHeight(); y++) {
        for (int x = 0; x < 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)       & 0xFF);
    float g = ((pixel >>  8) & 0xFF);
    float r = ((pixel >> 16) & 0xFF);

    return new float[] {r,g,b};

}

this is how I preprocessed the already cropped Image, which in this case is 300x300 (basically took it from the demo app). 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.

the model seems to be running at about 30-40 (execution time) ms so I assume that the input is wrong.

 

  • Up0
  • Down0
svenzhang
Join Date: 18 Jun 18
Posts: 9
Posted: Sun, 2018-08-05 18:46

Hi mahendra,

You can try swap R and B channel, NN's input should be BGR format. and also make sure you don't involved Alpha channel in bitmap.

  • Up0
  • Down0
svenzhang
Join Date: 18 Jun 18
Posts: 9
Posted: Mon, 2018-08-06 01:09

Update: I get same problem with DSP as backend, but CPU and GPU mode is ok.

  • Up0
  • Down0
yoav.kurtz
Join Date: 11 Dec 19
Posts: 1
Posted: Wed, 2019-12-11 23:32

Hello mr. Mahendra,

I know it's been quite a while since you posted this question but I'm currrently struggiling with the exact same issue, and couldn't find any inforamtion on the matter.

Can you please shed some light as to how you solved the blank SSD output problem?

Thank you very much!

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.