tensorflow2.3手动下载mnist.npz数据集

简介

本文介绍了在Ubuntu下如何手动下载mnist.npz数据集并且放到指定位置供tensorflow使用。
tensorflow版本:2.3

解决办法

先写解决办法:

  1. 下载,百度网盘下载链接https://pan.baidu.com/s/1jH6uFFC 密码: dw3d。不是我的网盘,感谢这位大哥的写的博文以及其中的网盘连接。
  2. 下载完成之后放到~/.keras/dataset/目录下,命名为mnist.npz

完成。

解决过程

在使用tensorflow的加载mnist的时候,发现需要从https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz这个网址下载,一看这个域名就不可能成功嘛!
想着我看看能不能把我之前下好的mnist数据集用上,于是看了下加载mnist数据集的源码,如下:

# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""MNIST handwritten digits dataset.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import numpy as np

from tensorflow.python.keras.utils.data_utils import get_file
from tensorflow.python.util.tf_export import keras_export


@keras_export('keras.datasets.mnist.load_data')
def load_data(path=
  • 6
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值