반응형

mnist 3

[Deep Learning][딥러닝] CNN MNIST 분류

MNIST 데이터에 CNN 적용 하이퍼파라미터 및 데이터셋 전처리 import tensorflow as tf import tensorflow.keras as keras import tensorflow.keras.layers as layers import numpy as np np.random.seed(1) tf.random.set_seed(1) # 하이퍼파라미터 정의 learning_rate = 0.001 N_EPOCHS = 20 N_BATCH = 100 N_CLASS = 10 # 데이터 저장 (train_images, train_labels), (test_images, test_labels) = keras.datasets.mnist.load_data() N_TRAIN = train_images.shap..

[Deep Learning][딥러닝] CNN_MNIST분류 / 모델저장/ FunctionalAPI

Convolutional Neural Network 구현 import matplotlib.pyplot as plt # 학습결과 그래프 함수 # loss 그래프 def loss_plot(history): # plt.figure(figsize=(10,7)) plt.plot(history.history['loss'], label='Train loss') plt.plot(history.history['val_loss'], label='Validation loss') plt.title('Loss') plt.xlabel('Epoch') plt.ylabel('Loss') plt.legend() plt.show() # accuracy 그래프 def accuracy_plot(history): # plt.figure(fi..

[Deep Learning][딥러닝] 딥러닝 구현

MNIST 이미지 분류 MNIST(Modified National Institute of Standards and Technology) database 흑백 손글씨 숫자 0-9까지 10개의 범주로 구분해놓은 데이터셋 하나의 이미지는 28 * 28 pixel 의 크기 6만개의 Train 이미지와 1만개의 Test 이미지로 구성됨. import tensorflow as tf from tensorflow import keras tf.__version__ #'2.1.0' keras.__version__ #'2.2.4-tf' 텐서플로우는 GPU를 사용하는 2.0이상 버전을 설치해야함 # MNIST dataset 조회 (train_image, train_label), (test_image, test_label) =..

반응형