1

trying to get a custom tensorFlowJS model to work in JS but getting error with the shape, kindly note that the model is already trained and converted to model.json but getting below error

Error: Error: Error in concat4D: Shape of tensors[1] (1,30,40,256) does not match the shape of the rest (1,15,20,832) along the non-concatenated axis 1.

below is the code:

const RGB = await imageToRgbaMatrix(imageUrl);
const model = await tf.loadLayersModel(modelUrl);
const ImageData =  await tf.tensor([RGB]);
const predictions = model.predict(ImageData);

in brief i am trying to implement the tfjs model (model.json) with binary file with it gives:

Error in concat4D: Shape of tensors[1] (1,30,40,256) does not match the shape of the rest (1,15,20,832).

James Z
  • 12,209
  • 10
  • 24
  • 44
Dev
  • 9
  • 1

0 Answers0