matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.59k stars 11.69k forks source link

Error while trying to retrain mask rcnn with 3 classes #2420

Open MartinJensen37 opened 3 years ago

MartinJensen37 commented 3 years ago

Hello! I'm trying to retrain the Mask-RCNN using only 3 classes from the MS COCO dataset. I've been following the step in #247 in order to do this. Firstly, I changed NUM_CLASSES=3 and then I changed the ´class_ids = [1, 67]and finally I addedexclude=['mrcnn_class_logits', 'mrcnn_bbox_fc', 'mrcnn_bbox', 'mrcnn_mask'] to the load_weights function on line 469 as in #247. For reference I'm using the 2014 training dataset from MS COCO

However I get an error message saying that something with the image dimensions are off(the error message is much longer than this but it keeps repeating being unable to fit one shape into another):

 python3 coco.py train --dataset=/home/robot/cv_ws/Mask_RCNN --model=coco 
/home/robot/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/robot/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/robot/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/robot/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/robot/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/robot/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Using TensorFlow backend.
Command:  train
Model:  coco
Dataset:  /home/robot/cv_ws/Mask_RCNN
Year:  2014
Logs:  /home/robot/cv_ws/Mask_RCNN/logs
Auto Download:  False

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.7
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                  1024
IMAGE_META_SIZE                93
IMAGE_MIN_DIM                  800
IMAGE_MIN_SCALE                0
IMAGE_RESIZE_MODE              none
IMAGE_SHAPE                    [1024 1024    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                           coco
NUM_CLASSES                    81
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                1000
TOP_DOWN_PYRAMID_SIZE          256
TRAIN_BN                       False
TRAIN_ROIS_PER_IMAGE           200
USE_MINI_MASK                  True
USE_RPN_ROIS                   True
VALIDATION_STEPS               50
WEIGHT_DECAY                   0.0001

WARNING:tensorflow:From /home/robot/.local/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From /home/robot/.local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:1208: calling reduce_max_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
WARNING:tensorflow:From /home/robot/.local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:1242: calling reduce_sum_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
Loading weights  /home/robot/cv_ws/Mask_RCNN/mask_rcnn_coco.h5
2020-11-12 14:15:56.242297: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2020-11-12 14:15:56.395361: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x41a6520 executing computations on platform CUDA. Devices:
2020-11-12 14:15:56.395445: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): GeForce GTX 1080 Ti, Compute Capability 6.1
2020-11-12 14:15:56.403514: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2100000000 Hz
2020-11-12 14:15:56.406826: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x1d04790 executing computations on platform Host. Devices:
2020-11-12 14:15:56.406892: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): <undefined>, <undefined>
2020-11-12 14:15:56.407225: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties: 
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.62
pciBusID: 0000:73:00.0
totalMemory: 10.92GiB freeMemory: 9.91GiB
2020-11-12 14:15:56.407299: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0
2020-11-12 14:15:56.410998: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-11-12 14:15:56.411034: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990]      0 
2020-11-12 14:15:56.411050: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0:   N 
2020-11-12 14:15:56.411203: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 9644 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:73:00.0, compute capability: 6.1)
loading annotations into memory...
Done (t=10.02s)
creating index...
index created!
loading annotations into memory...
Done (t=5.86s)
creating index...
index created!
loading annotations into memory...
Done (t=6.89s)
creating index...
index created!
Training network heads

Starting at epoch 0. LR=0.001

Checkpoint Path: /home/robot/cv_ws/Mask_RCNN/logs/coco20201112T1416/mask_rcnn_coco_{epoch:04d}.h5
Selecting layers to train
fpn_c5p5               (Conv2D)
fpn_c4p4               (Conv2D)
fpn_c3p3               (Conv2D)
fpn_c2p2               (Conv2D)
fpn_p5                 (Conv2D)
fpn_p2                 (Conv2D)
fpn_p3                 (Conv2D)
fpn_p4                 (Conv2D)
In model:  rpn_model
    rpn_conv_shared        (Conv2D)
    rpn_class_raw          (Conv2D)
    rpn_bbox_pred          (Conv2D)
