Tensorfllow Js model works only with debug JS remotely

Please provide the following:

  1. SDK Version: 39
  2. Platforms(Android/iOS/web/all): Android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

Replace this section with as much relevant information as possible and any relevant code along with your question.
I have react native app that uses a tensorflow JS for using a pre built model. The model works perfectly fine only with debug JS remotely option. It predicts all zeros without debug remote debug option. Even resizeBilinear function returns zero tensor.
Appreciate any help to deal with this.
Here are the excerpts from my App.js

const imageTensoresized = tf.image.resizeBilinear(imageTensor, [224, 224]);
tf.print(imageTensoresized)
var InsectClass

try {
  let imgReshape = imageTensoresized.reshape([1,224,224,3])
    imgReshape.print()
  let Result = await InsectDetector.predict(imgReshape);
  console.log("[+] Insect Class Prediction Result",Result)
  let arsyn1 = Result.arraySync()[0]
  let PrData = Result.dataSync()
  InsectClass = indexOfMax(arsyn1)
  console.log("[+] Insect Class Prediction done Insect class ",PrData,arsyn1,InsectClass)

with debug JS remotely
Output of resizeBilinear
Tensor
[[[218 , 214 , 233 ],
[153.7857208, 152.1428528, 170.3571472],
[152.5714264, 152.1428528, 171.2857208],
…,
[202.0714417, 209.0714417, 229.0714417],
[210.1428833, 215.1428833, 235.1428833],
[204.8571777, 207.8571777, 228.8571777]],

 [[227.4285736, 223.1428528, 241.8571472],
  [155.663269 , 153.2857208, 171.6632538],
  [146        , 145.2040863, 164.4693909],
  ...,
  [139.3367462, 146.3367462, 166.3367462],
  [143.7755432, 148.7755432, 168.7755432],
  [139.9898376, 142.9898376, 163.9898376]],

 [[215.2857208, 210.2857208, 228.2857208],
  [146.4183655, 142.2040863, 160.9897919],
  [139.795929 , 138.0816345, 157.6530609],
  ...,
  [140.0102234, 147.0102234, 167.0102234],
  [143.7347412, 148.7347412, 168.7347412],
  [138.897995 , 141.897995 , 162.897995 ]],

 ...
 [[243        , 243        , 243        ],
  [243        , 243        , 243        ],
  [243        , 243        , 243        ],
  ...,
  [255        , 255        , 255        ],
  [255        , 255        , 255        ],
  [255        , 255        , 255        ]],

 [[243        , 243        , 243        ],
  [243        , 243        , 243        ],
  [243        , 243        , 243        ],
  ...,
  [255        , 255        , 255        ],
  [255        , 255        , 255        ],
  [255        , 255        , 255        ]],

 [[243        , 243        , 243        ],
  [243        , 243        , 243        ],
  [243        , 243        , 243        ],
  ...,
  [255        , 255        , 255        ],
  [255        , 255        , 255        ],
  [255        , 255        , 255        ]]]

Output of Prediction and array of 14 classes
Insect Class Prediction Result Tensor {
“dataId”: Object {},
“dtype”: “float32”,
“id”: 1411,
“isDisposedInternal”: false,
“kept”: false,
“rankType”: “2”,
“scopeId”: 5,
“shape”: Array [
1,
14,
],
“size”: 14,
“strides”: Array [
14,
]
Insect Class Prediction done Insect class Float32Array [
0.0000016172284631466027,
9.057301575410293e-9,
7.329967321588644e-15,
1.2915425395831903e-9,
4.440338985986069e-15,
2.503897493532671e-14,
0.9999667406082153,
5.261306108945174e-17,
1.159310532094322e-14,
6.238451533135958e-8,
6.097248501646391e-7,
9.456353755599167e-11,
0.00000242939313466195,
0.000028446653232094832,
]

Without remote debug
ResizeBilinear output
Tensor
[[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
…,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],

 [[0, 0, 0],
  [0, 0, 0],
  [0, 0, 0],
  ...,
  [0, 0, 0],
  [0, 0, 0],
  [0, 0, 0]],

 [[0, 0, 0],
  [0, 0, 0],
  [0, 0, 0],
  ...,
  [0, 0, 0],
  [0, 0, 0],
  [0, 0, 0]],

 ...
 [[0, 0, 0],
  [0, 0, 0],
  [0, 0, 0],
  ...,
  [0, 0, 0],
  [0, 0, 0],
  [0, 0, 0]],

 [[0, 0, 0],
  [0, 0, 0],
  [0, 0, 0],
  ...,
  [0, 0, 0],
  [0, 0, 0],
  [0, 0, 0]],

 [[0, 0, 0],
  [0, 0, 0],
  [0, 0, 0],
  ...,
  [0, 0, 0],
  [0, 0, 0],
  [0, 0, 0]]]

Output of Prediction and array of 14 classes
Insect Class Prediction Result Tensor {
“dataId”: Object {},
“dtype”: “float32”,
“id”: 1411,
“isDisposedInternal”: false,
“kept”: false,
“rankType”: “2”,
“scopeId”: 5,
“shape”: Array [
1,
14,
],
“size”: 14,
“strides”: Array [
14,
],
}
Float32Array [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
]

Appreciate your help in fixing his issue

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.