最近在学Tensorflow和Sklearn,一个原因是想搞机器视觉,另外一个原因是想探索深入了解一下AI等等方面的知识,例如神经网络等等。
遇到的第一个问题是有些包用不了,一个可能是因为墙墙,另外一个可能是因为历史版本太久没更新导致网页地址挂了。代码是1.ipynb,具体报错如下:
#1.ipynb
from sklearn.datasets import fetch_olivetti_faces
# 从当前目录下加载人脸数据集,若没有则联网下载到当前目录下
faces = fetch_olivetti_faces(data_home='./')
downloading Olivetti faces from https://ndownloader.figshare.com/files/5976027 to ./
Traceback (most recent call last):
File "0110.py", line 12, in <module>
faces = fetch_olivetti_faces(data_home='./')
File "/home/rwlinux/.local/lib/python3.8/site-packages/sklearn/datasets/_olivetti_faces.py", line 117, in fetch_olivetti_faces
mat_path = _fetch_remote(FACES, dirname=data_home)
File "/home/rwlinux/.local/lib/python3.8/site-packages/sklearn/datasets/_base.py", line 1323, in _fetch_remote
urlretrieve(remote.url, file_path)
File "/usr/lib/python3.8/urllib/request.py", line 247, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.8/urllib/request.py", line 531, in open
response = meth(req, response)
File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
response = self.parent.error(
File "/usr/lib/python3.8/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
解决办法也简单。
只需将原数据集olivetti_py3.pkz放到当前目录下:
原链接挂了,这里放一个网盘
链接: https://pan.baidu.com/s/1ofeOk6hE4tMA-AYPJzW7cg?pwd=1111
提取码:1111
结果如下:文章来源:https://www.toymoban.com/news/detail-511904.html
🌹🌹🌹🌹有用就🌹🌹🌹🌹文章来源地址https://www.toymoban.com/news/detail-511904.html
到了这里,关于downloading Olivetti faces from urllib.error.HTTPError: HTTP Error 403: Forbidden的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!