
基于深度学习的人工智障
小白记录下学习过程中遇到的问题,同时也分享给和我一样在入门之路上苦苦挣扎的同学
Mamdanni
这个作者很懒,什么都没留下…
展开
-
同时读取tif、gif格式图片
import cv2import imageiodef readImage(path): image = cv2.imread(path) if image is None: temp = imageio.mimread(path) if temp is not None: temp = np.array(temp) image = temp[0][:,:,:3] return image#.原创 2022-04-03 17:48:09 · 200 阅读 · 0 评论 -
ModuleNotFoundError: No module named ‘numpy.core._multiarray_umath‘ImportError: numpy.core.multiarr
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'ImportError: numpy.core.multiarray failed to importImportError: numpy.core._multiarray_umath failed to importImportError: numpy.core.umath failed to import***************tensorflow/pyt.原创 2022-04-02 20:48:55 · 2140 阅读 · 0 评论 -
“load_state_dict self.class.name, “\n\t”.join(error_msgs))) RuntimeError: Error(s) in loading state_
错误“load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in原创 2022-03-29 11:34:50 · 933 阅读 · 0 评论 -
TypeError: __init__() got an unexpected keyword argument ‘transforms‘类似的报错
这种错误一般是粗心造成的,参数或者函数名称错误导致。如题的报错是由于参数'transform'误加's'造成:train_set=torchvision.datasets.CIFAR10(root='../data/cifar10',train=True, download=True,transforms=transform)改为:train_set=torchvision.datasets.CIFAR10(r原创 2022-03-10 09:52:03 · 9686 阅读 · 0 评论 -
MatplotlibDeprecationWarning: Calling gca() with keyword arguments was deprecated in Matplotlib 3.4.
问题:ax = fig.gca(projection='3d')使用matplotlib绘制3D图像时出现警告:“MatplotlibDeprecationWarning: Calling gca() with keyword arguments was deprecated in Matplotlib 3.4. Starting two minor releases later, gca() will take no keyword arguments. The gca() function s原创 2022-03-05 21:28:40 · 2546 阅读 · 2 评论 -
RuntimeError: Only Tensors of floating point and complex dtype can require gradients
代码:x=torch.ones(1)w=torch.full([1],2)w.requires_grad_()# ##RuntimeError: Only Tensors of floating point and complex dtype can require gradients问题:遇到“RuntimeError: Only Tensors of floating point and complex dtype can require gradients”解决:1.之后添原创 2022-03-05 11:32:43 · 6873 阅读 · 0 评论 -
Broadcasting
理解:张量维度扩张机制,实现数据形式上的重复,并没有像repeat一样实际的去复制。在需要的位置扩充维度,并将增加的维度扩张成给定的size。扩展方法:从左侧维度匹配,若当前维度 dim = 1 ,扩张至给定size,如果没有当前维度,扩充一个维度,再进行上述操作,若不符合上述条件,则不符合Broadcasting机制。...原创 2022-03-03 16:12:39 · 98 阅读 · 0 评论 -
randn数据时报错:”RuntimeError: “normal_kernel_cpu“ not implemented for ‘Long‘“
将torch.normal(mean=torch.full([10],0),std=torch.arange(1,0,-0.1))中的“0”之后添加一个“.”即torch.normal(mean=torch.full([10],0.),std=torch.arange(1,0,-0.1))已解决。原创 2022-03-01 19:35:49 · 2460 阅读 · 0 评论 -
keras环境配置几点注意事项
由于h5py库的更新,安装过程中会自动安装h5py=3.0.0以上的版本,会导致decode("utf8”)的错误。解决办法:在安装完tensorflow后手动更新h5py安装指令如下:pip install h5py==2.10.0如果报TypeError: _array_() takes 1 positional argument but2 were given错误,解决办法:手动更新pillow版本安装指令如下:pip install pillow==8.2.0一些原创 2021-12-25 15:46:57 · 728 阅读 · 0 评论 -
成功解决使用import或from...import...导入文件时报错
出现问题如图所示:解决方案:右击python文件所在的文件夹-->找到下方”Mark Directory as“-->点击”Sources Root“即可解决,如下图。原创 2021-11-08 19:59:39 · 2950 阅读 · 0 评论 -
Multiple Errors Encountered.——Anaconda配置环境变量
D:\Annaconda3;D:\Annaconda3\Library\bin最初安装Anaconda,只在环境变量中添加了这两个路径,可以正常使用,建环境等操作都未出现问题,突然有一天遇到”Multiple Errors Encountered.“,遂增加路径D:\Annaconda3\Scripts同时修改环境名称-->成功;使用名称“torch"新建失败。为了找到原因,又将增加的路径移除,同时修改环境名称-->成功;使用名称“torch"新建失败。综上所述:尝.原创 2021-11-08 09:11:34 · 2309 阅读 · 0 评论 -
TypeError: __init__() got an unexpected keyword argument ‘ragged‘
由于模型训练时的tensorflow版本,与导入模型测试时的tensorflow版本不一致所导致。我训练时使用的版本是2.6.0,测试使用1.13.1报错解决方案:pip uninstall tensorflow pip install tensorflow -i https://pypi.doubanio.com/simple重装tensorflow,与训练时版本保持一致即可。...原创 2021-10-27 09:20:13 · 833 阅读 · 0 评论 -
记录一下自己安装过的包的国内镜像源(记性不好,持续更新)
tensorflow:CPU版本pip install tensorflow -i https://pypi.doubanio.com/simplepip install tensorflow==(要安装的版本号) -i https://pypi.doubanio.com/simpleGPU版本pip install tensorflow-gpu -i https://pypi.doubanio.com/simplepip install tensorflow-gpu==(要安装的原创 2021-10-27 08:41:00 · 1009 阅读 · 0 评论 -
OSError: `pydot` failed to call GraphViz.Please install GraphViz (https://www.graphviz.org/) and ..
解决方案:pip install pydot pip install graphviz 打可Download | Graphviz下载安装,可手动添加PATH,也可在安装过程中选择,如图: 重启解决。必须重启,否则依然报错。原创 2021-10-25 16:14:10 · 236 阅读 · 0 评论