[Kaggle ImageClassification] Image Training Trick
ยท
๐Ÿ‘พ Deep Learning
Image ํ•™์Šต ์‹œ Label ๋งˆ๋‹ค ๊ฐœ์ˆ˜๊ฐ€ ๋‹ค๋ฅด๋‹ค. Label์˜ ์ข…๋ฅ˜๊ฐ€ ๋งŽ๊ณ  ๊ฐœ์ˆ˜ ๋ถ„ํฌ๊ฐ€ ํ•œ์ชฝ์œผ๋กœ ์น˜์šฐ์ณ์ ธ์žˆ์„ ๊ฒฝ์šฐ Image๊ฐ€ ๋งŽ์€ Label๋กœ model์ด ํŒ๋‹จํ•˜๊ฒŒ ๋œ๋‹ค. *์ด ๊ฒฝ์šฐ ImageGenerator๋ฅผ ์ด์šฉํ•ด ๊ท ํ˜•์„ ๋งž์ถฐ์ค€๋‹ค. def balance(train_df, max_samples, min_samples, column, working_dir, image_size): train_df = tr_d train_df = train_df.copy() train_df = trim(train_df, max_samples, min_samples, column) if 'aug' not in os.listdir(): os.mkdir('aug') aug_dir = os.path.join(working_di..
[Adamax ์‚ฌ์šฉ์‹œ Error] ValueError: Could not interpret optimizer identifier: <keras.optimizer_v2.adam.Adam
ยท
๐Ÿ‘พ Deep Learning
Tensorflow 2.8 ๋ชจ๋“ˆ์—๋Ÿฌ *Optimizer ์ค‘ ๊ฐ€์žฅ ๋„๋ฆฌ์“ฐ์ด๋Š” Adam์˜ Update์‹œ ๋ฌดํ•œ๋Œ€๋กœ ๋ฐœ์‚ฐํ•˜๋Š” ๊ฒƒ์„ ์‰ฝ๊ฒŒ ๊ฐœ์„  ์‹œํ‚จ Adamax Sol) from tensorflow.python.keras.optimizers import adamax_v2 opt = adamax_v2.Adamax(learning_rate=0.001)
[Cudnn Error] Could not locate zlibwapi.dll. Please make sure it is in your library path!
ยท
๐Ÿ‘พ Deep Learning
C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.2\\bin์— zlibwapi.dll ํŒŒ์ผ ์—†์–ด์„œ ์ƒ๊ธฐ๋Š” ์˜ค๋ฅ˜์ด๋‹ค. [๋‹ค์šด๋กœ๋“œ] https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#install-zlib-windows์—์„œ ์œˆ๋„์šฐ ๋ฒ„์ „์˜ zlibwapi.dll์„ ์„ค์น˜ํ•˜๋ฉด ๋œ๋‹ค.
[Image Classification] Kaggle - Birds 400 Species ResNet(1)
ยท
๐Ÿ‘พ Deep Learning
https://arxiv.org/pdf/1512.03385.pdf ResNet์€ ๊ธฐ์กด์˜ ๋‹ค์ธต Layer์˜ ๋ฌธ์ œ์ ์ธ Gradien Vanishing(๊ฐ€์ค‘์น˜๊ฐ€ 0์œผ๋กœ ์ˆ˜๋ ด: ๊ธฐ์šธ๊ธฐ ์†Œ์‹ค)์„ ๊ฐœ์„ ํ•œ ๋ชจ๋ธ์ด๋‹ค. ๋‹ค์ธต Layer ํŠน์„ฑ์ƒ ๊ฐ€์ค‘์น˜๋ฅผ ๊ฐฑ์‹ ํ•˜๋ฉด์„œ ์›๋ž˜ ๊ฐ€์ง„ ๊ฐ’๊ณผ ๊ฐฑ์‹  ๋‹จ๊ณ„๊ฐ€ ๋งŽ์•„์ ธ ์›๋ž˜ ๊ฐ’์„ ์ž˜ ์ฐพ์•„๊ฐ€์ง€ ๋ชปํ•˜๋Š” ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธด๋‹ค. ResNet์—์„œ๋Š” ์ž”์ฐจ๋ฅผ ์ด์šฉํ•ด Layer์˜ ์ธต์„ ๋†’์ด ์Œ“์ง€ ์•Š์€ ๋ฐ˜๋ฉด Error๋Š” ์ค„์ด๋Š” ๋ฐฉ๋ฒ•์„ ๊ณ ์•ˆํ•ด๋ƒˆ๋‹ค.
[Image Classification] Kaggle - Birds 400 Species (0)
ยท
๐Ÿ‘พ Deep Learning
https://www.kaggle.com/datasets/gpiosenka/100-bird-species BIRDS 400 - SPECIES IMAGE CLASSIFICATION 58388Train, 2000 Test, 2000 Validation images 224X224X3 jpg format www.kaggle.com [Birds 400] Test Model List - Resnet - mobilevit
๋ฐ์ดํ„ฐ ์•„์นด๋ฐ๋ฏธ 8์ผ์ฐจ ์ˆ˜์—… ์ •๋ฆฌ
ยท
๐Ÿ‘พ Deep Learning
[8์ผ์ฐจ] 1. Deep Learning์˜ ๊ตฌ์กฐ ์†Œ๊ฐœ * Wn(Weight) : ํšŒ๊ท€ ๋ถ„์„์˜ ํšŒ๊ท€ ๊ณ„์ˆ˜์™€ ๋น„์Šทํ•œ ์—ญํ• ์„ ํ•œ๋‹ค. ํšŒ๊ท€ ๋ถ„์„์˜ ๋ชฉ์ ๊ณผ ๋™์ผ ํ•˜๊ฒŒ ๋ณ€์ˆ˜๋ฅผ ํ†ตํ•ด Output์„ ์ฐพ๋Š” ์‹์„ ๊ตฌํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค. 2. ๋‹ค์–‘ํ•œ Optimizer ์†Œ๊ฐœ * ๊ฒฝ์‚ฌํ•˜๊ฐ•๋ฒ•(Gradient descent) : - stochastic gradient descent : ๊ฐ’์„ ํ•˜๋‚˜ํ•˜๋‚˜ ๋„ฃ์–ด ๊ฐฑ์‹ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์‹œ๊ฐ„์ด ์˜ค๋ž˜๊ฑธ๋ฆฐ๋‹ค๋Š” ๋‹จ์ ์ด ์žˆ๋‹ค. - Batch gradient descent : Training set data์˜ ๊ฐ€์ค‘์น˜ ํ‰๊ท ์„ ์ด์šฉํ•˜์—ฌ ๊ฐฑ์‹  - Mini Batch : ์ผ๋ถ€ ํ›ˆ๋ จ์ž๋ฃŒ์˜ ๋ฌด์ž‘์œ„ ๋ณต์› ์ถ”์ถœํ•˜์—ฌ Training set data์˜ ๊ฐ€์ค‘์น˜ ํ‰๊ท ์„ ๊ฐฑ์‹  3. Learning rate๋ฅผ ์กฐ์ ˆํ•˜๋Š” ๋ฐฉ์‹ - ADAM..
[PyTorch] ๊ธฐ์กด ์ œ๊ณต model ๋ถˆ๋Ÿฌ์˜ค๊ธฐ
ยท
๐Ÿ‘พ Deep Learning
- torchvision.models๋ฅผ ํ†ตํ•ด model ๋ถˆ๋Ÿฌ์˜ค๊ธฐ import torchvision.models as models - model ์„ค์ • (image clf : resnet34, vgg, alexnet, squeezenet, densenet, googlenet etc) model = models.resnet34(pretrained=False) - model.cuda = model.to(DEVICE) ๋ชจ๋ธ ์ž…๋ ฅ model = model.cuda # model.to(DEVICE)
[Pytorch] CNN - Conv2D
ยท
๐Ÿ‘พ Deep Learning
torch.nn.Conv2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros') is_channel : ์ด๋ฏธ์ง€์˜ ์ฑ„๋„ ์ˆ˜ (ex, color dim) out_channel : Filter์˜ ๊ฐœ์ˆ˜ = Output์˜ depth kernel_size : Filter์˜ ํฌ๊ธฐ padding : Convolution์ด ์ง„ํ–‰ํ•˜๋ฉด์„œ ๊ฒน์ณ์ง€๋Š” ๊ณต๊ฐ„์„ 0์œผ๋กœ ์ฑ„์›Œ ์—ฐ์‚ฐ ์ˆ˜๋ฅผ ๋™์ผํ•˜๊ฒŒ ํ•ด์ค€๋‹ค. stride : ํ•„ํ„ฐ ์ง„ํ–‰ ๊ฐ„๊ฒฉ
๋‹คํ–ˆ๋‹ค
'๐Ÿ‘พ Deep Learning' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (5 Page)