강아지, 고양이만 2개 분류하는 것보다
강아지, 고양이 + 닭, 소 ~ 10개 같이 분류하는 것에 문제점.
from tensorflow.keras import layers
from tensorflow.keras import models
model = models.Sequential()
model.add(layers.Conv2D(128, (3, 3), activation = 'relu', input_shape = (150, 150, 3)))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation = 'relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation = 'relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(128, (3, 3), activation = 'relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(128, (3, 3), activation = 'relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Flatten())
model.add(layers.Dense(512, activation = 'relu'))
model.add(layers.Dense(10, activation = 'softmax'))
#다중 (10개) 분류 tensor에서 흔히 나는 오류
graph execution error 파이썬 해결하는 법
model.add(layers.Dense(10, activation = 'softmax'))
★ Dense Layer 마지막에 10으로 바꿔줌.
위에 Model Define에서 특징을 뽑아내는 것은 똑같음.
결국 강아지-고양이 확인하는 것은 확인하는 방식은 똑같음.
tf.keras.applications.VGG16(
include_top=True, --> DNN은 안데리고 오겠다는 뜻.
weights="imagenet",
input_tensor=None,
input_shape=None,
pooling=None,
classes=1000,
classifier_activation="softmax",
)
conv_base = VGG16(weights = 'imagenet',
inclue_top = False,
input_shape = (150, 150, 3))
'코딩' 카테고리의 다른 글
DT Digital Transformation직무 (0) | 2023.02.07 |
---|---|
Recurrent Neural Network ; RNN (0) | 2023.02.02 |
Small Dataset (cf. Convolutional Neural Network) (0) | 2023.01.30 |
docker container commit 실습하기 (0) | 2023.01.27 |
mariadb 구성하기 (0) | 2023.01.27 |
댓글