Disease Orange Dataset Classification
ยท
Artificial_Intelligence๐Ÿค–/Computer Vision
์ด์ „์— ๋งŒ๋“ค์—ˆ๋˜ ๋ถ„๋ฅ˜ ๋ชจ๋ธ ์ œ์ž‘ ์ž๋ฃŒ์ž…๋‹ˆ๋‹ค.
Neural Style Transfer - Project
ยท
Artificial_Intelligence๐Ÿค–/Computer Vision
2021.10.07 - [Hi/Artificial_Intelligence] - Neural Style Transfer Neural Style Transfer What is NST? Style transfer๋ž€, ๋‘ ์˜์ƒ(content image & style image)์ด ์ฃผ์–ด์กŒ์„ ๋•Œ ๊ทธ ์ด๋ฏธ์ง€์˜ ์ฃผ๋œ ํ˜•ํƒœ๋Š” content image์™€ ์œ ์‚ฌํ•˜๊ฒŒ ์œ ์ง€ํ•˜๋ฉด์„œ ์Šคํƒ€์ผ๋งŒ ์šฐ๋ฆฌ๊ฐ€ ์›ํ•˜๋Š” style image์™€ ์œ ์‚ฌํ•˜๊ฒŒ ๋ฐ”๊พธ๋Š” ๊ฒƒ.. forbetterdays.tistory.com ๊ธฐ์กด์˜ NST ๋ชจ๋ธ ๊ณต๋ถ€์—์„œ ํ•œ๋‹จ๊ณ„ ๋” ๊นŠ๊ฒŒ ํ•˜์—ฌ ํ”„๋กœ์ ํŠธ์— ์‚ฌ์šฉํ•˜์˜€์Šต๋‹ˆ๋‹ค. What is NST (Neural Style Transfer)? - Style transfer๋ž€, ๋‘ ์˜์ƒ(content image & style image)์ด..
Neural Style Transfer
ยท
Artificial_Intelligence๐Ÿค–/Computer Vision
What is NST? Style transfer๋ž€, ๋‘ ์˜์ƒ(content image & style image)์ด ์ฃผ์–ด์กŒ์„ ๋•Œ ๊ทธ ์ด๋ฏธ์ง€์˜ ์ฃผ๋œ ํ˜•ํƒœ๋Š” content image์™€ ์œ ์‚ฌํ•˜๊ฒŒ ์œ ์ง€ํ•˜๋ฉด์„œ ์Šคํƒ€์ผ๋งŒ ์šฐ๋ฆฌ๊ฐ€ ์›ํ•˜๋Š” style image์™€ ์œ ์‚ฌํ•˜๊ฒŒ ๋ฐ”๊พธ๋Š” ๊ฒƒ์„ ๋งํ•จ. Style transfer refers to changing only the style to the style image we want while keeping the main form of the image similar to the content image when two images are given. Style Transfer, image-to-image translation, ๋˜๋Š” texture transfer ๋“ฑ์œผ๋กœ ๋ถˆ๋ฆฌ๋Š”..
DCGAN(Deep Convolutional Generative Adversarial Networks)
ยท
Artificial_Intelligence๐Ÿค–/Computer Vision
- ๊ธฐ์กด์˜ GAN ๊ธฐ์กด์˜ GAN๊ณผ ๊ฐ™์€ ์ƒ์„ฑ๋ชจ๋ธ์€ ๋ ˆ์ด์–ด๋ฅผ Dense์ธต์œผ๋กœ ์—ฐ์†ํ•ด์„œ ์Œ“์•„์„œ ๊ฐ„๋‹จํ•˜๊ฒŒ Fully-connected๋กœ ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๊ณ , ์ƒ์„ฑ์ž๋Š” ๊ณ„์†ํ•ด์„œ ๋žœ๋ค ๋…ธ์ด์ฆˆ๊ฐ’์„ ๋ณ€ํ™˜ํ•ด ์ด๋ฅผ ํŒ๋ณ„์ž ๋ชจ๋ธ์—๊ฒŒ ๋„˜๊ธฐ๊ณ , ํŒ๋ณ„์ž๋Š” ์ง„์งœ์ธ์ง€ ๊ฐ€์งœ์ธ์ง€ ํŒ๋ณ„ํ•˜์—ฌ ์—ฌ๊ธฐ์„œ ๋‚˜์˜ค๋Š” loss๊ฐ’์œผ๋กœ ํ•™์Šตํ•˜์—ฌ ๋งŒ๋“œ๋Š” ๊ณผ์ •. - What is DCGAN(Deep Convolutional Generative Adversarial Networks) DCGAN์€ Fully-connected ๊ตฌ์กฐ์˜ ๋Œ€๋ถ€๋ถ„์„ CNN ๊ตฌ์กฐ๋กœ ๋ฐ”๊พผ Deep Convolution GAN. ๋žœ๋ค ๋…ธ์ด์ฆˆ ๊ฐ’์„ ๋„ฃ์–ด ๋ฐฐ์น˜๋…ธ๋ฉ€๋ผ์ด์ฆˆํ•˜๋ฉด์„œ ์—…์ƒ˜ํ”Œ๋ง๊ณผ ์ปจ๋ณผ๋ฃจ์…˜์„ํ•˜๊ณ , Discriminator์—์„œ๋Š” ์ปจ๋ณผ๋ฃจ์…˜ ํ•˜๋ฉด์„œ, ๊ธฐ์กด์˜ GAN๊ณผ ๊ฐ™์ด ๋งˆ์ง€๋ง‰ ์ถœ๋ ฅ์ธต์— Flatten..
depthwise separable convolution(๊นŠ์ด๋ณ„ ๋ถ„๋ฆฌ ํ•ฉ์„ฑ๊ณฑ)
ยท
Artificial_Intelligence๐Ÿค–/Computer Vision
SeparableConv2D ์ž…๋ ฅ ์ฑ„๋„๋ณ„๋กœ ๋”ฐ๋กœ๋”ฐ๋กœ ๊ณต๊ฐ„ ๋ฐฉํ–ฅ์˜ ํ•ฉ์„ฑ๊ณฑ ์ˆ˜ํ–‰ ํ›„, 1*1 ํ•ฉ์„ฑ๊ณฑ (์ ๋ณ„ ํ•ฉ์„ฑ๊ณฑ)์œผ๋กœ ์ถœ๋ ฅ ์ฑ„๋„์„ ํ•ฉ์น˜๋Š” ๊ฒƒ. ์ด๋กœ ์ธํ•ด ๊ณต๊ฐ„ ํŠน์„ฑ์˜ ํ•™์Šต๊ณผ ์ฑ„๋„ ๋ฐฉํ–ฅ ํŠน์„ฑ์˜ ํ•™์Šต์„ ๋ถ„๋ฆฌํ•˜๋Š” ํšจ๊ณผ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Œ. ๋ชจ๋ธ ํŒŒ๋ผ๋ฏธํ„ฐ์™€ ์—ฐ์‚ฐ์˜ ์ˆ˜๋ฅผ ํฌ๊ฒŒ ์ค„์—ฌ์ฃผ์–ด ๋” ์ž‘๊ณ  ๋น ๋ฅธ ๋ชจ๋ธ์„ ์ œ์ž‘ํ•  ์ˆ˜ ์žˆ์Œ. ์—ฌ๊ธฐ์„œ 1 * 1 ํ•ฉ์„ฑ๊ณฑ์ด๋ž€, 1 * 1 ํฌ๊ธฐ์˜ Convolution Filter ์‚ฌ์šฉํ•œ Convolution Layer๋ฅผ ๋งํ•˜๋Š”๋ฐ, Channel / Spatial์˜ ํŠน์„ฑํŒŒ์•…์— ๋„์›€์ด ๋œ๋‹ค. ์ด๋ ‡๊ฒŒ 1*1 ํ•ฉ์„ฑ๊ณฑ์„ ์“ฐ๋ฉด ํŒŒ๋ผ๋ฏธํ„ฐ ์ˆ˜๊ฐ€ ํ™•์—ฐํžˆ ์ค„๊ฒŒ ๋œ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ ํ•ฉ์„ฑ๊ณฑ์—์„œ channel์„ ํฌ๊ฒŒ ์ฃผ๋ฉด ํŒŒ๋ผ๋ฏธํ„ฐ ์ˆ˜๊ฐ€ ๊ธ‰๊ฒฉํžˆ ์ฆ๊ฐ€ํ•˜๋Š”๋ฐ, 1*1 ํ•ฉ์„ฑ๊ณฑ์„ ์‚ฌ์šฉํ•˜๋ฉด ํšจ์œจ์ ์œผ๋กœ ๋ชจ๋ธ์„ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์Œ. ์ฆ‰..
[CNN] HeatMap
ยท
Artificial_Intelligence๐Ÿค–/Computer Vision
์ €์žฅ๋œ CNN ๋ชจ๋ธ์„ ๊ฐ€์ ธ์™€์„œ ์ด๋ฅผ ์‚ฌ์šฉํ•ด ์ด๋ฏธ์ง€์˜ ํ•„ํ„ฐ๋ฅผ ๋จผ์ € ์‹œ๊ฐํ™” ํ•ด๋ณด์•˜๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ณ ์–‘์ด์‚ฌ์ง„์„ ํ•˜๋‚˜ ๊ฐ€์ ธ์™€์„œ ์ด๋ฅผ ์ „์ฒ˜๋ฆฌํ•˜์—ฌ ์ถœ๋ ฅํ•˜์˜€๋‹ค. img_path = './dogs-vs-cats/small/test_dir/test_cats_dir/cat.1700.jpg' from keras.preprocessing import image import numpy as np img = image.load_img(img_path, target_size=(150, 150)) img_tensor = image.img_to_array(img) img_tensor = np.expand_dims(img_tensor, axis=0) # ๋ชจ๋ธ์ด ํ›ˆ๋ จ๋  ๋•Œ ์ž…๋ ฅ์— ์ ์šฉํ•œ ์ „์ฒ˜๋ฆฌ ๋ฐฉ์‹์„ ๋™์ผํ•˜๊ฒŒ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค img_tensor ..
[CNN] Dogs vs Cats
ยท
Artificial_Intelligence๐Ÿค–/Computer Vision
์บ๊ธ€(Kaggle)์—์„œ ๋ฐ์ดํ„ฐ์…‹์„ ์ „๋ถ€ ๋‹ค์šด๋ฐ›๊ณ , smallํด๋”๋ฅผ ๋งŒ๋“ค์–ด์„œ train data, validation data, test data๋ฅผ ๊ฐ•์•„์ง€์™€ ๊ณ ์–‘์ด ๊ฐ๊ฐ 1000์žฅ, 500์žฅ, 500์žฅ์„ ๋ถ„๋ฆฌํ•ด ์ด 4์ฒœ์žฅ์— ์‚ฌ์ง„ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ง€๊ณ  ์‹ค์Šต์„ ํ•˜์˜€๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๊ฐ€์ ธ์˜จ ์‚ฌ์ง„ ๋ฐ์ดํ„ฐ๋“ค์„ ๋„คํŠธ์›Œํฌ์— ๋„ฃ๊ธฐ ์œ„ํ•ด ๋ถ€๋™ ์†Œ์ˆ˜ ํƒ€์ž…์˜ ํ…์„œ๋กœ ์ „์ฒ˜๋ฆฌ ํ•œ๋‹ค. ์ผ€๋ผ์Šค์—์„œ ์ œ๊ณต๋˜๋Š” ImageDataGenerator์€ ์ด๋ฏธ์ง€ ํŒŒ์ผ์„ ์ „์ฒ˜๋ฆฌ๋œ ๋ฐฐ์น˜ ํ…์„œ๋กœ ๋ฐ”๊พธ์–ด์ฃผ๋Š” ์ œ๋„ˆ๋ ˆ์ดํ„ฐ๋ฅผ ๋งŒ๋“œ๋Š” ํด๋ž˜์Šค์ด๋‹ค. ์ฆ‰, ์‚ฌ์ง„ ํŒŒ์ผ์„ ์ฝ๊ณ , ํƒ€์ž…์„ RGB ํ”ฝ์…€ ๊ฐ’์œผ๋กœ ๋””์ฝ”๋”ฉํ•˜๊ณ , ๋ถ€๋™ ์†Œ์ˆ˜ํƒ€์ž…์˜ ํ…์„œ๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ํ”ฝ์…€๊ฐ’์˜ ์Šค์ผ€์ผ์„ 0~255์—์„œ 0~1๋กœ ์กฐ์ •ํ•˜๋Š” ๊ณผ์ •์„ ์‰ฝ๊ฒŒ ๋งŒ๋“ค์–ด์ฃผ๋Š” ๋ช…๋ น์–ด์ด๋‹ค. ๋ชจ๋“ ์ด๋ฏธ์ง€๋ฅผ floatํ˜•์œผ๋กœ 255๋กœ ๋‚˜๋ˆ„์–ด ..
[GAN] ์ ๋Œ€์  ์ƒ์„ฑ ์‹ ๊ฒฝ๋ง <์ˆซ์ž์ƒ์„ฑAI> ์ œ์ž‘
ยท
Artificial_Intelligence๐Ÿค–/Computer Vision
์ˆซ์ž ์ƒ์„ฑ ์ธ๊ณต์ง€๋Šฅ ์›๋ฆฌ ์ƒ์„ฑ ์‹ ๊ฒฝ๋ง ์ค‘ GAN์„ ์ด์šฉํ•จ. GAN (Generative Adversarial Network) ์ ๋Œ€์  ์ƒ์„ฑ ์‹ ๊ฒฝ๋ง. 2๊ฐœ์˜ ์‹ ๊ฒฝ๋ง์œผ๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ์Œ. ํŒ๋ณ„์ž ์‹ ๊ฒฝ๋ง๊ณผ ์ƒ์„ฑ์ž ์‹ ๊ฒฝ๋ง. ์ƒ์„ฑ์ž๋Š” ์ง„์งœ๊ฐ™์€ ๊ฐ€์งœ๋ฅผ ์ƒ์„ฑํ•จ. ํŒ๋ณ„์ž๋Š” ์ง„์งœ๊ทธ๋ฆผ๊ณผ ์ƒ์„ฑ์ž๊ฐ€ ๋งŒ๋“  ๊ฐ€์งœ ๊ทธ๋ฆผ์„ ๊ตฌ๋ณ„ ๊ฐ€๋Šฅ. ๋‘ ์‹ ๊ฒฝ๋ง์€ ๋ชฉํ‘œ๊ฐ€ ์žˆ์Œ. ์ƒ์„ฑ์ž : ํŒ๋ณ„์ž๊ฐ€ ์ž์‹ ์ด ๋งŒ๋“  ๊ทธ๋ฆผ์„ ์ง„์งœ์ฒ˜๋Ÿผ ์ƒ๊ฐํ•  ์ •๋„์˜ ๊ทธ๋ฆผ์„ ๊ทธ๋ฆผ. ํŒ๋ณ„์ž : ์ƒ์„ฑ์ž๊ฐ€ ๋งŒ๋“  ๊ทธ๋ฆผ์„ ์ง„์งœ์ธ์ง€ ๊ฐ€์งœ์ธ์ง€ ์ „๋ถ€ ๊ตฌ๋ณ„ํ•ด์•ผํ•จ. ์ด์ œ ๋‘ ์‹ ๊ฒฝ๋ง์€ ์„œ๋กœ ์ด๊ธฐ๊ธฐ ์œ„ํ•ด ํ•™์Šต์„ ์‹œ์ž‘ํ•จ. ์ด๋ ‡๊ฒŒ ๋‘ ๊ฐœ์˜ ์‹ ๊ฒฝ๋ง์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋Ÿฌํ•œ ์›๋ฆฌ๋กœ ์ƒ์„ฑํ•ด ๋‚ด๋Š” ๊ธฐ๋ฒ•์ด GAN(์ ๋Œ€์  ์ƒ์„ฑ ์‹ ๊ฒฝ๋ง)์ž„. ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ธํŒ… from keras.models import Model, Seque..
[TensorFlow] ์ˆซ์ž ์ธ์‹ AI ์ œ์ž‘ (2)
ยท
Artificial_Intelligence๐Ÿค–/Computer Vision
colab.research.google.com/drive/1vcBfl192NDGJ2_c2u01tAa65NGSJmrw8?usp=sharing Google Colaboratory colab.research.google.com ์›๋ฌธ์ž…๋‹ˆ๋‹ค. ์ฝ”๋žฉ์œผ๋กœ ๋ณด๋Š”๊ฑฐ ์ถ”์ฒœ. (์ด์ „๊ธ€) 2021/01/28 - [Hi/AI] - [TensorFlow] ์ˆซ์ž ์ธ์‹ AI ์ œ์ž‘ (1) # ๋ชจ๋ธ์„ค๊ณ„ 4๊ฐœ์˜ ์ธต์œผ๋กœ ๋งŒ๋“ค๊ฑฐ์ž„. ์ž…๋ ฅ์ธต, ์€๋‹‰์ธต, ์€๋‹‰์ธต, ์ถœ๋ ฅ์ธต ์ž…๋ ฅ์ธต ๋‰ด๋Ÿฐ์˜ ์ˆ˜๋Š” 28 * 28์ด๋‹ˆ 784์ž„. 28 * 28๊ฐœ์˜ ํ”ฝ์…€๋กœ ์ด๋ฃจ์–ด์ง„ ์ˆซ์ž๋ฅผ ํ•œ์ค„๋กœ ๋ฐ”๊พผ๊ฑฐ์ž„. ์ฒซ๋ฒˆ์งธ ์€๋‹‰์ธต์˜ ๋…ธ๋“œ ์ˆ˜๋Š” 512๊ฐœ, ๋‘๋ฒˆ์งธ ์€๋‹‰์ธต์˜ ๋…ธ๋“œ ์ˆ˜๋Š” 256๊ฐœ, ์„ธ๋ฒˆ์งธ ๊ฒฐ๊ณผ์ธต์˜ ๋…ธ๋“œ์ˆ˜๋Š” 10๊ฐœ๋กœ ์„ค์ •ํ•จ. (๋งˆ์ง€๋ง‰์€ 0~9์ด๋‹ˆ 10๊ฐœ) ํ™œ์„ฑํ™” ํ•จ์ˆ˜๋Š” ๋ ๋ฃจ(Re..
[TensorFlow] ์ˆซ์ž ์ธ์‹ AI ์ œ์ž‘ (1)
ยท
Artificial_Intelligence๐Ÿค–/Computer Vision
colab.research.google.com/drive/1vcBfl192NDGJ2_c2u01tAa65NGSJmrw8?usp=sharing Google Colaboratory colab.research.google.com ์›๋ฌธ์ž…๋‹ˆ๋‹ค. ์ฝ”๋žฉ์œผ๋กœ ๋ณด๋Š”๊ฑฐ ์ถ”์ฒœ. %tensorflow_version #ํ…์„œํ”Œ๋กœ์šฐ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜๋˜์–ด์žˆ๋Š”์ง€ ํ™•์ธ. import keras ์ผ€๋ผ์Šค๋Š” ํ…์„œํ”Œ๋กœ๋ฅผ ์ด์šฉํ•˜๊ธฐ ๋” ์‰ฝ๊ฒŒ๋งŒ๋“ค์–ด์ฃผ๋Š” ๋„๊ตฌ์ž„. ์‹ฌ์ธต ์‹ ๊ฒฝ๋ง์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•œ ํ…์„œํ”Œ๋กœ, ํ…Œ์•„๋…ธ, CNTK์™€ ๊ฐ™์€ ๋„๊ตฌ๋ฅผ ๋”์šฑ ์‰ฝ๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€์ฃผ๋Š” ๋„๊ตฌ์ž„. ๋”ฐ๋ผ์„œ ์ผ€๋ผ์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ๋จผ์ € ํ…์„œํ”Œ๋กœ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋ถˆ๋Ÿฌ์˜จ ์ƒํƒœ์—ฌ์•ผํ•จ. from tensorflow.keras.models import Sequential from tensorfl..
Liky
'Artificial_Intelligence๐Ÿค–/Computer Vision' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก