機器學習範例:圖片分類
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
使用預先訓練模型
訓練卷積類神經網路以執行圖片分類工作時,通常需要使用大量的訓練資料,而且可能需要數天或數週才能完成。但是,如果可以運用運用大量資料集 (例如透過 TensorFlow-Slim) 訓練的現有圖片模型,並調整這些模型,以便在自己的分類工作中使用?
利用預先訓練模型的常見技術之一是「特徵擷取」:擷取預先訓練模型產生的中繼表示法,然後將這些表示法以輸入內容的形式輸入到新的模型中。舉例來說,如果您訓練了圖片分類模型來區分不同類型的蔬菜,可以將胡蘿蔔、咖哩等的訓練圖片提供給預先訓練的模型,然後從最終卷積層擷取特徵。這些模型會擷取模型所有相關資訊,並將這些內容分類為建構內容的新類別,以建立、分類、形狀等。為了讓在透過預先訓練的模型使用特徵擷取時可提高效能,工程師通常會微調套用到已擷取特徵的權重參數。
如要進一步探索使用預先訓練模型的模型擷取和微調,請參閱下列運動。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2022-09-27 (世界標準時間)。
[null,null,["上次更新時間:2022-09-27 (世界標準時間)。"],[[["\u003cp\u003ePretrained image models can be leveraged to perform image classification tasks, saving time and resources compared to training a new model from scratch.\u003c/p\u003e\n"],["\u003cp\u003eFeature extraction involves using the intermediate representations from a pretrained model as input for a new model, enabling the utilization of learned features like color, texture, and shape.\u003c/p\u003e\n"],["\u003cp\u003eFine-tuning the weight parameters of extracted features can further enhance the performance of the new classification model built on top of the pretrained model.\u003c/p\u003e\n"]]],[],null,["# ML Practicum: Image Classification\n\n\u003cbr /\u003e\n\nLeveraging Pretrained Models\n----------------------------\n\nTraining a convolutional neural network to perform image classification tasks\ntypically requires an extremely large amount of training data, and can be very\ntime-consuming, taking days or even weeks to complete. But what if you could\nleverage existing image models trained on enormous datasets, such as via\n[TensorFlow-Slim](https://github.com/tensorflow/models/tree/master/research/slim),\nand adapt them for use in your own classification tasks?\n\nOne common technique for leveraging pretrained models is *feature extraction* :\nretrieving intermediate representations produced by the pretrained model, and\nthen feeding these representations into a new model as input. For example, if\nyou're training an image-classification model to distinguish different types of\nvegetables, you could feed training images of carrots, celery, and so on, into a\npretrained model, and then extract the features from its final convolution\nlayer, which capture all the information the model has learned about the images'\nhigher-level attributes: color, texture, shape, etc. Then, when building your\nnew classification model, instead of starting with raw pixels, you can use these\nextracted features as input, and add your fully connected classification layers\non top. To increase performance when using feature extraction with a pretrained\nmodel, engineers often *fine-tune* the weight parameters applied to the\nextracted features.\n\nFor a more in-depth exploration of feature extraction and fine tuning when using\npretrained models, see the following Exercise.\n| **Key Terms**\n|\n| |----------------------|---------------|\n| | - feature extraction | - fine tuning |\n|"]]