weixin_45924904 2021-04-23 19:28 采纳率: 0%
浏览 43

基于python的mnist条用时出现远端服务器无响应

在学习神经网络是时,读入mnist数据集时总是出现错误,测试了各种·方法都不能有效的解决

代码如下

import sys,os
sys.path.append(os.pardir)
from dataset.mnist import load_mnist
( x_train, t_train), (x_test, t_test) = load_mnist(normalize=False, flatten=True)
print(x_train.shape)
print(t_train.shape)
print(x_test.shape)
print(t_test.shape)
import numpy as np
from PIL import Image
def img_show(img):
    pil_img=Image.fromarray(np.uint8(img))
    pil_img.show()
( x_train, t_train), (x_test, t_test) = load_mnist(normalize=False, flatten=True)
img=x_train[0]
lable=t_train[0]
print(lable)

print(img.shape)   #(784,)
img=img.reshape(28,28)  #把图片的形状变为原来的尺寸
print(img.shape)     #28*28
img_show()

错误是这样 

Downloading t10k-labels-idx1-ubyte.gz ... 
Traceback (most recent call last):
  File "E:\pycharm\ch3\minst_show.py", line 4, in <module>
    ( x_train, t_train), (x_test, t_test) = load_mnist(normalize=False, flatten=True)
  File "E:\pycharm\dataset\mnist.py", line 106, in load_mnist
    init_mnist()
  File "E:\pycharm\dataset\mnist.py", line 75, in init_mnist
    download_mnist()
  File "E:\pycharm\dataset\mnist.py", line 42, in download_mnist
    _download(v)
  File "E:\pycharm\dataset\mnist.py", line 37, in _download
    urllib.request.urlretrieve(url_base + file_name, file_path)
  File "C:\Python\Python39\lib\urllib\request.py", line 239, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "C:\Python\Python39\lib\urllib\request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python\Python39\lib\urllib\request.py", line 523, in open
    response = meth(req, response)
  File "C:\Python\Python39\lib\urllib\request.py", line 632, in http_response
    response = self.parent.error(
  File "C:\Python\Python39\lib\urllib\request.py", line 561, in error
    return self._call_chain(*args)
  File "C:\Python\Python39\lib\urllib\request.py", line 494, in _call_chain
    result = func(*args)
  File "C:\Python\Python39\lib\urllib\request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 503: Service Unavailable
  • 写回答

5条回答 默认 最新

  • 关注

    HTTP Error 503: Service Unavailable,访问的地址错了。

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?