DL4J无法下载MNIST数据集解决 Server returned HTTP response code: 403 for URL解决方法

报错情况

报错如下:

复制代码
16:45:41.463 [main] INFO org.nd4j.nativeblas.Nd4jBlas - Number of threads used for OpenMP BLAS: 6
16:45:41.497 [main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Backend used: [CPU]; OS: [Windows 10]
16:45:41.497 [main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Cores: [12]; Memory: [7.1GB];
16:45:41.497 [main] INFO org.nd4j.linalg.api.ops.executioner.DefaultOpExecutioner - Blas vendor: [OPENBLAS]
16:45:41.536 [main] INFO org.deeplearning4j.datasets.base.MnistFetcher - Downloading MNIST...
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: https://dl4jdata.blob.core.windows.net/datasets/mnist/train-images-idx3-ubyte.gz
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
	at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1506)
	at org.nd4j.common.resources.Downloader.downloadAndExtract(Downloader.java:121)
	at org.nd4j.common.resources.Downloader.downloadAndExtract(Downloader.java:113)
	at org.nd4j.common.resources.Downloader.downloadAndExtract(Downloader.java:94)
	at org.deeplearning4j.datasets.base.MnistFetcher.downloadAndUntar(MnistFetcher.java:149)
	at org.deeplearning4j.datasets.fetchers.MnistDataFetcher.<init>(MnistDataFetcher.java:82)
	at org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator.<init>(MnistDataSetIterator.java:70)
	at org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator.<init>(MnistDataSetIterator.java:56)
	at com.example.LogisticRegression.main(LogisticRegression.java:45)

Process finished with exit code 1

解决方法

自己下载好MNIST数据集,然后放入DL4J对应的文件夹下。

可以在Java中运行这行代码查看:

java 复制代码
System.out.println(DL4JResources.getDirectory(ResourceType.DATASET, "MNIST").getAbsolutePath());

我的位置如下,仅作参考。

java 复制代码
C:\Users\64859\.deeplearning4j\data\MNIST
相关推荐
Mr Aokey1 小时前
手写Java线程池与定时器:彻底掌握多线程任务调度
java·开发语言
西瓜本瓜@5 小时前
在Android中如何使用Protobuf上传协议
android·java·开发语言·git·学习·android-studio
言之。5 小时前
别学了,打会王者吧
java·python·mysql·容器·spark·php·html5
机智的人猿泰山5 小时前
java kafka
java·开发语言·kafka
Algorithm15765 小时前
谈谈接口和抽象类有什么区别?
java·开发语言
细心的莽夫6 小时前
SpringCloud 微服务复习笔记
java·spring boot·笔记·后端·spring·spring cloud·微服务
264玫瑰资源库7 小时前
问道数码兽 怀旧剧情回合手游源码搭建教程(反查重优化版)
java·开发语言·前端·游戏
pwzs7 小时前
Java 中 String 转 Integer 的方法与底层原理详解
java·后端·基础
东阳马生架构7 小时前
Nacos简介—2.Nacos的原理简介
java
普if加的帕8 小时前
java Springboot使用扣子Coze实现实时音频对话智能客服
java·开发语言·人工智能·spring boot·实时音视频·智能客服