当前位置:   article > 正文

深度学习报错合集_userwarning: palette images with transparency expr

userwarning: palette images with transparency expressed in bytes should be c

文章目录

运行 pretict.py 时报错

tf2架构

1.AttributeError: ‘str’ object has no attribute ‘decode’

Traceback (most recent call last): File "d:/data/python/yolo3-keras-master/predict.py", line 15, in <module> yolo = YOLO() File "d:\data\python\yolo3-keras-master\yolo.py", line 52, in __init__ self.boxes, self.scores, self.classes = self.generate() File "d:\data\python\yolo3-keras-master\yolo.py", line 95, in generate self.yolo_model.load_weights(self.model_path) File "D:\app\Anaconda\envs\tensorflow-gpu\lib\site-packages\keras\engine\topology.py", line 2656, in load_weights f, self.layers, reshape=reshape) File "D:\app\Anaconda\envs\tensorflow-gpu\lib\site-packages\keras\engine\topology.py", line 3328, in load_weights_from_hdf5_group original_keras_version = f.attrs['keras_version'].decode('utf8').decode('utf8') AttributeError: 'str' object has no attribute 'decode'

  1. 解决方法:
  • 卸载原来的h5py模块,安装2.10版本
  • pip install h5py==2.10 -i https://pypi.tuna.tsinghua.edu.cn/simple/

2.InternalError (see above for traceback): Blas SGEMM launch failed : m=43264, n=32, k=64

InternalError (see above for traceback): Blas SGEMM launch failed : m=43264, n=32, k=64 [[node conv2d_3/convolution (defined at D:\app\Anaconda\envs\tensorflow-gpu\lib\site-packages\keras\backend\tensorflow_backend.py:3335) ]] [[node boolean_mask_143/GatherV2 (defined at d:\data\python\yolo3-keras-master\nets\yolo3.py:291) ]]

  1. 报错原因:

    显卡3050,必须使用CUDA11

  2. 解决方法:

    1. 官网下载CUDA11安装

      注意安装路径不要在临时解压文件夹下

    2. 官网下载对应版本的cuDNN,解压到……

    3. 安装PyTorch,到官网找对CUDD对应版本,复制命令安装

3.ModuleNotFoundError: No module named ‘cv2’

  • pip install opencv-python (如果只用主模块,使用这个命令安装)

4.ModuleNotFoundError: No module named ‘PIL’

  • pip install pillow

5.ImportError: numpy.core.multiarray failed to import

  • 卸载numpy,再安装

6.OpenCV: FFMPEG: fallback to use tag 0x7634706d/‘mp4v’

OpenCV: FFMPEG: tag 0x47504a4d/'XVID' is not supported with codec id 7 and format 'mp4 / MP4 (MPEG-4 Part 14)' OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'

1.解决方法

1,将fourcc = cv2.VideoWriter_fourcc(*“XVID”)的"XVID"改成"mp4v"

7.dlerror: cudart64_101.dll not found

2021-09-17 08:44:07.044777: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found

1.解决方法

​ 1.去官网下载cudart64_101.dll文件,解压。(cuda10的包)放到:D:\app\CUDA GPU Comouting Toolkit\CUDA\v11.4\bin

8. dlerror: cusolver64_10.dll not found(同上)

9.dlerror: cusparse64_10.dll not found(同上)

10. dlerror: cudnn64_7.dll not found(同上)

11.dlerror: cublas64_10.dll not found(同上)

12.Skipping registering GPU devices…

解决好7-11的问题,最后以上的问题通过升级tensorflow和tensorflow-gpu解决。

CUDA11.4 cudnn11.4 tensorfloe2.4.0 tensorflow-gpu2.4.0

13.g: Palette images with Transparency expressed in bytes should be converted to RGBA images

1.报错原因

有这一警告的原因在于,验证码的图片模式为RGBA,是无法分配调色盘给透明通道的。更换为RGB模式则不会出现该问题。

2.解决方法

我使用photoshop进行模式转换的批处理后,还是报错。

14.dlerror: cupti64_110.dll not found(同7)

15.dlerror: cupti.dll not found(同7)

16.CUDA_ERROR_OUT_OF_MEMORY: out of memory

