首页 / 浏览问题 / 桌面GIS / 问题详情
对象提取模型训练总是报错
28EXP 2024年07月04日
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\SuperMap\SuperMap iDesktopX 11i\resources\python-helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\SuperMap\SuperMap iDesktopX 11i\resources\python-helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:\Users\admin\AppData\Local\Temp\model_train_81.py", line 11, in <module>
    ImageryTrainer(train_data_path=r"E:\yaogantest\self-running-training\PHO\training_data_2banxing",config=r"C:\SuperMap\SuperMap iDesktopX 11i\resources_ml\trainer_config\object_extraction\object_ext_mmdet_mask_rcnn.sdt",epoch=int(15),batch_size=int(1),lr=1.0E-4,output_model_path=r"E:\yaogantest\self-running-training\PHO",output_model_name=r"saved_model_2banxing",backbone_name=r"r-50",backbone_weight_path=r"C:\SuperMap\SuperMap iDesktopX 11i\resources_ml\backbone\resnet50-19c8e357.pth",log_path=r"E:\yaogantest\self-running-training\log file\0704pho_banxing",reload_model=False,pretrained_model_path=r"E:\yaogantest\self-running-training\PHO\saved_model_liangshanyanyuan\saved_model_liangshanyanyuan.sdm",gpus=[0]).object_extract_train()
  File "I:\teamctiy\BuildAgent\work\test_111x/iobjectspy/ml\vision\_trainer.py", line 139, in object_extract_train
  File "I:\teamctiy\BuildAgent\work\test_111x/iobjectspy/ml\vision\_trainer_collector\object_extraction_train.py", line 32, in train
  File "I:\teamctiy\BuildAgent\work\test_111x/iobjectspy/ml\vision\_trainer_collector\object_extraction_train.py", line 45, in mmdet_pytorch
  File "I:\teamctiy\BuildAgent\work\test_111x/iobjectspy/ml\vision\_models\base_framework\_mmdet\common_train_mmdet.py", line 538, in train
  File "I:\teamctiy\BuildAgent\work\test_111x/iobjectspy/ml\vision\_models\base_framework\_mmdet\common_train_mmdet.py", line 498, in main_train
  File "E:\yaogan\environment\conda\lib\site-packages\mmengine\runner\runner.py", line 1701, in train
    self._train_loop = self.build_train_loop(
  File "E:\yaogan\environment\conda\lib\site-packages\mmengine\runner\runner.py", line 1493, in build_train_loop
    loop = LOOPS.build(
  File "E:\yaogan\environment\conda\lib\site-packages\mmengine\registry\registry.py", line 570, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "E:\yaogan\environment\conda\lib\site-packages\mmengine\registry\build_functions.py", line 144, in build_from_cfg
    raise type(e)(
IndexError: class `EpochBasedTrainLoop` in mmengine/runner/loops.py: class `SMVOCMaskDataset` in iobjectspy/ml/vision/_models/base_framework/_mmdet/data/voc_mask.py: tuple index out of range

上图为对象提取模型训练训练成功的结果

以上图片为训练数据生成的结果文件

问题:对象提取模型训练成功过一次 第二次加入预训练模型报出以上错误

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\SuperMap\SuperMap iDesktopX 11i\resources\python-helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\SuperMap\SuperMap iDesktopX 11i\resources\python-helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:\Users\admin\AppData\Local\Temp\model_train_80.py", line 11, in <module>
    ImageryTrainer(train_data_path=r"E:\yaogantest\self-running-training\PHO\training_data_2banxing",config=r"C:\SuperMap\SuperMap iDesktopX 11i\resources_ml\trainer_config\object_extraction\object_ext_mmdet_mask_rcnn.sdt",epoch=int(15),batch_size=int(1),lr=1.0E-4,output_model_path=r"E:\yaogantest\self-running-training\PHO",output_model_name=r"saved_model_2banxing",backbone_name=r"r-50",backbone_weight_path=r"C:\SuperMap\SuperMap iDesktopX 11i\resources_ml\backbone\resnet50-19c8e357.pth",log_path=r"E:\yaogantest\self-running-training\log file\0704_pho_banxing",reload_model=False,pretrained_model_path=None,gpus=[0]).object_extract_train()
  File "I:\teamctiy\BuildAgent\work\test_111x/iobjectspy/ml\vision\_trainer.py", line 139, in object_extract_train
  File "I:\teamctiy\BuildAgent\work\test_111x/iobjectspy/ml\vision\_trainer_collector\object_extraction_train.py", line 32, in train
  File "I:\teamctiy\BuildAgent\work\test_111x/iobjectspy/ml\vision\_trainer_collector\object_extraction_train.py", line 45, in mmdet_pytorch
  File "I:\teamctiy\BuildAgent\work\test_111x/iobjectspy/ml\vision\_models\base_framework\_mmdet\common_train_mmdet.py", line 538, in train
  File "I:\teamctiy\BuildAgent\work\test_111x/iobjectspy/ml\vision\_models\base_framework\_mmdet\common_train_mmdet.py", line 498, in main_train
  File "E:\yaogan\environment\conda\lib\site-packages\mmengine\runner\runner.py", line 1701, in train
    self._train_loop = self.build_train_loop(
  File "E:\yaogan\environment\conda\lib\site-packages\mmengine\runner\runner.py", line 1493, in build_train_loop
    loop = LOOPS.build(
  File "E:\yaogan\environment\conda\lib\site-packages\mmengine\registry\registry.py", line 570, in build
    return self.build_func(cfg, *args, **kwargs, registry=self)
  File "E:\yaogan\environment\conda\lib\site-packages\mmengine\registry\build_functions.py", line 144, in build_from_cfg
    raise type(e)(
IndexError: class `EpochBasedTrainLoop` in mmengine/runner/loops.py: class `SMVOCMaskDataset` in iobjectspy/ml/vision/_models/base_framework/_mmdet/data/voc_mask.py: tuple index out of range

以上为对象提取模型训练不加入预训练模型的报错代码

以上为模型训练工具及参数截图

1个回答

您好,您那边使用的iDesktopX版本和conda版本是否一致呢?还有就是将类别字段和字段值尽量都使用英文来训练。
9,197EXP 2024年07月04日
您好 感谢回复 我这边用二元分类和目标检测都是没有问题的 只有对象提取时报错 这个和conda版本有关系吗
...