Mask-rcnn:IndexError:布尔索引与维度0上的索引数组不匹配;维为0,但对应的布尔维为1

时间:2019-05-20 14:54:42

标签: python tensorflow keras pytorch

当我在自己的自定义数据集中执行Mask-rcnn train.py时。终端显示:

1)

IndexError: boolean index did not match indexed array along dimension 0; dimension is 0 but corresponding boolean dimension is 1.  

2)

 ERROR:root:Error processing image {'id': 24, 'source': 'shapes', 'path': 'train_data/pic/104-07.bmp'.
  1. 我在自己的数据集中训练了Mask-rcnn进行了1次分类。
  2. train.py通过了以下阶段:1)加载mask_rcnn_coco.h5,2)加载数据集(包括蒙版,原始图像)。
  3. 当train.py加载json和yaml文件时,就会发生错误。
2019-05-20 22:01:58.365967: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

Starting at epoch 0. LR=0.001

Checkpoint Path: /Users/myname/PycharmProjects/2.2-Train-iris/tongue-master/logs/shapes20190520T2202/mask_rcnn_shapes_{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)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py:100: 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. "
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/engine/training.py:1987: 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`'
Epoch 1/10
image_id 35
image_id 102
image_id 96
image_id 88
image_id 47
image_id 93
image_id 41
image_id 109
image_id 92
image_id 107
image_id 70
image_id 82
ERROR:root:Error processing image {'id': 35, 'source': 'shapes', 'path': 'train_data/pic/104-04.bmp', 'width': 320, 'height': 240, 'mask_path': 'train_data/cv2_mask/104-04.png', 'yaml_path': 'train_data/labelme_json/104-04_json/info.yaml'}
Traceback (most recent call last):
  File "/Users/simingzheng/PycharmProjects/2.2-Train-iris/tongue-master/model.py", line 1709, in data_generator
    use_mini_mask=config.USE_MINI_MASK)
  File "/Users/simingzheng/PycharmProjects/2.2-Train-iris/tongue-master/model.py", line 1265, in load_image_gt
    class_ids = class_ids[_idx]
IndexError: boolean index did not match indexed array along dimension 0; dimension is 0 but corresponding boolean dimension is 1
ERROR:root:Error processing image {'id': 88, 'source': 'shapes', 'path': 'train_data/pic/070-07.bmp', 'width': 320, 'height': 240, 'mask_path': 

StopIteration

0 个答案:

没有答案