用conda创建新的虚拟环境
conda create -n 新环境名 python=版本号(新环境名自己随便取)
conda create -n pytorch1.8 python=3.7
切换至(激活)新的虚拟环境
conda activate 环境名
source activate pytorch1.8
到pytorch官网根据自己的情况进行选择:https://pytorch.org/
查看cuda=11.3,于是:
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
安装cv2
pip install opencv-python
报libGL.so.1: cannot open shared object file
的错误
新容器缺少依赖,安装一下就行了
apt update
apt install libgl1-mesa-glx
报`No module named 'tqdm'`错误
直接
```python
pip install tqdm
报No module named 'imageio'
错误
pip install imageio
报No module named 'skimage'
错误
意思是没有这个模块,在Linux服务器上需要先联网,联网之后使用命令
pip install scikit-image
等待下载安装完成即可
运行报No module named 'skimage.measure.simple_metrics'
错误
/root/anaconda3/envs/pytorch1.8/lib/python3.7/site-packages/skimage/measure/
说明这个给路径里缺少simple_metrics.py这个文件,直接复制一个过去即可,也可以复制下边的代码写一个新的。
from warnings import warn
from ..metrics.simple_metrics import (mean_squared_error,
peak_signal_noise_ratio,
normalized_root_mse)
__all__ = ['compare_mse',
'compare_nrmse',
'compare_psnr',
]
def compare_mse(im1, im2):
warn('DEPRECATED: skimage.measure.compare_mse has been moved to '
'skimage.metrics.mean_squared_error. It will be removed from '
'skimage.measure in version 0.18.', stacklevel=2)
return mean_squared_error(im1, im2)
if mean_squared_error.__doc__ is not None:
compare_mse.__doc__ = mean_squared_error.__doc__ + """
Warns
-----
Deprecated:
.. versionadded:: 0.16
This function is deprecated and will be removed in scikit-image 0.18.
Please use the function named ``mean_squared_error`` from the
``metrics`` module instead.
See also
--------
skimage.metrics.mean_squared_error
"""
def compare_nrmse(im_true, im_test, norm_type='euclidean'):
warn('DEPRECATED: skimage.measure.compare_nrmse has been moved to '
'skimage.metrics.normalized_root_mse. It will be removed from '
'skimage.measure in version 0.18.', stacklevel=2)
return normalized_root_mse(im_true, im_test, normalization=norm_type)
if normalized_root_mse.__doc__ is not None:
compare_nrmse.__doc__ = normalized_root_mse.__doc__ + """
Warns
-----
Deprecated:
.. versionadded:: 0.16
This function is deprecated and will be removed in scikit-image 0.18.
Please use the function named ``normalized_root_mse`` from the
``metrics`` module instead.
See also
--------
skimage.metrics.normalized_root_mse
"""
def compare_psnr(im_true, im_test, data_range=None):
warn('DEPRECATED: skimage.measure.compare_psnr has been moved to '
'skimage.metrics.peak_signal_noise_ratio. It will be removed from '
'skimage.measure in version 0.18.', stacklevel=2)
return peak_signal_noise_ratio(im_true, im_test, data_range=data_range)
if peak_signal_noise_ratio.__doc__ is not None:
compare_psnr.__doc__ = peak_signal_noise_ratio.__doc__ + """
Warns
-----
Deprecated:
.. versionadded:: 0.16
This function is deprecated and will be removed in scikit-image 0.18.
Please use the function named ``peak_signal_noise_ratio`` from the
``metrics`` module instead.
See also
--------
skimage.metrics.peak_signal_noise_ratio
"""