แ„‚ ๐Ÿ˜„ [11 ์ผ์ฐจ] : Assignment - EX01

๋ฐฑ๊ฑดยท2022๋…„ 1์›” 21์ผ
0
์ œ๋ชฉ์ƒํƒœ๋น„๊ณ 
๊ฐ€์œ„ ๋ฐ”์œ„ ๋ณด ์ œ์ถœ ์™„๋ฃŒ๊นƒํ—ˆ๋ธŒ
from PIL import Image
import os, glob

print("PIL ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ import ์™„๋ฃŒ!")


####################################

def resize_images(img_path):
    images=glob.glob(img_path + "/*.jpg")  
    
    print(len(images), " images to be resized.")

                                                            # ํŒŒ์ผ๋งˆ๋‹ค ๋ชจ๋‘ 28x28 ์‚ฌ์ด์ฆˆ๋กœ ๋ฐ”๊พธ์–ด ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
    target_size=(28,28)
    for img in images:
        old_img=Image.open(img)
        new_img=old_img.resize(target_size,Image.ANTIALIAS)
        new_img.save(img, "JPEG")
    
    print(len(images), " images resized.")

# ๊ฐ€์œ„ ์ด๋ฏธ์ง€๊ฐ€ ์ €์žฅ๋œ ๋””๋ ‰ํ† ๋ฆฌ ์•„๋ž˜์˜ ๋ชจ๋“  jpg ํŒŒ์ผ์„ ์ฝ์–ด๋“ค์—ฌ์„œ
image_dir_path = os.getenv("HOME") + "/aiffel/rock_scissor_paper/scissor"
resize_images(image_dir_path)

print("๊ฐ€์œ„ ์ด๋ฏธ์ง€ resize ์™„๋ฃŒ!")


####################################

def resize_images(img_path):
    images=glob.glob(img_path + "/*.jpg")  
    
    print(len(images), " images to be resized.")

                                                            # ํŒŒ์ผ๋งˆ๋‹ค ๋ชจ๋‘ 28x28 ์‚ฌ์ด์ฆˆ๋กœ ๋ฐ”๊พธ์–ด ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
    target_size=(28,28)
    for img in images:
        old_img=Image.open(img)
        new_img=old_img.resize(target_size,Image.ANTIALIAS)
        new_img.save(img, "JPEG")
    
    print(len(images), " images resized.")

# ๊ฐ€์œ„ ์ด๋ฏธ์ง€๊ฐ€ ์ €์žฅ๋œ ๋””๋ ‰ํ† ๋ฆฌ ์•„๋ž˜์˜ ๋ชจ๋“  jpg ํŒŒ์ผ์„ ์ฝ์–ด๋“ค์—ฌ์„œ
image_dir_path = os.getenv("HOME") + "/aiffel/rock_scissor_paper/rock"
resize_images(image_dir_path)

print("๋ฐ”์œ„ ์ด๋ฏธ์ง€ resize ์™„๋ฃŒ!")

#######################################

def resize_images(img_path):
    images=glob.glob(img_path + "/*.jpg")  
    
    print(len(images), " images to be resized.")

                                                            # ํŒŒ์ผ๋งˆ๋‹ค ๋ชจ๋‘ 28x28 ์‚ฌ์ด์ฆˆ๋กœ ๋ฐ”๊พธ์–ด ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
    target_size=(28,28)
    for img in images:
        old_img=Image.open(img)
        new_img=old_img.resize(target_size,Image.ANTIALIAS)
        new_img.save(img, "JPEG")
    
    print(len(images), " images resized.")

# ๊ฐ€์œ„ ์ด๋ฏธ์ง€๊ฐ€ ์ €์žฅ๋œ ๋””๋ ‰ํ† ๋ฆฌ ์•„๋ž˜์˜ ๋ชจ๋“  jpg ํŒŒ์ผ์„ ์ฝ์–ด๋“ค์—ฌ์„œ
image_dir_path = os.getenv("HOME") + "/aiffel/rock_scissor_paper/paper"
resize_images(image_dir_path)

