일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
- java
- Pattern
- mysql
- framework
- Security
- ai
- db
- 함수
- Web
- learning
- LIST
- error
- Linux
- Spring
- 자바
- Python
- Deep
- 인공지능
- Numpy
- SSH
- Server
- interface
- Analysis
- DeepLearning
- data
- Github
- git
- mariaDB
- centos
- javascript
- Today
- Total
PostIT
[AI/Deep Learing] Deep Learning 준비하기 - MNIST DataSet - 5 본문
# [AI/Deep Learing] Deep Learning 준비하기 - MNIST DataSet - 5
import sys, os
sys.path.append(os.pardir)
import numpy as np
import pickle
from dataset.mnist import load_mnist
from common.functions import sigmoid, softmax
from PIL import Image
# MNIST 간단히 이미지 출력해보기.
#파일 다운로드
# normalize : 0.0 ~ 1.0 사이로 정규화 할지 여부, Fasle = 0 ~ 255
# flatten : 1차원 배열로 만들지 여부
# one_hot_lable : 정답을 뜻하는 원소만 1, 나머지는 0으로 설정할지 여부
(x_train, t_train), (x_test, t_test) = load_mnist(flatten=True, normalize=False)
#각 데이터 형상 출력
print(x_train.shape) # (60000, 784)
print(t_train.shape) # (60000,)
print(x_test.shape) # (10000, 784)
print(t_test.shape) # (10000,)
(60000, 784)
(60000,)
(10000, 784)
(10000,)
def img_show(img):
pil_img = Image.fromarray(np.uint8(img))
pil_img.show()
img = x_train[0]
label = t_train[0]
print(label)
print(img.shape)
5
(784,)
# flatten = True로 1차원 배열로 정렬되어 다시 원래의 형상으로 reshape해주는 것
img = img.reshape(28, 28)
print(img.shape)
(28, 28)
# 이미지 보기
img_show(img)
'Deep Learning' 카테고리의 다른 글
[AI/Deep Learing] Deep Learning 준비하기 - MNIST Load Data - 5-1 (0) | 2017.06.23 |
---|---|
[AI/Deep Learing] Deep Learning 준비하기 - 순방향 3층 신경망 구현 - 4 (0) | 2017.06.23 |
[AI/Deep Learing] 인공지능을 위한 Deep Learning 준비(다차원 배열의 계산) - 3 (0) | 2017.05.31 |
[AI/Deep Learing] 인공지능을 위한 Deep Learning 준비(시그모이드 & ReLU 함수 구현하기) - 2 (0) | 2017.05.31 |
[AI/Deep Learing] 인공지능을 위한 Deep Learning 맛 보기 공부(Perceptron과 신경망) - 1 (0) | 2017.05.24 |