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
相关推荐
sunshine22 girl6 分钟前
Java学习四 面向对象原理
java
干到60岁退休的码农8 分钟前
15.创建获取用户接口与JWT认证器
java·spring boot·mybatis
小羊没烦恼!13 分钟前
Memory 记忆设计讨论:Agent Memory 的数据模型可以怎么设计
java·开发语言·前端·c++·c#
SL_staff21 分钟前
战略落地的最后一公里:从目标到个人日历的自动化链路实现
java·github·全栈
用户37215742613536 分钟前
Java 设置 Excel 数据验证:整数、日期、文本长度、下拉列表和时间
java
白远山1 小时前
智慧场馆解决方案软件开发实战:从架构设计到落地部署指南
java·开发语言·架构·需求分析
SL_staff1 小时前
面向业务人员的IoT概念翻译实践:JVS-IOT低代码配置原理与开发者视角解析
java·spring boot·物联网
m0_587383001 小时前
折扣卡CPS软件开发实战:从系统架构设计到上线指南
java·小程序·架构·需求分析
Zane19942 小时前
用了Optional,为什么NPE还是防不住?
java·后端
大模型码小白2 小时前
告别造假数据,直接连数据库查真实时序数据喂给 TimechoAI 大模型
java·数据库·人工智能·microsoft·架构