首页 / 浏览问题 / 桌面GIS / 问题详情
进行机器学习的模型训练时报错,无法进行
1EXP 2022年03月18日
D:\supermap\ai\superX\bin_python\iobjectspy\iobjectspy-py366_64\iobjectspy\ml\vision\_models\semantic_seg\_seg_models\encs\cls_models\cls_models\utils.py:86: UserWarning: The pre-training model not exist. Please check the pre-training model
Traceback (most recent call last):
  File "<input>", line 10, in <module>
  File "D:\BuildAgent\work\test/iobjectspy/ml\vision\_trainer.py", line 85, in binary_classify_train
  File "D:\BuildAgent\work\test/iobjectspy/ml\vision\_trainer_collector\binary_classification_train.py", line 31, in train
  File "D:\BuildAgent\work\test/iobjectspy/ml\vision\_trainer_collector\binary_classification_train.py", line 38, in unet_keras
  File "D:\BuildAgent\work\test/iobjectspy/ml\vision\_models\semantic_seg\unet.py", line 933, in train
  File "D:\BuildAgent\work\test/iobjectspy/ml\vision\_models\semantic_seg\unet.py", line 1013, in _get_data_from_csv
  File "D:\BuildAgent\work\test/iobjectspy/ml\toolkit\_toolkit.py", line 367, in get_image_from_csv
  File "D:\BuildAgent\work\test/iobjectspy/ml\toolkit\_toolkit.py", line 328, in read_xy
  File "D:\supermap\ai\superX\supermap-iobjectspy-env-gpu-10.1.0-20200928-win64\conda\lib\site-packages\albumentations\core\composition.py", line 176, in __call__
    data = t(force_apply=force_apply, **data)
  File "D:\supermap\ai\superX\supermap-iobjectspy-env-gpu-10.1.0-20200928-win64\conda\lib\site-packages\albumentations\core\transforms_interface.py", line 87, in __call__
    return self.apply_with_params(params, **kwargs)
  File "D:\supermap\ai\superX\supermap-iobjectspy-env-gpu-10.1.0-20200928-win64\conda\lib\site-packages\albumentations\core\transforms_interface.py", line 100, in apply_with_params
    res[key] = target_function(arg, **dict(params, **target_dependencies))
  File "D:\supermap\ai\superX\supermap-iobjectspy-env-gpu-10.1.0-20200928-win64\conda\lib\site-packages\albumentations\augmentations\transforms.py", line 1622, in apply
    return F.image_compression(image, quality, image_type)
  File "D:\supermap\ai\superX\supermap-iobjectspy-env-gpu-10.1.0-20200928-win64\conda\lib\site-packages\albumentations\augmentations\functional.py", line 55, in wrapped_function
    result = result.reshape(shape)
ValueError: cannot reshape array of size 3145728 into shape (1024,1024,4)

1个回答

您好,您那边模型训练是做的什么算子呢?在训练数据的时候设置的图片大小是多少,根据这个报错判断是第一步训练数据时设置的图片大小太小导致的,建议将图片大小设置小一点
9,197EXP 2022年03月21日
python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)] 
Backend TkAgg is interactive backend. Turning interactive mode on.
Using TensorFlow backend.
[iObjectsPy]: Connection gateway-service successful, Python callback port bind 55613

2022-03-21 16:15:11.546213: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2022-03-21 16:15:11.553129: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library nvcuda.dll
2022-03-21 16:15:12.660826: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: 
name: NVIDIA GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.62
pciBusID: 0000:01:00.0
2022-03-21 16:15:12.660962: I tensorflow/stream_executor/platform/default/dlopen_checker_stub.cc:25] GPU libraries are statically linked, skip dlopen check.
2022-03-21 16:15:12.661095: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
2022-03-21 16:15:35.090475: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2022-03-21 16:15:35.090567: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0 
2022-03-21 16:15:35.090618: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N 
2022-03-21 16:15:35.134321: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3000 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
D:\supermap\ai\superX\bin_python\iobjectspy\iobjectspy-py366_64\iobjectspy\ml\vision\_models\semantic_seg\_seg_models\encs\cls_models\cls_models\utils.py:86: UserWarning: The pre-training model not exist. Please check the pre-training model
Traceback (most recent call last):
  File "<input>", line 10, in <module>
  File "D:\BuildAgent\work\test/iobjectspy/ml\vision\_trainer.py", line 85, in binary_classify_train
  File "D:\BuildAgent\work\test/iobjectspy/ml\vision\_trainer_collector\binary_classification_train.py", line 31, in train
  File "D:\BuildAgent\work\test/iobjectspy/ml\vision\_trainer_collector\binary_classification_train.py", line 38, in unet_keras
  File "D:\BuildAgent\work\test/iobjectspy/ml\vision\_models\semantic_seg\unet.py", line 933, in train
  File "D:\BuildAgent\work\test/iobjectspy/ml\vision\_models\semantic_seg\unet.py", line 1013, in _get_data_from_csv
  File "D:\BuildAgent\work\test/iobjectspy/ml\toolkit\_toolkit.py", line 367, in get_image_from_csv
  File "D:\BuildAgent\work\test/iobjectspy/ml\toolkit\_toolkit.py", line 328, in read_xy
  File "D:\supermap\ai\superX\supermap-iobjectspy-env-gpu-10.1.2-20210326-win64\conda\lib\site-packages\albumentations\core\composition.py", line 176, in __call__
    data = t(force_apply=force_apply, **data)
  File "D:\supermap\ai\superX\supermap-iobjectspy-env-gpu-10.1.2-20210326-win64\conda\lib\site-packages\albumentations\core\transforms_interface.py", line 87, in __call__
    return self.apply_with_params(params, **kwargs)
  File "D:\supermap\ai\superX\supermap-iobjectspy-env-gpu-10.1.2-20210326-win64\conda\lib\site-packages\albumentations\core\transforms_interface.py", line 100, in apply_with_params
    res[key] = target_function(arg, **dict(params, **target_dependencies))
  File "D:\supermap\ai\superX\supermap-iobjectspy-env-gpu-10.1.2-20210326-win64\conda\lib\site-packages\albumentations\augmentations\transforms.py", line 1622, in apply
    return F.image_compression(image, quality, image_type)
  File "D:\supermap\ai\superX\supermap-iobjectspy-env-gpu-10.1.2-20210326-win64\conda\lib\site-packages\albumentations\augmentations\functional.py", line 55, in wrapped_function
    result = result.reshape(shape)
ValueError: cannot reshape array of size 307200 into shape (320,320,4)

您好,感谢答复,我是用来做二元分类的。训练数据的图片大小我试过640*640和720*720以及提问的1024*1024,报错都是ValueError: cannot reshape array of size xxxxx into shape (xxx,xxx,4)

您那边看下你的影像数据是几波段的呢,在影像数据集右键属性,弹出框查看影像看下波段数。目前只支持三波段影像进行机器学习相关操作
非常感谢您的答复,的确是影像数据的问题,我的影像数据是四波段的,无法处理,提取三波段数据进行机器学习后没有出现上述错误了,模型训练能够正常进行。
...