I tensorflow/stream_executor/cuda/cuda_driver.cc:789] failed to allocate 1.83G (1968046080 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY: out of memory

1.报错原因

GPU溢出,在代码里限制GPU调用就可以了。

2.解决方法

tf.config.experimental.set_virtual_device_configuration(gpus[0],

[tf.config.experimental.VirtualDeviceConfiguration(memory_limit=2048)])

17.ImportError: DLL load failed: 找不到指定的模块。

`Traceback (most recent call last):
File “d:/data/python/yolo3-pytorch-master/train.py”, line 4, in
import numpy as np
File “D:\app\Anaconda\envs\pytorch\lib\site-packages\numpy_init_.py”, line 140, in
from . import core
File “D:\app\Anaconda\envs\pytorch\lib\site-packages\numpy\core_init_.py”, line 48, in
raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html
  • 1

Please note and check the following:

  • The Python version is: Python3.6 from “D:\app\Anaconda\envs\pytorch\python.exe”
  • The NumPy version is: “1.19.5”

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed: 找不到指定的模块。`

1.解决方法

​ 卸载numpy,再重新安装

18ModuleNotFoundError: No module named ‘scipy’

安装scipy:pip install scipy

19.ModuleNotFoundError: No module named ‘matplotlib’

同上

20.BrokenPipeError: [Errno 32] Broken pipe

21.视频和摄像头的保存问题

在视频窗口使用esc退出就可以保存。

pytorch架构

1.页面文件太小,无法完成操作。

OSError: [WinError 1455] 页面文件太小,无法完成操作。 Error loading "D:\app\Anaconda\envs\pytorch\lib\site-packages\torch\lib\cudnn_adv_infer64_8.dll" or one of its dependencies.

1.解决问题

​ 在train.py里的num_workers所致。原先值为4,我改成0后成功运行。

探索多线程并行CUDA加速

1.TypeError: Failed in nopython mode pipeline (step: fix up args)

2.RuntimeError: CUDA out of memory.

RuntimeError: CUDA out of memory. Tried to allocate 18.00 MiB (GPU 0; 4.00 GiB total capacity; 77.77 MiB already allocated; 2.68 GiB free; 86.00 MiB reserved in total by PyTorch)

3.DefaultCPUAllocator: not enough memory

RuntimeError: [enforce fail at ..\c10\core\CPUAllocator.cpp:79] data. DefaultCPUAllocator: not enough memory: you tried to allocate 18874368 bytes.

4.TypeError: No matching version.

TypeError: No matching version. GPU ufunc requires array arguments to have the exact types. This behaves like regular ufunc with casting='no'.

5.RuntimeError: Unable to find a valid cuDNN algorithm to run convolution

6.RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR

7.Unable to allocate 5.93 MiB for an array with shape (1080, 1920, 3) and data type uint8`

`Process Process-1:
Traceback (most recent call last):
File “D:\app\Anaconda\envs\pytorch\lib\site-packages\numpy\core\fromnumeric.py”, line 1955, in shape
result = a.shape
File “D:\app\Anaconda\envs\pytorch\lib\site-packages\PIL\Image.py”, line 546, in getattr
raise AttributeError(name)
AttributeError: shape

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:\app\Anaconda\envs\pytorch\lib\multiprocessing\process.py”, line 258, in _bootstrap
self.run()
File “D:\app\Anaconda\envs\pytorch\lib\multiprocessing\process.py”, line 93, in run
self._target(*self._args, **self._kwargs)
File “d:\data\python\Multi-model-parallel\predict.py”, line 166, in predict
r_image = yolo.detect_image(image)
File “d:\data\python\Multi-model-parallel\YOLO\yolo1.py”, line 211, in detect_image
right = min(np.shape(image)[1], np.floor(right + 0.5).astype(‘int32’))
File “<array_function internals>”, line 6, in shape
File “D:\app\Anaconda\envs\pytorch\lib\site-packages\numpy\core\fromnumeric.py”, line 1957, in shape
result = asarray(a).shape
File “D:\app\Anaconda\envs\pytorch\lib\site-packages\numpy\core_asarray.py”, line 83, in asarray
return array(a, dtype, copy=False, order=order)
File “D:\app\Anaconda\envs\pytorch\lib\site-packages\PIL\Image.py”, line 703, in array
return np.array(ArrayData(), dtype)
numpy.core._exceptions._ArrayMemoryError: Unable to allocate 5.93 MiB for an array with shape (1080, 1920, 3) and data type uint8`

8.RuntimeError: [enforce fail at …\c10\core\CPUAllocator.cpp:79] data. DefaultCPUAllocator: not enough memory: you tried to allocate 1179648 bytes.

9.EOFError: Ran out of input

  • 出现该问题一般是由于你在以写模式打开文件后未关闭的情况下又去以读模式操作该文件时报的错误

  • `def model_a(self,model,images):

    outputs = self.netmodel 多进程时,此代码重复执行,用不同网络打开同一张照片造成错误

    output_list = []

    output_lists = []

    batch_detections = []

    for i in range(3):

    ​ output_list.append(self.yolo_decodes[model]i)

    output_lists.extend([output_list])

    #---------------------------------------------------------#

    # 将预测框进行堆叠,然后进行非极大抑制

    #---------------------------------------------------------#

    output = torch.cat(output_list, 1)

    batch_detections.extend([non_max_suppression(output, self.num_classes[model], conf_thres=self.confidence, nms_thres=self.iou)])

    `

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/484859
推荐阅读
相关标签
  

闽ICP备14008679号