<style> h1,h2,h3,h4,h5{ color:#159957; } </style>
模型微調
遷移學習(transfer learning)
定義:將從源資料集學到的知識遷移到目標資料集
原因:在源資料集訓練的模型可以抽取通用的特征(邊緣,形狀,紋理等)
遷移常用技術-微調(fine tuning)
- 在源資料集上訓練一個神經網路模型
- 目標模型復制除輸出層之外的所有模型設計及其引數
- 為目標模型添加一個輸出大小為目標資料集類別個數的輸出層
- 目標模型輸出層從頭訓練,其余層引數基于源模型微調

在使用預訓練模型時,一定要和預訓練時作同樣的預處理,
如果你使用的是torchvision的models,那就要求: All pre-trained models expect input images normalized in the same way, i.e. mini-batches of 3-channel RGB images of shape (3 x H x W), where H and W are expected to be at least 224. The images have to be loaded in to a range of [0, 1] and then normalized using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225].
訓練時,對輸出層采用隨機初始化,一般需要更大學習率來學習模型,而其他層只需要使用較小的學習率即可
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/47687.html
標籤:其他
