mask-rcnn在训练过程中,突然中断报错,提示:boolean index did not match indexed array along dimension 0;dimension is..

一、环境:

win10 + gpu 3090 + maskrcnn + tensorflow2.6.0;

二、报错信息如下:

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

image_id 549
image_id 85
 8/20 [===========>..................] - ETA: 13:30 - batch: 3.5000 - size: 30.0000 - loss: 40.9189 - rpn_class_loss: 16.8697 - rpn_bbox_loss: 15.0835 - mrcnn_class_loss: 3.8857 - mrcnn_bbox_loss: 4.4410 - mrcnn_mask_loss: 0.6390image_id 1020
image_id 1602
image_id 523
image_id 490
image_id 2239
image_id 474
image_id 592
image_id 2203
Traceback (most recent call last):
  File "D:/python-workspace/Mask_RCNN-master2/train.py", line 425, in 
    layers='heads')
  File "D:\python-workspace\Mask_RCNN-master2\mrcnn\model.py", line 2367, in train
    use_multiprocessing=workers > 1,
  File "D:\Anaconda3\envs\py36_maskrcnn_env_bak\lib\site-packages\keras\engine\training_v1.py", line 796, in fit
    use_multiprocessing=use_multiprocessing)
  File "D:\Anaconda3\envs\py36_maskrcnn_env_bak\lib\site-packages\keras\engine\training_generator_v1.py", line 586, in fit
    steps_name='steps_per_epoch')
  File "D:\Anaconda3\envs\py36_maskrcnn_env_bak\lib\site-packages\keras\engine\training_generator_v1.py", line 212, in model_iteration
    batch_data = _get_next_batch(generator)
  File "D:\Anaconda3\envs\py36_maskrcnn_env_bak\lib\site-packages\keras\engine\training_generator_v1.py", line 346, in _get_next_batch
    generator_output = next(generator)
  File "D:\Anaconda3\envs\py36_maskrcnn_env_bak\lib\site-packages\keras\utils\data_utils.py", line 497, in iter_sequence_infinite
    for item in seq:
  File "D:\Anaconda3\envs\py36_maskrcnn_env_bak\lib\site-packages\keras\utils\data_utils.py", line 483, in __iter__
    for item in (self[i] for i in range(len(self))):
  File "D:\Anaconda3\envs\py36_maskrcnn_env_bak\lib\site-packages\keras\utils\data_utils.py", line 483, in 
    for item in (self[i] for i in range(len(self))):
  File "D:\python-workspace\Mask_RCNN-master2\mrcnn\model.py", line 1720, in __getitem__
    augmentation=self.augmentation)
  File "D:\python-workspace\Mask_RCNN-master2\mrcnn\model.py", line 1279, in load_image_gt
    class_ids = class_ids[_idx]
IndexError: boolean index did not match indexed array along dimension 0; dimension is 1 but corresponding boolean dimension is 2

Process finished with exit code 1

mask-rcnn在训练过程中,突然中断报错,提示:boolean index did not match indexed array along dimension 0;dimension is.._第1张图片

三、解决方法:

 1、首先排除train.py文件的NUM_CLASSES、NUM_CLASSES、self.add_class()、labels[i].find();

2、config.py文件的NAME、NUM_CLASSES。

经排查,上面都没有问题,因为之前程序运行是正常的,训练也是正常的,只是由于改变了样本集和分类,所以问题应该是图片打标注的时候,引入了未定义的分类名称,需要逐个图片检查标注的label,果然存在异常分类。

mask-rcnn在训练过程中,突然中断报错,提示:boolean index did not match indexed array along dimension 0;dimension is.._第2张图片

mask-rcnn在训练过程中,突然中断报错,提示:boolean index did not match indexed array along dimension 0;dimension is.._第3张图片

mask-rcnn在训练过程中,突然中断报错,提示:boolean index did not match indexed array along dimension 0;dimension is.._第4张图片

mask-rcnn在训练过程中,突然中断报错,提示:boolean index did not match indexed array along dimension 0;dimension is.._第5张图片

 

 

mask-rcnn在训练过程中,突然中断报错,提示:boolean index did not match indexed array along dimension 0;dimension is.._第6张图片

 

 对应的json文件也是错的,需要修改标注和重新生成过程文件。

mask-rcnn在训练过程中,突然中断报错,提示:boolean index did not match indexed array along dimension 0;dimension is.._第7张图片mask-rcnn在训练过程中,突然中断报错,提示:boolean index did not match indexed array along dimension 0;dimension is.._第8张图片

目标检测,打标注一定要细心、细心、再细心。

你可能感兴趣的:(mask_rcnn,目标检测,python,目标检测,人工智能)