欢迎来到天天文库
浏览记录
ID:42896764
大小:651.20 KB
页数:11页
时间:2019-09-20
《Transfer Learning using Keras – Towards Data Science – Medium》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、prakashvanapalliFollowingJuniorDataScientistApr15·4minreadTransferLearningusingKerasInception-V3GoogleResearchWhatisTransferLearning?Transferlearning,isaresearchprobleminmachinelearningthatfocusesonstoringknowledgegainedwhilesolvingoneproblemandapplyingittoadi
2、fferentbutrelatedproblem.WhyTransferLearning?•InpracticeaveryfewpeopletrainaConvolutionnetworkfromscratch(randominitialisation)becauseitisraretogetenoughdataset.So,usingpre-trainednetworkweightsasinitialisationsorafixedfeatureextractorhelpsinsolvingmostoftheprob
3、lemsinhand.•VeryDeepNetworksareexpensivetotrain.ThemostcomplexmodelstakeweekstotrainusinghundredsofmachinesequippedwithexpensiveGPUs.•Determiningthetopology/flavour/trainingmethod/hyperparametersfordeeplearningisablackartwithnotmuchtheorytoguideyou.MyExperience
4、s:"DON'TTRYTOBEANHERO"~AndrejKarapathyMostoftheComputerVisionProblemsIfaceddoesn’thaveverylargedatasets(5000images—40,000images).Evenwithextremedataaugmentationstrategiesitisdifficulttoachievedecentaccuracy.Trainingthesenetworkswithmillionsofparametersgenerallyt
5、endtooverfitthemodel.SoTransferlearningcomestoourrescue.HowTransferLearninghelps?WhenyoulookatwhattheseDeepLearningnetworkslearn,theytrytodetectedgesintheearlierlayers,Shapesinthemiddlelayerandsomehighleveldataspecificfeaturesinthelaterlayers.Thesetrainednetwork
6、saregenerallyhelpfulinsolvingothercomputervisionproblems.LetshavealookathowtodotransferlearningusingKerasandvariouscasesinTransferlearning.InceptionV3GoogleResearchSimpleimplementationusingKeras:1fromkerasimportapplications2fromkeras.preprocessing.imageimportI
7、mageDataGenerator3fromkerasimportoptimizers4fromkeras.modelsimportSequential,Model5fromkeras.layersimportDropout,Flatten,Dense,GlobalAveragePooling2D6fromkerasimportbackendask7fromkeras.callbacksimportModelCheckpoint,LearningRateScheduler,TensorBoard,EarlyStop
8、ping89img_width,img_height=256,25610train_data_dir="data/train"11validation_data_dir="data/val"12nb_train_samples=412513nb_validation_samples=46614batch_size=1615epochs=501617model
此文档下载收益归作者所有