Skip to content

[Solved] TensorList shape mismatch: Shapes -1 and 3 must match #2

@nirchetrit

Description

@nirchetrit

After exporting the model and testing that it works properly, I've converted it to Tensorflowjs following your steps.
I've loaded it to the browser and I can't find the way to let it predict an image,

Here's the code:

const process_input = (image ) => {
const tfimg = tf.browser.fromPixels(video_frame).toInt();
const expandedimg = tfimg.transpose([0, 1, 2]).expandDims();
return expandedimg;
};
const image = document.getElementById('image');
const preImage = process_input (image);
tf.engine().startScope();
model.executeAsync(testImg).then(predictions => {
console.log(predictions);
tf.engine().endScope();
});

Right after that, I got an error saying:

Unhandled Rejection (Error): TensorList shape mismatch: Shapes -1 and 3 must match

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions