2023/10/02 3

[Tensorflow] CNN만들기 - Functional API

tf.keras.Sequential() API보다 더 유연한 모델을 생성하는 방법. Sequential()과 다르게 여러 입출력 모델을 처리할 수 있음. + skip connection과 같은 연결도 처리가 가능 1. tf.keras.Input(shape=(128, 128, 3)) : input 노드 생성. input_img = tf.keras.Input(shape=input_shape) 2. model layer 구성하기 def convolution_model(input_shape): input_img = tf.keras.Input(shape=input_shape) output = tfl.Conv2D(filters=8, kernel_size=4, padding="same")(input_img) . . ..

기술 정보 2023.10.02

[Tensorflow] CNN만들기 - tf.keras.Sequential()

model = tf.keras.Sequential() model.add(tfl.Dense(8)) # add로 layer 추가 가능​ import tensorflow.keras.layers as tfl 1. tf.keras.Sequential() # layer by layer로 model 구축 가능. 하나의 input tensor와 하나의 output tensor가 있는 모델을 구축하는데 적합함. # 즉, straightforward에 적합함. # 여러 입력 또는 출력이 있는 layer를 포함하는 경우에는 Foundation API를 활용함. # Sequential model은 layer의 list라고 생각할 수 있음. # model.add(): layer 추가 / model.pop(): layer 제거 ..

기술 정보 2023.10.02

[Coursera] DLS_C4W1: Foundations of CNNs

1. Computer Vision 대표적인 Computer Vision 문제로는 Image Classification, Object Detection, Neural Style Transfer 등등이 있다. 이러한 문제들은 보통 큰 해상도의 이미지를 입력으로 활용한다. 지금까지 우리는 입력 이미지를 모두 flatten 해서 NN에 넣어주었다. 하지만 해상도가 큰 이미지에 fully connected layer를 활용한다면, 계산해야 하는 parameter의 수가 너무 많아서 computational cost가 매우 커지게 될 것이다. 2. Edge detection & Convolution 연산 또 하나의 Computer Vision task로는 edge detection이 있다. 위의 그림과 같이, 이미..

ML || DL/이론 2023.10.02