Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError when checking input: expected input_image_meta to have shape (14,) but got array with shape (15,) #64

Closed
alic-xc opened this issue May 22, 2021 · 8 comments

Comments

@alic-xc
Copy link

alic-xc commented May 22, 2021

I'm training my model on google colab, but it did not pass 1 Epoch 1/300

Using resnet50 as network backbone For Mask R-CNN model
Applying Default Augmentation on Dataset
Train 300 images
Validate 55 images
Checkpoint Path: /content/mask_rcnn_models
Selecting layers to train
Epoch 1/300
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-dd1acad94c9d> in <module>()
      8 train_maskrcnn.load_pretrained_model("mask_rcnn_coco.h5")
      9 train_maskrcnn.load_dataset("fingerlings")
---> 10 train_maskrcnn.train_model(num_epochs = 300, augmentation=True,  path_trained_models = "mask_rcnn_models")

8 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/training_utils_v1.py in standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix)
    538                              ': expected ' + names[i] + ' to have shape ' +
    539                              str(shape) + ' but got array with shape ' +
--> 540                              str(data_shape))
    541   return data
    542 

ValueError: Error when checking input: expected input_image_meta to have shape (14,) but got array with shape (15,)

I don't know what is really wrong. i've been on it for hours.

@ayoolaolafenwa
Copy link
Owner

ayoolaolafenwa commented May 22, 2021

@alic-xc this kind of error is usually caused by specifying the wrong number of classes in the training configuration. Confirm that you specify the exact number of classes in your dataset in the the training configuration.

@alic-xc
Copy link
Author

alic-xc commented May 22, 2021

Yes, you're correct. I made a mistake while annotating my images.
i have fixed it

@alic-xc alic-xc closed this as completed May 22, 2021
@PrakharPrashantSingh
Copy link

PrakharPrashantSingh commented May 2, 2022

hi,
i am also facing same kind of error, i checked 5 times that my class names and count (i.e. 9 classes) are correct.. i just dont understand anything now.. please help me.

thanks
error

@chillum-codeX
Copy link

update your classes it will work

@PrakharPrashantSingh
Copy link

update your classes it will work

can you not see the above comments.. i checked my classes 5 times... and also the annotated images and annotations... its not working

@doubletaro
Copy link

me too.

@doubletaro
Copy link

The problem is the type is not the correct count.

@Dickoabc123
Copy link

Dickoabc123 commented Aug 18, 2023

@doubletaro Did you solve this folks? i get the message ValueError: Error when checking input: expected input_image_meta to have shape (None, 14) but got array with shape (2, 15)

Here is my config and I only have 1 class, but remembered to add one for the background so num_classes = 2

Configurations:
BACKBONE                       resnet101
BACKBONE_STRIDES               [4, 8, 16, 32, 64]
BATCH_SIZE                     2
BBOX_STD_DEV                   [0.1 0.1 0.2 0.2]
COMPUTE_BACKBONE_SHAPE         None
DETECTION_MAX_INSTANCES        100
DETECTION_MIN_CONFIDENCE       0.9
DETECTION_NMS_THRESHOLD        0.3
FPN_CLASSIF_FC_LAYERS_SIZE     1024
GPU_COUNT                      1
GRADIENT_CLIP_NORM             5.0
IMAGES_PER_GPU                 2
IMAGE_CHANNEL_COUNT            3
IMAGE_MAX_DIM                  640
IMAGE_META_SIZE                14
IMAGE_MIN_DIM                  640
IMAGE_MIN_SCALE                0
IMAGE_RESIZE_MODE              square
IMAGE_SHAPE                    [640 640   3]
LEARNING_MOMENTUM              0.9
LEARNING_RATE                  0.001
LOSS_WEIGHTS                   {'rpn_class_loss': 1.0, 'rpn_bbox_loss': 1.0, 'mrcnn_class_loss': 1.0, 'mrcnn_bbox_loss': 1.0, 'mrcnn_mask_loss': 1.0}
MASK_POOL_SIZE                 14
MASK_SHAPE                     [28, 28]
MAX_GT_INSTANCES               100
MEAN_PIXEL                     [123.7 116.8 103.9]
MINI_MASK_SHAPE                (56, 56)
NAME                           pole
NUM_CLASSES                    2
POOL_SIZE                      7
POST_NMS_ROIS_INFERENCE        1000
POST_NMS_ROIS_TRAINING         2000
PRE_NMS_LIMIT                  6000
ROI_POSITIVE_RATIO             0.33
RPN_ANCHOR_RATIOS              [0.5, 1, 2]
RPN_ANCHOR_SCALES              (32, 64, 128, 256, 512)
RPN_ANCHOR_STRIDE              1
RPN_BBOX_STD_DEV               [0.1 0.1 0.2 0.2]
RPN_NMS_THRESHOLD              0.7
RPN_TRAIN_ANCHORS_PER_IMAGE    256
STEPS_PER_EPOCH                730
TOP_DOWN_PYRAMID_SIZE          256
TRAIN_BN                       False
TRAIN_ROIS_PER_IMAGE           200
USE_MINI_MASK                  True
USE_RPN_ROIS                   True
VALIDATION_STEPS               182
WEIGHT_DECAY                   0.0001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants