Skip to content Skip to sidebar Skip to footer

Cannot Add Tensor To The Batch: Number Of Elements Does Not Match. Shapes Are: [tensor]: [585,1024,3], [batch]: [600,799,3]

I am trying to train a model, at first I had dataset of 5000 images and training worked fine, Now I have added couple of more images and now my dataset contains 6,423‬ images. I

Solution 1:

It seems that the new images you've added have a resolution of 585x1024, which differs from the size that's expected by the model i.e. 600x799.

If so, then the solution is to resize these new images accordingly.

Solution 2:

If you need batch size > 1, you can resize the images to a uniform size with the right image_resizer in the config, one of the ones defined in the image_resizer protobuf file, which I assume is what is used to parse that part of the config.

For example (stolen from here):

image_resizer {
  fixed_shape_resizer {
    height: 600
    width: 800
  }
}

This seems to fix the problem for me.

Solution 3:

Changing the batch_size to 1 fixed this issue for me.

Post a Comment for "Cannot Add Tensor To The Batch: Number Of Elements Does Not Match. Shapes Are: [tensor]: [585,1024,3], [batch]: [600,799,3]"