最佳魂环配置:torch==2.1.0
torchvision==0.16.0
torchdata==0.7.0
一.平台网址
EarthNets平台网站 用于RS(遥感)数据集下载,提供近400个可下载数据集。用于深度学习。但不推荐其在githhub上(仅支持24种数据集)下载安装使用,推荐在网站上进行搜索下载自己所需数据集。
EarthNets平台:https://earthnets.github.io/
Datasets4EO数据集github:https://github.com/EarthNets/Dataset4EO
RSI-Classification任务:https://github.com/EarthNets/RSI-Classification
RSI-Detection任务:https://github.com/EarthNets/RSI-Detection
RSI-Segmentation任务:https://github.com/EarthNets/RSI-Segmentation
二.现提供2种安装方案:
1.仅安装Datasets4EO:[该方法未经笔者验证,只要不出现版本问题,应该可以正常使用]
(1) sh install_requirements.sh (install_requirements.sh中包含以下6个pip安装)
pip uninstall torch torchvision torchdata
pip install --pre torch torchvision torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cu113
pip install mmcv-full==1.6.0
pip install prettytable
pip install pycocotools
pip install wandb
(2)git clone https://github.com/EarthNets/Dataset4EO.git
(3)python -m pip install -e .
2.安装数据集+分类任务:[该方法经过笔者验证,友情提示:需占内存10G+]
(1)conda create -n open-mmlab python=3.8 pytorch=1.10 cudatoolkit=11.3 torchvision -c pytorch -y
(2)conda activate open-mmlab
(3)pip3 install openmim
(4)mim install mmcv-full
(5)git clone https://github.com/EarthNets/RSI-Classification.git
(6)cd RSI-Classification
(7)pip3 install -e .
(8)pip install prettytable
(9)pip install pycocotools
(10)pip install wandb
(11)git clone https://github.com/EarthNets/Dataset4EO.git
(12)cd Dataset4EO
(13)pip3 install -e .
(1)-(7)安装分类任务
(8)-(13)安装数据集
后期运行时候,缺少torchdata:
pip install --pre torchdata --extra-index-url https://download.pytorch.org/whl/nightly/cpu
后由于,torchvision存在找不到function情况,只能使用低版本(1.13及以下)。导致torchvision,torch,torchdata三方冲突,经不断测试,最终找到稳定版本如下:
最佳魂环配置:torch==2.1.0
torchvision==0.16.0
torchdata==0.7.0
其后可能还缺 h5py seaborn模块,直接安装即可:
pip install h5py
pip install seaborn
参考文章:
1.报错:ModuleNotFoundError: No module named ‘torchvision.transforms.functional_tensor‘ 解决办法 [注:该文章报错与不报错写反了,从讨论区可知]
2.ModuleNotFoundError: No module named ‘torch.utils._import_utils‘ 报错解决
3.安装与torch版本对应的torchdata
4.PyTorch中torch、torchvision、torchaudio、torchtext版本对应关系
安装过程:
笔者第一次下载时候,执行完方案二的(7)之后,
又执行方案一的 pip install mmcv-full==1.6.0
,安装失败,显示找不到setup.py。多次安装均失败,遂执行pip uninstall mmcv-full
去卸载之前安装的高版本mmcv-full==1.7.5(possible)。接着后续无论是安装默认版本(高版本)还是指定版本的mmcv-full
都失败。只能卸载conda这个环境重新安装。
另发现,卸载这个环境之后,内存并没有恢复到原来那么多,因为之前下载的安装包都保留了,下次安装同样的版本,不会再重新下载相同的安装包。
另附几张3方(torch,torchvision,torchdata)卡bug截图:
3方卡bug原因:
torchvision高版本(1.13及以上修改了函数名),导致找不到原来函数名,所以只能用低版本。而最低的torchdata都是0.3.0 需要torch是1.11.0,而torch1.11.0 对应最低的torchvision0.12.3,所以就出现了三方冲突的局面。
所以需要在torchvison的高版本中找到没有修改函数名的。即最后找到以上版本。
运行时候找不到函数名的报错如下:
import torchvision.transforms.functional_tensor as F_t
ModuleNotFoundError: No module named ‘torchvision.transforms.functional_tensor’
参考文章:
1.报错:ModuleNotFoundError: No module named ‘torchvision.transforms.functional_tensor‘ 解决办法 [注:该文章报错与不报错写反了,从讨论区可知]
若采用torchdata0.8.0, 而不是torchdata0.7.0 报错如下:主要是 No module named 'torch.utils._import_utils'
G:\2E\anaconda\envs\open-mmlab\python.exe C:\Users\Dell\Desktop\PY!\Dataset4EO\test.py
Traceback (most recent call last):
File "C:\Users\Dell\Desktop\PY!\Dataset4EO\test.py", line 1, in <module>
from Dataset4EO.datasets import list_datasets, load, landslide4sense
File "c:\users\dell\dataset4eo\Dataset4EO\__init__.py", line 1, in <module>
from . import datasets
File "c:\users\dell\dataset4eo\Dataset4EO\datasets\__init__.py", line 9, in <module>
from . import utils
File "c:\users\dell\dataset4eo\Dataset4EO\datasets\utils\__init__.py", line 1, in <module>
from . import _internal # usort: skip
File "c:\users\dell\dataset4eo\Dataset4EO\datasets\utils\_internal.py", line 24, in <module>
from torchdata.datapipes.iter import IoPathFileLister, IoPathFileOpener, IterDataPipe, ShardingFilter, Shuffler
File "G:\2E\anaconda\envs\open-mmlab\lib\site-packages\torchdata\datapipes\__init__.py", line 11, in <module>
from . import iter, map, utils
File "G:\2E\anaconda\envs\open-mmlab\lib\site-packages\torchdata\datapipes\iter\__init__.py", line 79, in <module>
from torchdata.datapipes.iter.util.cacheholder import (
File "G:\2E\anaconda\envs\open-mmlab\lib\site-packages\torchdata\datapipes\iter\util\cacheholder.py", line 24, in <module>
from torch.utils._import_utils import dill_available
ModuleNotFoundError: No module named 'torch.utils._import_utils'
进程已结束,退出代码1
参考文章:
1.ModuleNotFoundError: No module named ‘torch.utils._import_utils‘ 报错解决
另Datasets4EO中github演示界面有问题:
from torch.utils.data import DataLoader2 应更正为:
from torchdata.dataloader2 import DataLoader2
否则会报错如下: 主要是cannot import name 'DataLoader2' from 'torch.utils.data
G:\2E\anaconda\envs\open-mmlab\python.exe C:\Users\Dell\Desktop\PY!\Dataset4EO\test.py
c:\users\dell\dataset4eo\Dataset4EO\datasets\utils\_internal.py:134: FutureWarning: `ShardingFilterIterDataPipe` from `torch.utils.data.datapipes.iter.grouping` is going to be removed in PyTorch 2.1Please use `ShardingFilterIterDataPipe` from the `torch.utils.data.datapipes.iter.sharding`
class SharderDataPipe(torch.utils.data.datapipes.iter.grouping.ShardingFilterIterDataPipe):
G:\2E\anaconda\envs\open-mmlab\lib\site-packages\mmcv\__init__.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details.
warnings.warn(
G:\2E\anaconda\envs\open-mmlab\lib\site-packages\torchvision\transforms\functional_tensor.py:5: UserWarning: The torchvision.transforms.functional_tensor module is deprecated in 0.15 and will be **removed in 0.17**. Please don't rely on it. You probably just need to use APIs in torchvision.transforms.functional or in torchvision.transforms.v2.functional.
warnings.warn(
G:\2E\anaconda\envs\open-mmlab\lib\site-packages\torchvision\transforms\functional_pil.py:5: UserWarning: The torchvision.transforms.functional_pil module is deprecated in 0.15 and will be **removed in 0.17**. Please don't rely on it. You probably just need to use APIs in torchvision.transforms.functional or in torchvision.transforms.v2.functional.
warnings.warn(
Traceback (most recent call last):
File "C:\Users\Dell\Desktop\PY!\Dataset4EO\test.py", line 8, in <module>
from torch.utils.data import DataLoader2
ImportError: cannot import name 'DataLoader2' from 'torch.utils.data' (G:\2E\anaconda\envs\open-mmlab\lib\site-packages\torch\utils\data\__init__.py)
进程已结束,退出代码1