print("๋ณด ์ด๋ฏธ์ง€ resize ์™„๋ฃŒ!")

#########################################


import numpy as np

def load_data(img_path, number_of_data=1500):  # ๊ฐ€์œ„๋ฐ”์œ„๋ณด ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜ ์ดํ•ฉ์— ์ฃผ์˜ํ•˜์„ธ์š”.
    # ๊ฐ€์œ„ : 0, ๋ฐ”์œ„ : 1, ๋ณด : 2
    img_size=28                                                            # ์ด๋ฏธ์ง€ ์‚ฌ์ด์ฆˆ 28
    color=3
    #์ด๋ฏธ์ง€ ๋ฐ์ดํ„ฐ์™€ ๋ผ๋ฒจ(๊ฐ€์œ„ : 0, ๋ฐ”์œ„ : 1, ๋ณด : 2) ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ด์„ ํ–‰๋ ฌ(matrix) ์˜์—ญ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
    imgs=np.zeros(number_of_data*img_size*img_size*color,dtype=np.int32).reshape(number_of_data,img_size,img_size,color)
    labels=np.zeros(number_of_data,dtype=np.int32)

    idx=0
    for file in glob.iglob(img_path+'/scissor/*.jpg'):
        img = np.array(Image.open(file),dtype=np.int32)
        imgs[idx,:,:,:]=img    # ๋ฐ์ดํ„ฐ ์˜์—ญ์— ์ด๋ฏธ์ง€ ํ–‰๋ ฌ์„ ๋ณต์‚ฌ
        labels[idx]=0   # ๊ฐ€์œ„ : 0
        idx=idx+1

    for file in glob.iglob(img_path+'/rock/*.jpg'):
        img = np.array(Image.open(file),dtype=np.int32)
        imgs[idx,:,:,:]=img    # ๋ฐ์ดํ„ฐ ์˜์—ญ์— ์ด๋ฏธ์ง€ ํ–‰๋ ฌ์„ ๋ณต์‚ฌ
        labels[idx]=1   # ๋ฐ”์œ„ : 1
        idx=idx+1  
    
    for file in glob.iglob(img_path+'/paper/*.jpg'):
        img = np.array(Image.open(file),dtype=np.int32)
        imgs[idx,:,:,:]=img    # ๋ฐ์ดํ„ฐ ์˜์—ญ์— ์ด๋ฏธ์ง€ ํ–‰๋ ฌ์„ ๋ณต์‚ฌ
        labels[idx]=2   # ๋ณด : 2
        idx=idx+1
        
    print("ํ•™์Šต๋ฐ์ดํ„ฐ(x_train)์˜ ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜๋Š”", idx,"์ž…๋‹ˆ๋‹ค.")
    return imgs, labels

image_dir_path = os.getenv("HOME") + "/aiffel/rock_scissor_paper"
(x_train, y_train)=load_data(image_dir_path)
x_train_norm = x_train/255.0   # ์ž…๋ ฅ์€ 0~1 ์‚ฌ์ด์˜ ๊ฐ’์œผ๋กœ ์ •๊ทœํ™”

print("x_train shape: {}".format(x_train.shape))
print("y_train shape: {}".format(y_train.shape))



PIL ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ import ์™„๋ฃŒ!
500  images to be resized.
500  images resized.
๊ฐ€์œ„ ์ด๋ฏธ์ง€ resize ์™„๋ฃŒ!
500  images to be resized.
500  images resized.
๋ฐ”์œ„ ์ด๋ฏธ์ง€ resize ์™„๋ฃŒ!
500  images to be resized.
500  images resized.
๋ณด ์ด๋ฏธ์ง€ resize ์™„๋ฃŒ!
ํ•™์Šต๋ฐ์ดํ„ฐ(x_train)์˜ ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜๋Š” 1500 ์ž…๋‹ˆ๋‹ค.
x_train shape: (1500, 28, 28, 3)
y_train shape: (1500,)
import tensorflow as tf
from tensorflow import keras
import numpy as np
                                                            # ํŒŒ์ผ๋งˆ๋‹ค ๋ชจ๋‘ 28x28 ์‚ฌ์ด์ฆˆ๋กœ ๋ฐ”๊พธ์–ด ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
model = keras.models.Sequential()
model.add(keras.layers.Conv2D(16, (3, 3), activation = 'relu', input_shape = (28, 28, 3)))
model.add(keras.layers.MaxPool2D(2, 2))
model.add(keras.layers.Conv2D(32, (3, 3), activation = 'relu'))
model.add(keras.layers.MaxPool2D(2, 2))
model.add(keras.layers.Flatten())
model.add(keras.layers.Dense(32, activation = 'relu'))
model.add(keras.layers.Dense(3, activation = 'softmax'))

# model.summary()


####################################################

model.compile(optimizer = 'adam',
             loss = 'sparse_categorical_crossentropy',
             metrics = ['accuracy'])

model.fit(x_train_norm, y_train, epochs=17)
Epoch 1/17
47/47 [==============================] - 0s 3ms/step - loss: 0.9557 - accuracy: 0.6020
Epoch 2/17
47/47 [==============================] - 0s 3ms/step - loss: 0.5563 - accuracy: 0.8300
Epoch 3/17
47/47 [==============================] - 0s 3ms/step - loss: 0.2634 - accuracy: 0.9360
Epoch 4/17
47/47 [==============================] - 0s 3ms/step - loss: 0.1432 - accuracy: 0.9573
Epoch 5/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0790 - accuracy: 0.9800
Epoch 6/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0499 - accuracy: 0.9920
Epoch 7/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0440 - accuracy: 0.9873
Epoch 8/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0242 - accuracy: 0.9980
Epoch 9/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0137 - accuracy: 0.9993
Epoch 10/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0113 - accuracy: 1.0000
Epoch 11/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0077 - accuracy: 1.0000
Epoch 12/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0068 - accuracy: 1.0000
Epoch 13/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0048 - accuracy: 1.0000
Epoch 14/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0039 - accuracy: 1.0000
Epoch 15/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0041 - accuracy: 1.0000
Epoch 16/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0039 - accuracy: 0.9993
Epoch 17/17
47/47 [==============================] - 0s 3ms/step - loss: 0.0022 - accuracy: 1.0000





<keras.callbacks.History at 0x7febce5bb040>
def resize_images(img_path):
    images=glob.glob(img_path + "/*.jpg")  
    
#    print(len(images), " images to be resized.")

                                                            # ํŒŒ์ผ๋งˆ๋‹ค ๋ชจ๋‘ 28x28 ์‚ฌ์ด์ฆˆ๋กœ ๋ฐ”๊พธ์–ด ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
    target_size=(28,28)
    for img in images:
        old_img=Image.open(img)
        new_img=old_img.resize(target_size,Image.ANTIALIAS)
        new_img.save(img, "JPEG")
    
#.  print(len(images), " images resized.")


# ๊ฐ€์œ„ ์ด๋ฏธ์ง€๊ฐ€ ์ €์žฅ๋œ ๋””๋ ‰ํ† ๋ฆฌ ์•„๋ž˜์˜ ๋ชจ๋“  jpg ํŒŒ์ผ์„ ์ฝ์–ด๋“ค์—ฌ์„œ
image_dir_path = os.getenv("HOME") + "/aiffel/rock_scissor_paper/test/scissor"
resize_images(image_dir_path)

# print("๊ฐ€์œ„ ์ด๋ฏธ์ง€ resize ์™„๋ฃŒ!")

image_dir_path = os.getenv("HOME") + "/aiffel/rock_scissor_paper/test/rock"
resize_images(image_dir_path)

# print("๋ฐ”์œ„ ์ด๋ฏธ์ง€ resize ์™„๋ฃŒ!")


image_dir_path = os.getenv("HOME") + "/aiffel/rock_scissor_paper/test/paper"
resize_images(image_dir_path)

# print("๋ณด ์ด๋ฏธ์ง€ resize ์™„๋ฃŒ!")


def load_data(img_path, number_of_data=300):  # ๊ฐ€์œ„๋ฐ”์œ„๋ณด ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜ ์ดํ•ฉ์— ์ฃผ์˜ํ•˜์„ธ์š”.
    # ๊ฐ€์œ„ : 0, ๋ฐ”์œ„ : 1, ๋ณด : 2
    img_size=28                               # ์ด๋ฏธ์ง€ ์‚ฌ์ด์ฆˆ 28
    color=3
    #์ด๋ฏธ์ง€ ๋ฐ์ดํ„ฐ์™€ ๋ผ๋ฒจ(๊ฐ€์œ„ : 0, ๋ฐ”์œ„ : 1, ๋ณด : 2) ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ด์„ ํ–‰๋ ฌ(matrix) ์˜์—ญ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
    imgs=np.zeros(number_of_data*img_size*img_size*color,dtype=np.int32).reshape(number_of_data,img_size,img_size,color)
    labels=np.zeros(number_of_data,dtype=np.int32)

    idx=0
    for file in glob.iglob(img_path+'/scissor/*.jpg'):
        img = np.array(Image.open(file),dtype=np.int32)
        imgs[idx,:,:,:]=img    # ๋ฐ์ดํ„ฐ ์˜์—ญ์— ์ด๋ฏธ์ง€ ํ–‰๋ ฌ์„ ๋ณต์‚ฌ
        labels[idx]=0   # ๊ฐ€์œ„ : 0
        idx=idx+1

    for file in glob.iglob(img_path+'/rock/*.jpg'):
        img = np.array(Image.open(file),dtype=np.int32)
        imgs[idx,:,:,:]=img    # ๋ฐ์ดํ„ฐ ์˜์—ญ์— ์ด๋ฏธ์ง€ ํ–‰๋ ฌ์„ ๋ณต์‚ฌ
        labels[idx]=1   # ๋ฐ”์œ„ : 1
        idx=idx+1  
    
    for file in glob.iglob(img_path+'/paper/*.jpg'):
        img = np.array(Image.open(file),dtype=np.int32)
        imgs[idx,:,:,:]=img    # ๋ฐ์ดํ„ฐ ์˜์—ญ์— ์ด๋ฏธ์ง€ ํ–‰๋ ฌ์„ ๋ณต์‚ฌ
        labels[idx]=2   # ๋ณด : 2
        idx=idx+1
        
#    print("์‹œํ—˜๋ฐ์ดํ„ฐ(x_test)์˜ ์ด๋ฏธ์ง€ ๊ฐœ์ˆ˜๋Š”", idx,"์ž…๋‹ˆ๋‹ค.")
    return imgs, labels

image_dir_path = os.getenv("HOME") + "/aiffel/rock_scissor_paper/test"
(x_test, y_test)=load_data(image_dir_path)
x_test_norm = x_test/255.0   # ์ž…๋ ฅ์€ 0~1 ์‚ฌ์ด์˜ ๊ฐ’์œผ๋กœ ์ •๊ทœํ™”

# print("x_test shape: {}".format(x_test.shape))
# print("y_test shape: {}".format(y_test.shape))


################################################

test_loss, test_accuracy = model.evaluate(x_test, y_test, verbose=1)
print("test_loss: {} ".format(test_loss))
print("test_accuracy: {}".format(test_accuracy))

10/10 [==============================] - 0s 2ms/step - loss: 997.1900 - accuracy: 0.6500
test_loss: 997.1900024414062 
test_accuracy: 0.6499999761581421

Exploration 01 ํ‰๊ฐ€



๊ฒฐ๊ณผ์ •๋ฆฌ


  • ์ตœ์ดˆ : Accuracy๋Š” 30%์ •๋„๋กœ ๋‚˜์™”๋‹ค.
    • Dense, Epoch, Conv2D ๋“ฑ ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ์˜ ๊ฐ’ ๋ณ€๊ฒฝ์„ ํ†ตํ•ด Accuracy๋ฅผ ๋†’์ž„
  • ์ค‘๊ฐ„ : Accuracy 40% ์ •๋„
    • ์ด๋ฏธ์ง€ ํ•ด์ƒ๋„๋ฅผ 150์œผ๋กœ ๋ณ€๊ฒฝ
  • ์ตœ์ข… : Accuracy๋Š” 60% ์ •๋„
    - ์ฝ”๋“œํ™•์ธ์„ ์œ„ํ•ด ์žฌ์‹คํ–‰ํ•  ์ˆ˜๋ก Accuracy๊ฐ€ ๋–จ์–ด์ง
    - ํ”ผ๋“œ๋ฐฑ : Accuracy๋Š” 40% ์ •๋„




์ •ํ™•๋„ ๋ถ€๋ถ„



Dense, Epoch, Conv2D ๋“ฑ ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ์˜ ๊ฐ’ ๋ณ€๊ฒฝํ•˜์˜€์œผ๋‚˜ ์•„๋ฌด๋ฆฌ ๋†’๊ฒŒ ๋‚˜์™€๋„ 40%๋ฅผ ๋„˜์ง€ ๋ชปํ•˜๋Š” ๊ฒƒ์œผ๋กœ ๋‚˜์™”๋‹ค.
๋จผ์ € ์ฝ˜๋ณผ๋ฃจ์…˜ ๋ ˆ์ด์–ด์˜ ๊ฐ’์„ 32 64๋กœ ์กฐ์ •ํ•˜์˜€์œผ๋‚˜ ์ •ํ™•๋„๊ฐ€ ์˜คํžˆ๋ ค ๋–จ์–ด์ง€๋Š” ํ˜„์ƒ์ด ๋‚˜ํƒ€๋‚ฌ๋‹ค.


๊ฐ’์„ 16, 32๋กœ ๋‹ค์‹œ ์ˆ˜์ •ํ•˜๊ณ  Epoch๊ฐ’์„ ๋ณ€๊ฒฝํ•˜์˜€์„ ๋•Œ ์ •ํ™•๋„์˜ ๋ณ€ํ™”๊ฐ€ ์ƒ๊ฒผ๋‹ค.
์ตœ๋Œ€ 40ํšŒ๊นŒ์ง€ ๋ณ€๊ฒฝํ•˜์˜€์œผ๋‚˜ 20์ •๋„์—์„œ ๊ฐ€์žฅ ๋†’์€ ๊ฐ’์ด ๋‚˜์™”์œผ๋‚˜ 40%๋ฅผ ๋„˜์ง€ ๋ชปํ•˜๊ณ  Epoch ๊ฐ’์„ ๋” ์˜ฌ๋ฆด์ˆ˜๋ก ์˜คํžˆ๋ ค ๋–จ์–ด์ง€๋Š” ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜ํƒ€๋‚ฌ๋‹ค.

์ด๋Ÿฐํ•œ ๊ฒฐ๊ณผ๋ฅผ ํ†ตํ•ด ์ง€๋‚˜์นœ ํ•™์Šต๋Ÿ‰๊ณผ ์ดˆ๊ธฐ ๊ฐ’์„ ๋งŽ์ด ์ฃผ์—ˆ์„๋•Œ ์˜คํผํ”ผํŒ…์ด ๋‚˜ํƒ€๋‚œ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ์ˆ˜ ์žˆ์—ˆ๋‹ค.

์ฝ˜๋ณผ๋ฃจ์…˜ ๋ ˆ์ด์–ด ์ˆ˜์น˜๋ฅผ ๋‚ฎ๊ฒŒ ํ•จ์œผ๋กœ ์˜ค๋ฒ„ํ”ผํŒ…์„ ์ค„์ผ ์ˆ˜ ์žˆ์—ˆ์œผ๋ฉฐ. Epoch ์—ญ์‹œ ์ง€๋‚˜์น˜๊ฒŒ ์‹ค์‹œํ•˜๋ฉด ์˜ค๋ฒ„ํ”ผํŒ…์ด ๋‚˜ํƒ€๋‚˜๋Š” ๊ฒƒ์œผ๋กœ ๋ณด์ธ๋‹ค. ์ด์ƒ์˜ ์ƒํ™ฉ์œผ๋กœ ์ •ํ™•๋„๋ฅผ ๋†’์ด๊ธฐ ์œ„ํ•ด ์ด๋ฏธ์ง€ ์‚ฌ์ด์ฆˆ๋ฅผ 28์—์„œ 150์œผ๋กœ ๋†’์˜€์„ ๋•Œ ์ •ํ™•๋„๊ฐ€ ํฌ๊ฒŒ ์ƒ์Šนํ•˜๋Š” ๊ฒฐ๊ณผ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์—ˆ๋‹ค.


28 ์‚ฌ์ด์ฆˆ ์ผ๋•Œ ํ•™์Šต์šฉ ๋ฐ์ดํ„ฐ์™€ ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ๋ฅผ ํ™•์ธํ•ด๋ณด๋ฉด ์‚ฌ๋žŒ์ธ ๋‚ด๊ฐ€ ๋ด๋„ ์•Œ์•„๋ณด๊ธฐ ์–ด๋ ค์šธ ์ •๋„๋กœ ์ด๋ฏธ์ง€๊ฐ€ ๋ญ‰๊ฐœ์ง€๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ์—ˆ๋‹ค.
๋˜ํ•œ ๋ฐฐ๊ฒฝ์˜ ์ƒ‰์ƒ๊ณผ ๊ตฌ๋ถ„์ด ์–ด๋ ค์› ์œผ๋ฉฐ ์ด๊ฒƒ์ด ์ •ํ™•๋„๋ฅผ ๋–จ์–ด๋œจ๋ฆฌ๋Š” ๊ฒฐ๊ณผ๋ฅผ ๋‚ณ์ง€ ์•Š์•˜๋‚˜ ์ถ”์ธก๋œ๋‹ค.


์ด๋Ÿฌํ•œ ์ƒ๊ฐ์— ๋”ฐ๋ผ ์ด๋ฏธ์ง€์˜ ํ•ด์ƒ๋„๋ฅผ ๋†’์ด๋Š” ๊ฒฐ์ •์„ ํ•˜์˜€์œผ๋ฉฐ ๊ฒฐ๊ณผ๋Š” ๋งŒ์กฑํ• ๋งŒํ•œ ์ˆ˜์ค€์€ ์•„๋‹ˆ์—ˆ์œผ๋‚˜ ์ •ํ™•๋„์˜ ํ–ฅ์ƒ์ด ์žˆ์—ˆ๋‹ค.


์ด๋Ÿฌํ•œ ๊ฒฐ๊ณผ๋กœ ๋ณผ๋•Œ ๋ฐ์ดํ„ฐ์˜ ํ’ˆ์งˆ์ด ํ•™์Šต์— ํฐ ์˜ํ–ฅ์„ ๋ผ์นœ๋‹ค๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค.
์ด๋ฏธ์ง€ ๋ฐ์ดํ„ฐ๋ฅผ ์ถ”์ถœํ•˜๊ฑฐ๋‚˜ ์ƒ์„ฑํ•  ๋•Œ ๋ฐฐ๊ฒฝ์„ ๋‹จ์ƒ‰์œผ๋กœ ์กฐ์ •ํ•˜๊ณ  ๋Œ€์ƒ์ฒด์˜ ์ปจํŠธ๋ผ์ŠคํŠธ๋ฅผ ๋†’์ด๋ฉด ๋งŒ์กฑํ• ๋งŒํ•œ ์ •ํ™•๋„๊ฐ€ ๋‚˜์˜ค์ง€ ์•Š์„๊นŒ ์ถ”์ธก๋œ๋‹ค.

์ง€๋„ํ•™์Šต์˜ ๊ฒฝ์šฐ ํŠนํžˆ ํ›ˆ๋ จ๋ฐ์ดํ„ฐ์™€ ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ์˜ ํ’ˆ์งˆ์„ ์‹ ๊ฒฝ์“ธ ํ•„์š”๊ฐ€ ์žˆ์„ ๊ฒƒ ๊ฐ™๋‹ค.





์ฝ”๋”ฉ๋ถ€๋ถ„



ํด๋ž˜์Šค์— ๋Œ€ํ•œ ํ•™์Šต์ด ๋ถ€์กฑํ•˜๋‹ค๋Š” ๊ฒƒ์„ ๊นจ๋‹ฌ์•˜๋‹ค.
์ฝ”๋“œ๋ฅผ ๋ณด๋ฉด ๋ฐ˜๋ณต๋œ ํ•จ์ˆ˜์˜ ์‚ฌ์šฉ์ด ๋งŽ์€ ๋ฐ ์ด๋Ÿฌํ•œ ๋ถ€์ค€์„ ํด๋ž˜์Šค๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์ฝ”๋“œ์˜ ์–‘์„ ์ค„์ผ ์ˆ˜ ์žˆ์„ ๊ฑฐ๋ผ ์ƒ๊ฐํ•˜์˜€์œผ๋‚˜ ํด๋ž˜์Šค๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์‚ฌ์šฉํ•  ๋•Œ๋งˆ๋‹ค ๋ชจ๋“ˆ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์—ฌ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์–ด๋ ค์›€์„ ๊ฒช์—ˆ๋‹ค.

์ฝ”๋“œ๊ฐ€ ๊ต‰์žฅํžˆ ๊ธดํŽธ์ธ๋ฐ ํด๋ž˜์Šค๋งŒ ์ œ๋Œ€๋กœ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด ์ฝ”๋“œ์˜ ๊ธธ์ด๋ฅผ ๋ฐ˜ ์ดํ•˜๋กœ ์ค„์ผ ์ˆ˜ ์žˆ์ง€ ์•Š์„ ๊นŒ ์ƒ๊ฐ๋œ๋‹ค.
์ฝ”๋“œ๊ฐ€ ๊ธธ๊ฒŒ ๋‚˜์˜จ ์ด์œ  ์ค‘ ํ•˜๋‚˜๋กœ ์ค‘๊ฐ„ ์ค‘๊ฐ„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์„๊นŒ ์ƒ๊ฐ๋˜์–ด ์ค‘๊ฐ„ ๊ฒฐ๊ณผ๊ฐ’์„ ํ”„๋ฆฐํŠธํ•ด์ฃผ๊ณ  ํ™•์ธํ•˜๋ฉด์„œ ์ง„ํ–‰ํ•œ ๊ฒƒ ๋•Œ๋ฌธ๋„ ์žˆ๋‹ค.
ํด๋ž˜์Šค ๊ธฐ๋Šฅ๊ณผ ํด๋ž˜์Šค ์ƒ์† for๋ฌธ์„ ํšจ๊ณผ์ ์œผ๋กœ ์‚ฌ์šฉํ•˜๋ฉด ์ฝ”๋“œ์˜ ๊ธธ์ด๋ฅผ ์ค„์ผ ์ˆ˜ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•œ๋‹ค.

์•ž์œผ๋กœ ์ง„ํ–‰ํ•˜๋ฉด์„œ ์ด ๋ถ€๋ถ„์„ ๋ณด์™„ํ•ด์•ผ ํ•  ๊ฒƒ์ด๋‹ค.





๊ถ๊ธˆํ•œ ์ 

์ด๋ฏธ์ง€ ํ•ด์ƒ๋„๋ฅผ 150์œผ๋กœ ๋†’์—ฌ ์ •ํ™•๋„๊ฐ€ ์˜ฌ๋ผ๊ฐ”๋Š”๋ฐ
์ฝ”๋“œ๋ฅผ ์žฌ์‹คํ–‰ํ• ์ˆ˜๋ก ์ •ํ™•๋„๊ฐ€ ๋–จ์–ด์ง€๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒ๋˜์—ˆ๋‹ค.
1. ์ฒ˜์Œ ์ •ํ™•๋„๋Š” 61%์ •๋„ ๋‚˜์™”๋Š”๋ฐ ์ฝ”๋“œ๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด
์žฌ์‹คํ–‰ํ•˜๋Š” ๊ณผ์ •์—์„œ Accuracy๊ฐ€ ๋–จ์–ด์ง€๋Š” ํ˜„์ƒ์ด ๋‚˜ํƒ€๋‚˜๊ณ  40%๋Œ€์— ์ˆ˜๋ ดํ•จ.
โ†’ ์ด๊ฑด ๋„๋Œ€์ฒด ์ด์œ ๋ฅผ ๋ชจ๋ฅด๊ฒ ์Œ.



