Visual Artificial Intelligence (AI)のチューニングガイド¶
In this guide, you will step through several recommended methods for maximizing Visual Artificial Intelligence (AI) classification accuracy with a boat dataset containing nine classes and approximately 1,500 images. You can get the dataset here.
Start the project with the target of class
. When it builds, change the optimization metric from LogLoss
to show Accuracy
. You'll see under the cross-validation score that the top model achieved 83.68% accuracy.
Use the steps below to improve the results
1. Run with Comprehensive mode¶
The first modeling run, using Quick mode, generated results by exploring a limited set of available blueprints. There are, however, many more available if you run in Comprehensive mode. Click Configure modeling settings option in the right pane, and select Comprehensive modeling mode, to re-run the modeling process and build additional models while prioritizing accuracy.
This results in a model with a much higher accuracy of 91.45%.
2. Explore other image featurizers¶
画像がモデルのブループリントのタスクとして数値(「特徴量化」)に変換されると、それをモデリングアルゴリズムに渡し、他の特徴量(数値、カテゴリー、テキストなど)と組み合わせることができます。 フィーチャライザーは、画像ファイルのバイナリコンテンツを入力として受け取り、さまざまなレベルの複雑さでその画像の主要な特性を表す特徴量ベクトルを生成します。 この特徴量ベクトルは、モデラーへの入力としてダウンストリームで使用されます。 DataRobot provides several featurizers based on pretrained neural network architectures.
To explore improvements with other image featurizers, select the top model on the Leaderboard and view its blueprint, which shows the featurizer used.
From the Advanced Tuning tab, scroll to the current network to bring up the menu of options.
Try different network
hyperparameters (scroll to the bottom and select Begin Tuning after each change). After tuning the top Comprehensive mode model with each available image featurizer, you can further explore variations of those featurizers in the top-performing models.
3. Feature Granularity¶
フィーチャライザーは、シーケンシャルレイヤーで構成される深い畳み込みニューラルネットワークであり、各レイヤーは前のレイヤーからの情報を集約します。 最初のレイヤーは、ポイント、エッジ、コーナーなど、数ピクセルで構成される低レベルのパターンをキャプチャします。 次のレイヤーでは、形状やテクスチャーをキャプチャします。 The final layers capture objects. ニューラルネットワークモデルから抽出する特徴量のレベルは、ニューラルネットワーク、チューニング、および結果の最適化から選択できます(レイヤーが多いほど実行時間が長くなります)。
Toggles for feature granularity options (highest, high, medium, low) are found below the network
section in the Advanced Tuning menu.
Any combination of these can be used, and the context of your problem/data can direct which features might provide the most useful information.
4. 画像オーグメンテーション¶
Following featurizer tuning, you can explore changes to your input data with image augmentation to improve model accuracy. 既存の画像をランダムに変換してトレーニング用の新しい画像を作成することで、小さすぎるデータセットを使用してインサイトに満ちたプロジェクトを構築できます。
Image augmentation is available at project setup in the Image Augmentation advanced options or after modeling in Advanced Tuning.
Domain expertise can provide insight into which transformations could show the greatest impact. Otherwise, a good place to start is with rotation
, then rotation + cutout
, followed by other combinations.
5. Classifier hyperparameters¶
The training hyperparameters of the classifier, the component receiving the image feature encodings from the featurizer, are also exposed for tuning in the Advanced Tuning menu.
To set a new hyperparameter, enter a value in the Enter value field in one of the following ways:
-
事前入力された値の一つを選択します(オレンジでリストされているいずれかの値をクリックすると、その値が値フィールドに入力されます。)
-
フィールドに値を入力します。 許容可能な値フィールドを参照してください。このフィールドには、数値入力の制約またはカテゴリー入力(「selects」)の事前定義済みの許容値のいずれかがリストされます。 特定の数値を入力するには、許容値の条件を満たす値または範囲を入力します。
上記のスクリーンショットでは、0.00001から1の間の様々な値を入力できます。次に例を示します。
- 0.2 個々の値を選択します。
- 0.2, 0.4, 0.6 範囲内の値を一覧表示します。リスト内の値を区切るにはカンマを使用します。
- 0.2-0.6 と入力すると、範囲が指定され、DataRobotによって高い値と低い値の間の間隔が選択されます。ハイフンを使用して範囲を指定します。
Fine-tuning tips¶
-
For speed improvements, reduce Early Stopping Patience. The default is 5, try setting it to 2, as 5 sometimes can lead to 40+ epochs.
-
Change the loss function to focal_loss if the dataset is imbalanced, since focal_loss generalizes well for imbalanced datasets.
-
For faster convergence, change reduce_lr_patience to 1 (the default is 3).
-
Change model_name to
efficientnet-b0
if you aiming better fine-tuner accuracy. The default ismobilenet-v3
.
Set the search type by clicking Select search option, and selecting either:
-
Smart Search (default) performs a sophisticated pattern search (optimization) that emphasizes areas where the model is likely to do well and skips hyperparameter points that are less relevant to the model.
-
総当たりは、各データポイントを評価しますが、時間とリソースへの負荷が高い場合があります。
Recommended hyperparameters to search first vary by the classifier used. 例:
- Keras model: batch size, learning rate, hidden layers, and initialization
- XGBoost: number of variables, learning rate, number of trees, and subsample per tree
- ENet: alpha and lambda
Bonus: Fine-tuned blueprints¶
Fine-tuned model blueprints may prove useful for datasets that greatly differ from ImageNet, the dataset leveraged for the pretrained image featurizers. These blueprints are found in the model repository and can be trained from scratch (random weight initialization) or with the pretrained weights. Many of the tuning steps described above also apply for these blueprints; however, keep in mind that fine-tuned blueprints requires extended training times. In addition, pretrained blueprints will achieve better scores than fine-tuned blueprints for the majority of cases, and did so with our boats dataset.
Final results¶
Fine-tuning improved the accuracy score on the top Quick model (83.68%) to the top Comprehensive mode model (91.45%). Following the additional steps outlined here for maximizing model performance with the most effective settings within the platform resulted in a final accuracy of 92.92%.