CV:关于调用ssim包出错的解决办法

环境如下:

# Name                    Version                   Build  Channel
blas                      1.0                         mkl
ca-certificates           2022.2.1             haa95532_0
certifi                   2021.10.8        py39haa95532_2
cycler                    0.11.0                   pypi_0    pypi
example                   0.1.0                    pypi_0    pypi
fonttools                 4.29.1                   pypi_0    pypi
freetype                  2.10.4               hd328e21_0
icc_rt                    2019.0.0             h0cc432a_1
imageio                   2.9.0              pyhd3eb1b0_0
intel-openmp              2021.4.0          haa95532_3556
jpeg                      9d                   h2bbff1b_0
kiwisolver                1.3.2                    pypi_0    pypi
libpng                    1.6.37               h2a8f88b_0
libprotobuf               3.19.1               h23ce68f_0
libtiff                   4.2.0                hd0e1b90_0
libwebp                   1.2.2                h2bbff1b_0
lz4-c                     1.9.3                h2bbff1b_1
matplotlib                3.5.1                    pypi_0    pypi
mkl                       2021.4.0           haa95532_640
mkl-service               2.4.0            py39h2bbff1b_0
mkl_fft                   1.3.1            py39h277e83a_0
mkl_random                1.2.2            py39hf11a4ad_0
networkx                  2.7.1                    pypi_0    pypi
numpy                     1.22.2                   pypi_0    pypi
numpy-base                1.21.5           py39hc2deb75_0
nvidia-pyindex            1.0.9                    pypi_0    pypi
opencv-python             4.5.5                    pypi_0    pypi
openssl                   1.1.1m               h2bbff1b_0
packaging                 21.3                     pypi_0    pypi
pillow                    9.0.1                    pypi_0    pypi
pip                       21.2.4           py39haa95532_0
protobuf                  3.19.1           py39hd77b12b_0
pyparsing                 3.0.7                    pypi_0    pypi
python                    3.9.0                h6244533_2
python-dateutil           2.8.2                    pypi_0    pypi
pytorch-ssim              0.1                      pypi_0    pypi
pywavelets                1.2.0                    pypi_0    pypi
scikit-image              0.19.2                   pypi_0    pypi
scipy                     1.7.3            py39h0a974cb_0
setuptools                58.0.4           py39haa95532_0
six                       1.16.0             pyhd3eb1b0_1
sqlite                    3.37.2               h2bbff1b_0
tensorboardx              2.5                pyhd8ed1ab_0    conda-forge
thop                      0.0.31-2005241907          pypi_0    pypi
tifffile                  2022.2.9                 pypi_0    pypi
tk                        8.6.11               h2bbff1b_0
torch                     1.10.2+cu113             pypi_0    pypi
torchvision               0.11.3+cu113             pypi_0    pypi
typing-extensions         4.1.1                    pypi_0    pypi
tzdata                    2021e                hda174b7_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
wheel                     0.37.1             pyhd3eb1b0_0
wincertstore              0.2              py39haa95532_2
xz                        5.2.5                h62dcd97_0
zlib                      1.2.11               h8cc25b3_4
zstd                      1.4.9                h19a0ad4_0

环境搭好后运行源代码出现了以下问题:

TypeError: conv2d() received an invalid combination of arguments - got (Tensor, Tensor, padding=float, groups=int), but expected one of:
 * (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, tuple of ints padding, tuple of ints dilation, int groups)
 * (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, str padding, tuple of ints dilation, int groups)

根据代码意思,了解了原来在python3中的/会产生float型数值,但是cov2d要求的是int型,因此只需在ssim源包里,只需将/改成//号:然后进行运行就可以解决这个问题。CV:关于调用ssim包出错的解决办法_第1张图片

 

你可能感兴趣的:(pycharm,windows,python)