▶ 방법 1
%tensorflow_version 2.0x
import tensorflow as tf
from tensorflow import keras
from google.colab import files
# 구글 드라이브에 파일을 업로드해두고 읽는 방식
from google.colab import drive
drive.mount('/content/drive')
import numpy as np
from scipy.io import loadmat
import matplotlib.pyplot as plt
from google.colab import drive
drive.mount('/content/drive')
mat = loadmat('test_32x32.mat')
mat.keys()
▶ 방법 2
%tensorflow_version 2.0x
import tensorflow as tf
from tensorflow import keras
from google.colab import files
# 파일 업로드 방식
uploaded = files.upload()
from scipy import io
mat_file = io.loadmat('test_32x32.mat')
▶ 데이터 획득
# 데이터 획득
x = mat['X']
y = mat['y']
x.shape, y.shape
▶ 전처리
# 전처리
x = np.transpose(x, [3,0,1,2])/255
y = y[:, 0]
x.shape, y.shape, np.max(x)
'Deep learning > Code' 카테고리의 다른 글
SVHN (0) | 2020.01.31 |
---|---|
numtest (0) | 2020.01.31 |
rnn_2_number_with_blank (0) | 2020.01.30 |
cnn_2_number_with_blank (0) | 2020.01.30 |
cnn_2_number (0) | 2020.01.30 |