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
相关推荐
星辰_mya1 分钟前
MVCC 与事务隔离:MySQL 如何实现“读不阻塞写”?
java·数据库·mysql·面试·架构
要开心吖ZSH2 分钟前
MP4 转 WAV 音频转码方案详解(互联网医院病历AI实战-JAVE2方案)
java·ffmpeg
凸头4 分钟前
从聊天机器人到业务执行者:Agentic Orchestration 如何重构 Java 后端体系
java·开发语言·重构
希望永不加班5 分钟前
SpringBoot 跨域问题(CORS)彻底解决方案
java·spring boot·后端·spring
爱丽_5 分钟前
AQS 的 `state`:volatile + CAS 如何撑起原子性与可见性
java·前端·算法
zxfBdd9 分钟前
idea + spark 报错:object hy is not a member of package com.cmcc
java·ide·intellij-idea
攒了一袋星辰10 分钟前
10万级用户数据日更与定向推送系统的可靠性设计
java·数据库·算法
凸头11 分钟前
从“搜了就答”到“智能决策”:拥抱 RAG 2.0 时代的架构演进 ——Java 后端工程师视角下的 AI 应用工程化落地
java·人工智能·架构·rag
DJ斯特拉15 分钟前
JUC基础
java·jvm·juc
小江的记录本16 分钟前
【端口号】计算机领域常见端口号汇总(完整版)
java·前端·windows·spring boot·后端·sql·spring