【python人工智能开发过程中的小技巧——keras在线加载mnist数据集】

   一、今天在学习capsuleNet时,在github上找到了keras在mnist数据集上训练的源码,但是运行时被卡在了一个地方,就是keras中自带的minist.load_data()函数,后来通过CTRL+右键寻其源码发现,原来加载数据的那个网址被墙了,代码如下:
def load_data(path='mnist.npz'):
    path = get_file(path,
                    origin='https://s3.amazonaws.com/img-datasets/mnist.npz',
                    file_hash='8a61469f7ea1b51cbae51d4f78837e45')
    f = np.load(path)
    x_train, y_train = f['x_train'], f['y_train']
    x_test, y_test = f['x_test'], f['y_test']
    f.close()
    return (x_train, y_train), (x_test, y_test)
于是就很好解决了,在网上找一个mnist.npz数据,本地加载就ok了!
二、有时 由于服务器防火墙的原因jupyter notebook不能远程连接服务器,因此不好调试大数据量的代码,所以可以利用最原始的python命令来一行一行的查看输出结果。

猜你喜欢

转载自blog.csdn.net/m0_37922734/article/details/80260550
今日推荐