tensorflow - Different confidence with same model.pb from android and python -


i trained model.pb python, , put in android. well, find confidence score in android lower python application on pc. afaik, android model.pb, did not use decodejpeg because not support on android.

is there wrong or different decodejpeg in android example when processing image?

trace.beginsection("preprocessbitmap"); // preprocess image data 0-255 int normalized float based // on provided parameters. bitmap.getpixels(intvalues, 0, bitmap.getwidth(), 0, 0, bitmap.getwidth(), bitmap.getheight()); (int = 0; < intvalues.length; ++i) {     final int val = intvalues[i];     floatvalues[i * 3 + 0] = (((val >> 16) & 0xff) - imagemean) / imagestd;     floatvalues[i * 3 + 1] = (((val >> 8) & 0xff) - imagemean) / imagestd;     floatvalues[i * 3 + 2] = ((val & 0xff) - imagemean) / imagestd; } trace.endsection(); 

sorry fault set imagemean = -127 , imagestd = 127.

i did not know meaning below code, before .

for (int = 0; < intvalues.length; ++i) {     final int val = intvalues[i];     floatvalues[i * 3 + 0] = (((val >> 16) & 0xff) - imagemean) / imagestd;     floatvalues[i * 3 + 1] = (((val >> 8) & 0xff) - imagemean) / imagestd;     floatvalues[i * 3 + 2] = ((val & 0xff) - imagemean) / imagestd; } 

well understand , means convert rgb values [-1 ~ 1]

whtch tensorflow can read. imagemean should imagemean = 128 , imagestd = 128 example code in official github of tensorflow .or can use below more accuracy:

    floatvalues[i * 3 + 0] = (float) ((((val >> 16) & 0xff) / 255.0 * 2.0) - 1.0);     floatvalues[i * 3 + 1] = (float) ((((val >> 8) & 0xff) / 255.0 * 2.0) - 1.0);     floatvalues[i * 3 + 2] = (float) (((val & 0xff) / 255.0 * 2.0) - 1.0); 

because of accuracy problem, result still not same python tensorflow result, have been infinitely near each other.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -