๐ง tensorflow ์ค์ต
๐ค tensorflow๋ก ์ ๊ฒฝ๋ง ๊ตฌ์กฐ๋ฅผ ๋ง๋๋ ๋ฐฉ๋ฒ
1. sequence API๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ
- Sequential()๋ฅผ ์ ์ธํ ์ดํ model.add()ํจ์๋ฅผ ์ ๋ ฅํ์ฌ ์ธต์ ์๋๋ค.
2. ํจ์ํ API๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ
- Sequential()๋ก tensorflow์ ์ต์ํด์ง ํ ์ฌ์ฉ์ ๊ถ์ฅํ๋ ๋ฐฉ๋ฒ
๐ค model ์ ์ฅ _ save() ํจ์
model.save('cnn_model_1.h5')
์์ ๊ฐ์ด save๋ฉ์๋๋ฅผ ์ด์ฉํด hdf5 ํ์ผ๋ก ์ ์ฅํ๋ค.
(hdf5ํ์ผ์ ๋์ฉ๋ ๋ฐ์ดํฐ ์ ์ฅ์ ์ํ ํ์ผ ํฌ๋งท์ด๋ค.)
๐ค model ๋ถ๋ฌ์ค๊ธฐ
from tensorflow.keras.models import load_model cnn_model_2 = load_model('cnn_model_1.h5')
์์ ๊ฐ์ด save๋ฉ์๋๋ฅผ ์ด์ฉํด hdf5 ํ์ผ๋ก ์ ์ฅํ๋ค.
(hdf5ํ์ผ์ ๋์ฉ๋ ๋ฐ์ดํฐ ์ ์ฅ์ ์ํ ํ์ผ ํฌ๋งท์ด๋ค.)
๐ง batch size / epoch / iteration ์ ์ฐจ์ด
๐ง batch size
- ์ ์ฒด training data๋ฅผ ์ฌ๋ฌ๊ฐ์ mini-batch๋ก ๋๋ด์ ๋, mini-batch์ ์ํ๋ data์ ๊ฐ์
- mini-batch๋ก ๋๋ ์ ํ์ต์๊ฐ์ ์ค์ด๊ณ ํจ์จ์ ์ผ๋ก ์์์ ํ์ฉํ ์ ์๊ฒ ๋๋ค.
๐ง epoch
- ์ ์ฒด training data๊ฐ ์ ๊ฒฝ๋ง์ ํต๊ณผํ ํ์
- 1 epoch์ ๋ชจ๋ data๊ฐ ์ ๊ฒฝ๋ง์ ํ๋ฒ ํต๊ณผํ๋ค๋ ๊ฒ์ ์๋ฏธ
๐ง iteration
- 1 epoch์ ๋ง์น๋๋ฐ ํ์ํ mini-batch ์
- weight parameter๋ mini-batch๋น ํ๋ฒ update๋ฅผ ํ๋ค.
∴ ํ๋ผ๋ฏธํฐ update ํ์ = iteration ํ์
'A.I > Deep Learning' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
self.DL.(03). CNN (Convolution Neural Network) (0) | 2023.01.18 |
---|---|
self.DL.(02-3). regression (ํ๊ท์ ๊ฒฝ๋ง)์ค์ต (0) | 2023.01.18 |
self.DL.(02-2). classification (๋ถ๋ฅ์ ๊ฒฝ๋ง)์ค์ต (0) | 2023.01.18 |
self.DL.(02). Artificial Neural Network. &. Deep Learning (0) | 2023.01.17 |
self.DL.(01). Perceptron (0) | 2023.01.17 |