2.์ฃผํ”ผํ„ฐ ๋…ธํŠธ๋ถ ๋‚ด์—์„œ ์žฌ์‹คํ–‰ํ•˜๋Š” ๊ฒƒ์ด ์ธ๊ณต์ง€๋Šฅ ํ•™์Šต์— ์˜ํ–ฅ์„ ์ฃผ๋Š” ์ง€.



3.์ฝ”๋“œ ๊ธธ์ด๋ฅผ ์ค„์ด๊ธฐ ์œ„ํ•ด ํด๋ž˜์Šค๋ฅผ ์žฌํ˜ธ์ถœํ•˜๋Š” ๊ณผ์ •์—์„œ ์•Œ์ˆ˜์—†๋Š” ์—๋Ÿฌ๊ฐ€ ๋‚˜ํƒ€๋‚˜๋Š” ํ˜„์ƒ.

  • ์ด๊ฑฐ ํ”ผ๋“œ๋ฐฑ ์ฃผ์‹œ๋‚˜์š”? ใ… ใ… 

์ถ”๊ฐ€ ์„ค์ • ๋ณ€๊ฒฝ
1. Train ๋ฐ์ดํ„ฐ๋ฅผ 1500์žฅ์œผ๋กœ ๋Š˜๋ฆฌ๊ณ  ํ•ด์ƒ๋„๋ฅผ ๋‚ฎ์ถ”๋Š” ๊ฒƒ์œผ๋กœ ๋” ๋†’์€ ์ •ํ™•๋„๋ฅผ ์–ป๊ฒŒ ๋˜์—ˆ๋‹ค.

์™œ์ง€???
์ด๋ฏธ์ง€ ํ•ด์ƒ๋„ ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ๋Š”๋ฐ
์ด๋ฏธ์ง€ ํ•ด์ƒ๋„๋ฅผ ๋‚ฎ์ถ”์—ˆ์„ ๋•Œ ์˜คํžˆ๋ ค ์ •ํ™•๋„๊ฐ€ ์˜ฌ๋ผ๊ฐ€๋Š” ์ƒํ™ฉ์ด ๋œ ๊ฒƒ์€...
์ด๋ฏธ์ง€ ํ•ด์ƒ๋„๋ฅผ ๋‚ฎ์ถค์œผ๋กœ ์˜คํžˆ๋ ค ์˜ค๋ฒ„ํ”ผํŒ…์„ ๋ง‰๋Š” ํšจ๊ณผ๊ฐ€ ๋‚˜์™”๋‹ค๊ณ  ๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™๋‹ค.
๋‹จ์ˆœํ•˜๊ฒŒ ํ•ด์ƒ๋„๋ฅผ ๋†’์ธ๋‹ค๊ณ  ํ•ด์„œ ๋‚˜์•„์ง€๋Š” ๊ฒƒ์€ ์•„๋‹ˆ๊ณ 
๋‹ค๋ฅธ ๊ฐ’์„ ์กฐ์ •ํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค Epoch๋ฅผ ์กฐ์ •ํ•˜๋Š” ๊ฒƒ์ด ๊ฐ€์žฅ ์ •ํ™•๋„๋ฅผ ๋†’์ด๋Š” ๋ฐ ๋” ๋‚˜์€ ๊ฒƒ์œผ๋กœ ๋ณด์ธ๋‹ค.

profile
๋งˆ์ผ€ํŒ…์„ ์œ„ํ•œ ์ธ๊ณต์ง€๋Šฅ ์„ค๊ณ„์™€ ์Šคํƒ€ํŠธ์—… Log

0๊ฐœ์˜ ๋Œ“๊ธ€