【发布时间】:2020-01-14 00:36:10
【问题描述】:
我正在做一个项目,我需要针对 SpaceNet 数据集训练 Mask RCNN。
所以,当我尝试训练我的模型时,会出现很多警告和错误。
错误信息是:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-11-a73fb1f7a961> in <module>
8 learning_rate=config.LEARNING_RATE,
9 epochs=10,
---> 10 layers='heads')
11
12 # Training - Stage 2
~\Desktop\SpaceNet_MaskRCNN\mrcnn\model.py in train(self, train_dataset, val_dataset, learning_rate, epochs, layers, augmentation, custom_callbacks, no_augmentation_sources)
2372 max_queue_size=100,
2373 workers=workers,
-> 2374 use_multiprocessing=True,
2375 )
2376 self.epoch = max(self.epoch, epochs)
~\Anaconda3\envs\MaskRCNN\lib\site-packages\keras\legacy\interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your `' + object_name + '` call to the ' +
90 'Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper
~\Anaconda3\envs\MaskRCNN\lib\site-packages\keras\engine\training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, validation_freq, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
1656 use_multiprocessing=use_multiprocessing,
1657 shuffle=shuffle,
-> 1658 initial_epoch=initial_epoch)
1659
1660 @interfaces.legacy_generator_methods_support
~\Anaconda3\envs\MaskRCNN\lib\site-packages\keras\engine\training_generator.py in fit_generator(model, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, validation_freq, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
179 batch_index = 0
180 while steps_done < steps_per_epoch:
--> 181 generator_output = next(output_generator)
182
183 if not hasattr(generator_output, '__len__'):
~\Desktop\SpaceNet_MaskRCNN\mrcnn\model.py in data_generator(dataset, config, shuffle, augment, augmentation, random_rois, batch_size, detection_targets, no_augmentation_sources)
1707 load_image_gt(dataset, config, image_id, augment=augment,
1708 augmentation=augmentation,
-> 1709 use_mini_mask=config.USE_MINI_MASK)
1710
1711 # Skip images that have no instances. This can happen in cases
~\Desktop\SpaceNet_MaskRCNN\mrcnn\model.py in load_image_gt(dataset, config, image_id, augment, augmentation, use_mini_mask)
1263 _idx = np.sum(mask, axis=(0, 1)) > 0
1264 mask = mask[:, :, _idx]
-> 1265 class_ids = class_ids[_idx]
1266 # Bounding boxes. Note that some boxes might be all zeros
1267 # if the corresponding mask got cropped out.
IndexError: boolean index did not match indexed array along dimension 0; dimension is 1 but corresponding boolean dimension is 650
警告是:
ERROR:root:Error processing image {'id': 219, 'source': 'yapi', 'path': None, 'width': 650, 'height': 650} 回溯(最近一次通话最后): 文件“C:\Users\MUSTAFAAKTAS\Desktop\SpaceNet_MaskRCNN\mrcnn\model.py”,第 1710 行,在 data_generator use_mini_mask=config.USE_MINI_MASK) 文件“C:\Users\MUSTAFAAKTAS\Desktop\SpaceNet_MaskRCNN\mrcnn\model.py”,第 1266 行,在 load_image_gt class_ids = class_ids[_idx] IndexError:布尔索引与维度 0 上的索引数组不匹配;维度为 1 但对应的布尔维度为 650
--
ERROR:root:Error processing image {'id': 448, 'source': 'yapi', 'path': None, 'width': 650, 'height': 650} 回溯(最近一次通话最后): 文件“C:\Users\MUSTAFAAKTAS\Desktop\SpaceNet_MaskRCNN\mrcnn\model.py”,第 1710 行,在 data_generator use_mini_mask=config.USE_MINI_MASK) 文件“C:\Users\MUSTAFAAKTAS\Desktop\SpaceNet_MaskRCNN\mrcnn\model.py”,第 1266 行,在 load_image_gt class_ids = class_ids[_idx] IndexError:布尔索引与维度 0 上的索引数组不匹配;维度为 1 但对应的布尔维度为 650
--
还有针对 image_id 的警告:219-348-444-448-3986-3023
【问题讨论】:
标签: python-3.x tensorflow keras deep-learning boolean