[DL] 손글씨 숫자 인식 from dataset.mnist import load_mnist 해결

JINJU·2021년 11월 28일
0
Traceback (most recent call last):
  File "/Users/yujinju/Documents/Deep Learning from scratch/ch3/MNIST_dataset.py", line 3, in <module>
    from dataset.mnist import load_mnist
ModuleNotFoundError: No module named 'dataset'

오잉.. 책 따라서 코드 실행시켜보면 부모디렉토리를 못찾길래 절대경로로 해줬더니

base) yujinju@yujinjuui-MacBook-Pro Deep Learning from scratch %  cd "/Users/yujinju/Documents/Deep Learning from scratch" ; /usr/bin/env /Users/yujinju/opt/anaconda3/bin/python /Users/yujinju/.vscode/extensions/ms-python.python-2021.11.1422169775/pythonFiles/lib/python/debugpy/launcher 58465 -- "/Users/yujinju/Documents/Deep Learning from scratch/ch3/MNIST_dataset.py" 
(60000, 784)
(60000,)
(10000, 784)
(10000,)

너무 잘된다.

에러해결

만약 같은 에러가 난다면 절대경로로 하십쇼 !

import sys, os
sys.path.append("/Users/yujinju/Desktop/deeplearning_from_scratch-master")
from dataset.mnist import load_mnist

(x_train, t_train), (x_test, t_test) = \
    load_mnist(flatten=True, normalize=False)

print(x_train.shape)
print(t_train.shape)
print(x_test.shape)
print(t_test.shape)

아! 그리고 코드저장소는
밑바닥부터 시작하는 딥러닝 github 여기에 있다.

0개의 댓글