问题1:执行df.shape()报错
问题3:windows环境jupyter的文件路径
问题4: size.width>0 && size.height>0 in function ‘cv::imshow’
cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:967: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
问题5:提示mkl-service package failed to import
C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py:143: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
问题6:None of the MLIR Optimization Passes are enabled (registered 2)
C:\ProgramData\Anaconda3\python.exe C:/Users/Administrator/PycharmProjects/pythonProject/单个神经网络实现预测.py
2022-06-18 17:15:58.250081: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-06-18 17:15:58.250363: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
data.shape: (24809, 3)
2022-06-18 17:16:39.556612: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2022-06-18 17:16:39.564416: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
2022-06-18 17:16:39.720073: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: USER-20220309LD
2022-06-18 17:16:39.720503: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: USER-20220309LD
2022-06-18 17:16:39.861162: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Model: "sequential"
_________________________________________________________________
Layer (type) Output Shape Param #
================================================================
dense (Dense) (None, 1) 2
================================================================
Total params: 2
Trainable params: 2
Non-trainable params: 0
_________________________________________________________________
2022-06-18 17:16:45.608803: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:185] None of the MLIR Optimization Passes are enabled (registered 2)
Epoch 1/1000
forrtl: error (200)
问题7 :Failed to open NetParameter file
`cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\darknet\darknet_importer.cpp:210: error: (-212:Parsing error) Failed to open NetParameter file: E:\yoloyolov3.cfg in function 'cv::dnn::dnn4_v20220524::readNetFromDarknet'`
问题8: IndexError: index 80 is out of bounds for axis 0 with size 80
问题9: ERROR: No matching distribution found for numpy<1.19.0,>=1.16.0
问题10:执行U-net时,提示文件或路径不存在
修改前
midname = imgname[imgname.rindex("/")+1:]
修改后
midname = imgname[imgname.rindex("\\")+1:]
问题11:AttributeError: module ‘tensorflow.python.framework.ops’ has no attribute ‘_TensorLike’
Using TensorFlow backend.
loading data
------------------------------
load train images...
------------------------------
------------------------------
load test images...
------------------------------
loading data done
Traceback (most recent call last):
File "E:/test/Unet-master/unet.py", line 174, in <module>
myunet.train()
File "E:/test/Unet-master/unet.py", line 154, in train
model = self.get_unet()
File "E:/test/Unet-master/unet.py", line 89, in get_unet
conv1 = Conv2D(64, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(inputs)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 75, in symbolic_fn_wrapper
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\base_layer.py", line 446, in __call__
self.assert_input_compatibility(inputs)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\base_layer.py", line 310, in assert_input_compatibility
K.is_keras_tensor(x)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 695, in is_keras_tensor
if not is_tensor(x):
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 703, in is_tensor
return isinstance(x, tf_ops._TensorLike) or tf_ops.is_dense_tensor_like(x)
AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike'
问题12:ImportError: cannot import name ‘get_config’ from 'tensorflow.python.eager.context
C:\ProgramData\Anaconda3\python.exe E:/test/Unet-master/unet.py
Traceback (most recent call last):
File "E:/test/Unet-master/unet.py", line 2, in <module>
from keras.callbacks import ModelCheckpoint
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\__init__.py", line 24, in <module>
from keras import models
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\models\__init__.py", line 18, in <module>
from keras.engine.functional import Functional
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\functional.py", line 23, in <module>
from keras import backend
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\backend.py", line 39, in <module>
from tensorflow.python.eager.context import get_config
ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context' (C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\eager\context.py)
pip install tensorflow==2.6.0 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
参考内容:
TF1.x
tensorflow版本 keras版本
TensorFlow 1.13 Keras 2.2.4
TensorFlow 1.14 Keras 2.2.5
TensorFlow 1.15 Keras 2.2.5
TF2.x
tensorflow版本 keras版本
TensorFlow 2.0.0 Keras 2.3.1
TensorFlow 2.1.0 Keras 2.3.1
TensorFlow 2.2.0 Keras 2.3.1
TensorFlow 2.4.0 Keras 2.4.3
TensorFlow 2.6.0 Keras 2.6.0
问题13:cannot import name ‘array_to_img’ from ‘keras’
C:\ProgramData\Anaconda3\python.exe E:/test/Unet-master/unet.py
2022-06-27 23:47:40.946200: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-06-27 23:47:40.946200: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File "E:/test/Unet-master/unet.py", line 6, in <module>
from keras import array_to_img
ImportError: cannot import name 'array_to_img' from 'keras' (C:\ProgramData\Anaconda3\lib\site-packages\keras\__init__.py)
问题14:安装依赖包报错
解决方法: 添加 -r ;如:pip install -r E:\test\requirements.txt
加快下载的速度的方法:
pip install -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple -r E:\test\requirements.txt
问题15:执行python E:\test\detect.py --source E:\test\v_test.mp4 --weights
yolov5s.pt报AttributeError: ‘Upsample’ object has no attribute
‘recompute_scale_factor’
报错具体信息:
(base) E:\test\yolov5-master>
(base) E:\test\yolov5-master>
(base) E:\test\yolov5-master>python detect.py --sourc
e E:\test\yolov5-master\data\mp_vedio\v_test.mp4 --we
ights yolov5s.pt
Downloading https://ultralytics.com/assets/Arial.ttf to C:\Users\Administrator\A
ppData\Roaming\Ultralytics\Arial.ttf...
detect: weights=['yolov5s.pt'], source=E:\test\yolov5
-master\data\mp_vedio\v_test.mp4, imgsz=[640, 640], conf_thres=0.25, iou_thres=0
.45, max_det=1000, device=cpu, view_img=False, save_txt=False, save_conf=False,
save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False,
visualize=False, update=False, project=runs\detect, name=exp, exist_ok=False, li
ne_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False
YOLOv5 2021-10-19 torch 1.11.0+cpu CPU
Fusing layers...
Model Summary: 213 layers, 7225885 parameters, 0 gradients
video 1/1 (1/511) E:\test\yolov5-master\data\mp_vedio
\v_test.mp4: Traceback (most recent call last):
File "detect.py", line 310, in <module>
main(opt)
File "detect.py", line 305, in main
run(**vars(opt))
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\autograd\grad_mode.py",
line 27, in decorate_context
return func(*args, **kwargs)
File "detect.py", line 154, in run
pred = model(img, augment=augment, visualize=visualize)[0]
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py",
line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "E:\test\yolov5-master\models\yolo.py", line 1
26, in forward
return self._forward_once(x, profile, visualize) # single-scale inference,
train
File "E:\test\yolov5-master\models\yolo.py", line 1
49, in _forward_once
x = m(x) # run
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py",
line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\upsampling.p
y", line 154, in forward
recompute_scale_factor=self.recompute_scale_factor)
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py",
line 1185, in __getattr__
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor'
(base) E:\test\yolov5-master\yolov5-master>
解决方法:
第一步:查看日志报错信息,找到对应的代码
第二步:修改代码
修改前:
def forward(self, input: Tensor) -> Tensor:
return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners,
recompute_scale_factor=self.recompute_scale_factor)
修改后:
def forward(self, input: Tensor) -> Tensor:
return F.interpolate(input, self.size, self.scale_factor, self.mode, self.align_corners)
第三步:保存后,重新执行成功
问题15:提示ss labels are 0-{nc - 1}’ AssertionError: Label class 15
exceeds nc=2 in E:\automachine\seven\datasets\my_
datasets\lfy_test.yaml. Possible class labels are 0-1
第三步:修改相应的标签,然后在重新标记,重新执行成功
**欢迎大家在评论区多多批评指正,十分感谢!**