mrcnn_mask_conv1       (TimeDistributed)
mrcnn_mask_bn1         (TimeDistributed)
mrcnn_mask_conv2       (TimeDistributed)
mrcnn_mask_bn2         (TimeDistributed)
mrcnn_class_conv1      (TimeDistributed)
mrcnn_class_bn1        (TimeDistributed)
mrcnn_mask_conv3       (TimeDistributed)
mrcnn_mask_bn3         (TimeDistributed)
mrcnn_class_conv2      (TimeDistributed)
mrcnn_class_bn2        (TimeDistributed)
mrcnn_mask_conv4       (TimeDistributed)
mrcnn_mask_bn4         (TimeDistributed)
mrcnn_bbox_fc          (TimeDistributed)
mrcnn_mask_deconv      (TimeDistributed)
mrcnn_class_logits     (TimeDistributed)
mrcnn_mask             (TimeDistributed)
WARNING:tensorflow:From /home/robot/.local/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
/home/robot/.local/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py:110: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
  "Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
/home/robot/.local/lib/python3.6/site-packages/keras/engine/training.py:2039: UserWarning: Using a generator with `use_multiprocessing=True` and multiple workers may duplicate your data. Please consider using the`keras.utils.Sequence class.
  UserWarning('Using a generator with `use_multiprocessing=True`'
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
ERROR:root:Error processing image {'id': 466047, 'source': 'coco', 'path': '/home/robot/cv_ws/Mask_RCNN/train2014/COCO_train2014_000000466047.jpg', 'width': 640, 'height': 479, 'annotations': [{'segmentation': [[189.87, 299.38, 190.95, 290.74, 187.72, 278.88, 186.64, 269.17, 185.56, 263.77, 181.24, 254.06, 178.01, 244.35, 174.77, 233.57, 173.69, 219.54, 172.61, 205.52, 170.45, 190.41, 169.38, 183.94, 168.3, 175.31, 166.14, 168.84, 163.98, 155.89, 163.98, 149.42, 163.98, 128.92, 162.9, 118.13, 166.14, 111.66, 174.77, 103.03, 185.56, 93.32, 189.87, 82.53, 197.43, 72.82, 201.74, 63.11, 208.21, 56.64, 212.53, 52.32, 219.0, 46.93, 223.32, 43.69, 225.48, 43.69, 234.11, 40.46, 247.05, 29.67, 257.84, 21.04, 270.79, 16.72, 276.18, 12.41, 283.73, 14.56, 290.2, 22.12, 291.28, 26.43, 294.52, 32.9, 294.52, 38.3, 290.2, 43.69, 290.2, 44.77, 289.13, 45.85, 285.89, 49.09, 280.5, 52.32, 269.71, 59.88, 255.68, 68.51, 245.97, 81.45, 237.34, 90.08, 227.63, 109.5, 220.08, 131.08, 212.53, 138.63, 207.14, 152.65, 202.82, 165.6, 203.9, 174.23, 206.06, 181.78, 210.37, 195.81, 214.69, 208.75, 220.08, 224.94, 226.55, 233.57, 228.71, 249.75, 230.87, 262.69, 235.18, 279.96, 235.18, 287.51, 235.18, 293.98, 228.71, 295.06, 219.0, 295.06, 209.29, 296.14, 199.58, 296.14]], 'area': 13677.093200000005, 'iscrowd': 0, 'image_id': 466047, 'bbox': [162.9, 12.41, 131.62, 286.97], 'category_id': 7, 'id': 248922}]}
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1772, in data_generator
    batch_images[b] = mold_image(image.astype(np.float32), config)
ValueError: could not broadcast input array from shape (479,640,3) into shape (640,427,3)
ERROR:root:Error processing image {'id': 51191, 'source': 'coco', 'path': '/home/robot/cv_ws/Mask_RCNN/val2014/COCO_val2014_000000051191.jpg', 'width': 628, 'height': 640, 'annotations': [{'segmentation': [[419.55, 333.63, 413.86, 332.68, 413.86, 324.14, 424.29, 324.14, 431.88, 324.14, 432.83, 315.6, 429.99, 308.96, 427.14, 305.17, 422.4, 299.47, 418.6, 295.68, 423.35, 295.68, 422.4, 282.39, 420.5, 282.39, 426.19, 272.9, 424.29, 261.52, 419.55, 264.36, 414.81, 264.36, 412.91, 264.36, 403.42, 271.01, 393.93, 273.85, 391.08, 267.21, 394.88, 258.67, 414.81, 239.69, 417.65, 234.95, 405.32, 232.1, 399.62, 231.15, 398.67, 220.72, 387.29, 214.08, 382.54, 209.33, 386.34, 199.84, 376.85, 190.35, 373.06, 180.87, 385.39, 171.38, 401.52, 187.51, 413.86, 192.25, 421.45, 182.76, 416.7, 177.07, 401.52, 159.99, 402.47, 148.6, 389.19, 132.47, 436.63, 160.94, 455.61, 137.22, 466.04, 129.63, 480.28, 147.65, 473.63, 194.15, 481.23, 192.25, 478.38, 219.77, 470.79, 227.36, 477.43, 235.9, 479.33, 245.39, 475.53, 254.88, 473.63, 259.62, 471.74, 264.36, 468.89, 272.9, 461.3, 277.65, 466.99, 283.34, 466.99, 284.29, 456.56, 309.91, 454.66, 315.6, 454.66, 315.6, 453.71, 324.14, 461.3, 326.04, 471.74, 326.99, 475.53, 331.73, 470.79, 339.32, 460.35, 339.32, 441.37, 340.27, 432.83, 338.38, 429.04, 339.32, 422.4, 333.63]], 'area': 12458.6412, 'iscrowd': 0, 'image_id': 51191, 'bbox': [373.06, 129.63, 108.17, 210.64], 'category_id': 64, 'id': 19349}, {'segmentation': [[414.31, 330.77, 414.96, 341.25, 368.9, 331.21, 370.65, 328.7, 394.55, 327.28, 414.41, 328.81]], 'area': 369.97035, 'iscrowd': 0, 'image_id': 51191, 'bbox': [368.9, 327.28, 46.06, 13.97], 'category_id': 81, 'id': 1133256}, {'segmentation': [[229.6, 296.21, 230.29, 299.31, 235.29, 301.38, 238.05, 306.9, 231.5, 321.39, 223.74, 322.08, 217.7, 320.87, 213.91, 313.8, 221.33, 310.35, 219.43, 308.97, 222.36, 305.35, 222.53, 305.35, 224.43, 300.87, 223.22, 296.56, 228.57, 294.49, 228.57, 294.49]], 'area': 373.2523, 'iscrowd': 0, 'image_id': 51191, 'bbox': [213.91, 294.49, 24.14, 27.59], 'category_id': 86, 'id': 1153540}, {'segmentation': [[414.27, 265.34, 422.4, 284.56, 422.4, 294.91, 424.62, 304.52, 429.8, 310.44, 429.06, 314.13, 422.4, 315.61, 409.83, 314.87, 406.14, 324.48, 416.49, 333.35, 420.92, 333.35, 421.66, 335.57, 438.67, 337.79, 448.28, 337.79, 467.5, 337.79, 471.94, 337.79, 463.07, 318.57, 456.41, 304.52, 463.8, 290.47, 466.02, 287.52, 463.8, 272.73, 469.72, 263.12, 457.15, 257.21, 434.97, 257.21, 420.92, 258.68, 412.05, 263.12]], 'area': 3608.41345, 'iscrowd': 0, 'image_id': 51191, 'bbox': [406.14, 257.21, 65.8, 80.58], 'category_id': 86, 'id': 1153922}]}
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1772, in data_generator
    batch_images[b] = mold_image(image.astype(np.float32), config)
ValueError: could not broadcast input array from shape (640,628,3) into shape (480,640,3)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
ERROR:root:Error processing image {'id': 520614, 'source': 'coco', 'path': '/home/robot/cv_ws/Mask_RCNN/train2014/COCO_train2014_000000520614.jpg', 'width': 640, 'height': 397, 'annotations': [{'segmentation': [[404.15, 365.26, 393.42, 147.98, 636.63, 129.2, 639.31, 349.16, 405.05, 367.05]], 'area': 52625.2731, 'iscrowd': 0, 'image_id': 520614, 'bbox': [393.42, 129.2, 245.89, 237.85], 'category_id': 73, 'id': 1101662}, {'segmentation': [[553.48, 133.23, 428.3, 140.38, 427.4, 134.12, 428.3, 126.97, 429.19, 123.39, 462.27, 110.87, 495.36, 93.89, 518.6, 83.16, 525.76, 79.58, 532.02, 78.68, 538.27, 96.57, 541.85, 109.09, 547.22, 124.29, 547.22, 125.18, 555.26, 129.65, 552.58, 133.23], [269.14, 391.64, 277.18, 374.65, 282.55, 358.55, 287.02, 342.46, 310.27, 314.74, 332.62, 303.11, 359.45, 276.29, 377.33, 266.45, 389.85, 264.67, 398.79, 261.98, 407.73, 390.74, 270.03, 391.64], [409.52, 390.74, 430.08, 373.75, 447.07, 363.92, 473.0, 363.92, 503.4, 369.28, 522.18, 378.22, 535.59, 387.16, 412.2, 392.53], [580.3, 391.64, 604.44, 373.75, 622.32, 364.81, 640.0, 359.45, 640.0, 390.74, 583.88, 391.64]], 'area': 19528.791149999997, 'iscrowd': 0, 'image_id': 520614, 'bbox': [269.14, 78.68, 370.86, 313.85], 'category_id': 1, 'id': 1720081}]}
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1772, in data_generator
    batch_images[b] = mold_image(image.astype(np.float32), config)
ValueError: could not broadcast input array from shape (397,640,3) into shape (640,427,3)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
/home/robot/.local/lib/python3.6/site-packages/skimage/transform/_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning.
  order = _validate_interpolation_order(image.dtype, order)
ERROR:root:Error processing image {'id': 159038, 'source': 'coco', 'path': '/home/robot/cv_ws/Mask_RCNN/train2014/COCO_train2014_000000159038.jpg', 'width': 500, 'height': 375, 'annotations': [{'segmentation': [[283.99, 29.71, 283.99, 40.66, 280.62, 54.14, 280.62, 73.53, 280.62, 86.17, 302.53, 86.17, 295.79, 49.09, 291.57, 44.03, 290.73, 29.71]], 'area': 844.7210999999996, 'iscrowd': 0, 'image_id': 159038, 'bbox': [280.62, 29.71, 21.91, 56.46], 'category_id': 44, 'id': 372097}, {'segmentation': [[330.6, 61.93, 332.15, 47.34, 336.81, 44.85, 338.37, 38.02, 343.65, 37.71, 343.34, 42.99, 350.17, 50.44, 349.24, 64.73, 340.54, 65.97, 331.22, 63.8]], 'area': 395.1958499999999, 'iscrowd': 0, 'image_id': 159038, 'bbox': [330.6, 37.71, 19.57, 28.26], 'category_id': 44, 'id': 372126}, {'segmentation': [[338.2, 69.24, 341.18, 87.11, 319.14, 88.3, 318.24, 71.32, 338.2, 71.03], [317.65, 51.37, 320.63, 67.75, 337.6, 65.37, 332.84, 53.45, 318.54, 51.96], [317.05, 48.69, 315.86, 31.41, 324.8, 31.11, 326.58, 40.64, 331.35, 52.26, 317.95, 50.18]], 'area': 789.40035, 'iscrowd': 0, 'image_id': 159038, 'bbox': [315.86, 31.11, 25.32, 57.19], 'category_id': 44, 'id': 1485010}, {'segmentation': [[114.02, 281.67, 229.73, 263.94, 265.2, 274.92, 342.91, 363.6, 349.66, 366.98, 124.16, 368.67, 108.11, 272.38]], 'area': 18053.395250000005, 'iscrowd': 0, 'image_id': 159038, 'bbox': [108.11, 263.94, 241.55, 104.73], 'category_id': 51, 'id': 1535220}, {'segmentation': [[430.38, 83.66, 431.35, 12.74, 500.0, 9.83, 500.0, 78.81, 500.0, 85.61]], 'area': 5070.819449999999, 'iscrowd': 0, 'image_id': 159038, 'bbox': [430.38, 9.83, 69.62, 75.78], 'category_id': 82, 'id': 2196413}, {'segmentation': [[14.81, 265.74, 89.81, 261.11, 101.85, 275.93, 116.67, 334.26, 123.15, 369.44, 0.0, 369.44, 0.0, 247.22, 3.7, 245.37, 15.74, 252.78]], 'area': 12036.141599999999, 'iscrowd': 0, 'image_id': 159038, 'bbox': [0.0, 245.37, 123.15, 124.07], 'category_id': 51, 'id': 2217386}]}
Shakesbeer333 commented 3 years ago

@MartinJensen37 as can be seen in the printed configs, you still train on 81 classes. You only need to change the NUM_CLASSES (in a class that inherits from ´config´) to 3+1 (background). Don't change anything else

MartinJensen37 commented 3 years ago

@MartinJensen37 as can be seen in the printed configs, you still train on 81 classes. You only need to change the NUM_CLASSES (in a class that inherits from ´config´) to 3+1 (background). Don't change anything else

@Shakesbeer333 I changed the number of classes in the config file, it now shows 3 classes instead but it still gives the exact same error message as before "could not broadcast shape xx into shape xx"

Shakesbeer333 commented 3 years ago

@MartinJensen37 also make sure that you annotation file does not contain background as an category as it is added separately in Mask RCNN. So you annotation file starts with category id=1.