Skip To Content

Fine-tune the model

You can fine-tune the Prithvi - Crop Classification model to suit your geographic area, imagery, or features of interest. Fine-tuning a model requires less training data, computational resources, and time compared to training a new model.

Fine-tuning the model is recommended if you do not get satisfactory results from the available ArcGIS pretrained deep learning models. This can happen when your area of interest falls outside the applicable geographies for the models or if your imagery properties such as resolution, scale, and seasonality are different.

You can use the Export Training Data For Deep Learning tool to prepare training data. Next, you can fine-tune this model on your data using the Train Deep Learning Model tool in ArcGIS Pro. Follow the steps below to fine-tune the model.

Prepare training data

This model is trained on the 18-bands composite of either Harmonized Landsat 8 (HLSL30) or Harmonized Sentinel 2 (HLSS30) imagery and crop labels. Use the Export Training Data For Deep Learning tool to prepare training data for fine-tuning the model.

  1. Browse to Tools under the Analysis tab.
    Tools button
  2. Click the Toolboxes tab in the Geoprocessing pane, select Image Analyst Tools, and browse to the Export Training Data For Deep Learning tool in the Deep Learning toolset.
    Export Training Data For Deep Learning
  3. Set the variables under the Parameters tab as follows:
    1. For Input Raster, select the 18-bands imagery. For more details regarding input raster, refer to Recommended imagery configuration.
    2. For Output Folder, select a directory on your machine.
    3. Optionally, for Input Feature Class Or Classified Raster Or Table, select the labeled feature class or classified raster representing crop classes with the ClassValue field or pixel values that are the same as the 13 classes in the multi-temporal crop classification dataset.

      The feature class should also have a text field named ClassName with value set to names of crop classes.

    4. For Class Value Field, set the value same as multi-temporal crop classification dataset.
    5. For Image Format, select TIFF format.
    6. For Tile Size X, use a tile size that is appropriate for your specific use case and aligns with the model's context requirements.

      In this case, 224 will be used.

    7. For Tile Size Y, use a tile size that is appropriate for your specific use case and aligns with the model's context requirements.

      In this case, 224 will be used.

    8. For Stride X, type 0.
    9. For Stride Y, type 0.
    10. For Metadata Format, select Classified Tiles.
      Export Training Data for Deep Learning tool parameters
  4. Set the variables under the Environments tab.
    1. For Processing Extent, select Current Display Extent or any other option from the drop-down menu as needed.
    2. For Cell Size, set the value to the desired cell size.
      Export Training Data For Deep Learning tool parameters on the Environments tab
  5. Click Run.

    Once processing is complete, the exported training data is saved in the specified directory.

Fine-tune the Prithvi - Crop Classification model

Complete the following steps to fine-tune the model using learn module of ArcGIS API for Python:

  1. Browse to Tools under the Analysis tab.
    Tools button
  2. In the Geoprocessing pane, click the Toolboxes tab and expand Image Analyst Tools. Select the Train Deep Learning Model tool under Deep Learning.
    Train Deep Learning Model tool
  3. Set the variables under the Parameters tab as follows:
    1. For Input Training Data, use the path to your exported training data from the previous step.
    2. For Output Folder, select a directory on your machine.
    3. Optionally, for Max Epochs, type 20, or the number of iterations you want to fine-tune the model for.

      Epoch is the number of iterations the tool will take to go over the data.

    4. For Batch Size, type 4, or increase or decrease this number according to your GPU capacity.

      Batch size must be a square number.

    5. For Model Type, select MMSegmentation (Pixel classification) from the drop down list.
    6. For Model Arguments, type prithvi100m for model.
    7. Check the Stop when model stops improving box.
    8. Check the Freeze Model box.
      Parameters tab in Train Deep Learning Model tool
  4. Set the variables under the Environments tab.
    1. For Processor Type, select CPU or GPU as needed.

      If GPU is available, it is recommended that you select GPU and set GPU ID to the GPU to be used.

      Environments tab of Train Deep Learning Model tool
  5. Click Run.

    You can now use this model to run inferencing against your imagery.