"JPEG driver doesn't support 8 bands. Must be 1 (grey), 3 (RGB) or 4 bands."
An error has occurred while executing Python code:
RuntimeError: JPEG driver doesn't support 8 bands. Must be 1 (grey), 3 (RGB) or 4 bands.
Traceback (most recent call last):
File "/home/realtech/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deep-learning-datasets-maker/split_rs_data.py", line 324, in run
splitting(
File "/home/realtech/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deep-learning-datasets-maker/utils/splitting.py", line 51, in splitting
gdal.Translate(osp.join(cdpath, \
File "/usr/lib/python3/dist-packages/osgeo/gdal.py", line 393, in Translate
return TranslateInternal(destName, srcDS, opts, callback, callback_data)
File "/usr/lib/python3/dist-packages/osgeo/gdal.py", line 3037, in TranslateInternal
return _gdal.TranslateInternal(*args)
RuntimeError: JPEG driver doesn't support 8 bands. Must be 1 (grey), 3 (RGB) or 4 bands.
Python version: 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0]
QGIS version: 3.26.3-Buenos Aires Buenos Aires, 65e4edfdad
Python Path:
/usr/share/qgis/python
/home/realtech/.local/share/QGIS/QGIS3/profiles/default/python
/home/realtech/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/home/realtech/.local/lib/python3.8/site-packages
/usr/local/lib/python3.8/dist-packages
/usr/lib/python3/dist-packages
/home/realtech/.local/share/QGIS/QGIS3/profiles/default/python
专业对口,你是想让插件能接收8波段的遥感影像是吧,这样只能改插件源码了;
我看了一下github项目,一个用于制作深度学习数据集的插件,这样的数据集对应着一个地物分类的神经网络模型,如果你的输入是8波段,对应的你要将遥感深度学习模型的输入也改为8波段;如果你的能力足够你可以尝试改插件的源码并自己设计或用别人已有的深度学习模型;
如果能力不够,就只能从遥感影像中选择信息最丰富合适的波段构成4个波段输入,其他的只能舍弃掉
提供参考实例:链接:https://blog.csdn.net/TJLCY/article/details/123680217
您遇到的错误是由于 JPEG 图像格式的限制。 JPEG 格式仅支持 1、3 或 4 个波段,但您的输入数据有 8 个波段。 这意味着您不能使用 JPEG 格式来保存插件处理的数据。
您可以尝试多种解决方案来克服此限制:
将数据转换为支持 8 个或更多波段的不同图像格式,例如 TIFF 或 HDF5。
以支持多波段的格式(例如 TIFF 或 HDF5)将每个波段另存为单独的图像文件。 然后插件可以分别处理每个波段。
修改插件中的代码以处理 4 个以上的波段。 您可以通过更改导致错误的“splitting.py”中的函数来执行此操作。
或者,您可以考虑使用可以处理高分辨率、多波段遥感数据的不同插件或工具。
QGIS参考专栏:《QGIS入门实战精品教程(配套案例数据)》
数据源出现什么问题了