MNIST데이터셋의 손글씨 데이터
from sklearn.datasets import load_digits
digits = load_digits()
digits.keys()
# 출력
dict_keys(['data', 'target', 'frame', 'feature_names', 'target_names', 'images', 'DESCR'])
load_digits() : Dictionary 자료형과 유사한 sklearn.utils.Bunch 자료형
digits_data = digits.data
# 데이터늬 shape 확인
digits_data.shape
# 출력
(1797, 64)
digits_data[0]
# 출력
224.625
손글씨 데이터는 이미지 데이터입니다. 그래서 각 숙자는 픽셀값을 의미합니다. 길이 64의 숫자 배열은 (8x8)크기의 이미지를 일렬로 펴놓은 것입니다.
이미지를 한번 확인해 보겠습니다.
import matplotlib.pyplot as plt
%matplotlib inline
plt.imshow(digits.data[1].reshape(8,8), cmap = 'gray')
plt.axis('off')
plt.show()

여러개의 이미지를 한번에 확인해보겠습니다.
for i in ragne(10):
plt.subplot(2, 5, i+1)
plt.imshow(digits.data[i].reshape(8,8), cmap = 'gray')
plt.axis('off')
plt.show()

'하루 30분 컴퓨터 비전 공부하기' 카테고리의 다른 글
| CV(2) CNN 기초 - Convolution, filter, padding (0) | 2023.10.25 |
|---|---|
| CV(4) CNN 기초 - pooling (0) | 2023.10.25 |
| CV(3) CNN 기초 - 3 Channel Convolution/Hyper-Parameter (0) | 2023.10.25 |
| CV(1) 이미지 데이터 다루기 기초와 MLP (0) | 2023.10.24 |
| [파이썬] itertools count, 조합, 순열 사용방법 (0) | 2023.09.04 |