مخطط YAML لوظيفة تصنيف CLI (v2) التلقائي لصور التعلم الآلي متعددة التسميات

ينطبق على:ملحق Azure CLI ml v2 (الحالي)

يمكن إيجاد مخطط المصدر JSON في https://azuremlsdk2.blob.core.windows.net/preview/0.0.1/autoMLImageClassificationMultilabelJob.schema.json.

ملاحظة

يعتمد بناء YAML المفصل في هذا المستند على مخطط JSON لأحدث إصدار من ملحق الإصدار الثاني من واجهة مستوى الاستدعاء للتعليم الآلي. إن هذا البناء مضمون للعمل فقط مع أحدث إصدار من ملحق الإصدار الثاني من واجهة مستوى الاستدعاء للتعليم الآلي. يمكنك العثور على مخططات إصدارات الملحق الأقدم في https://azuremlschemasprod.azureedge.net/.

بناء YAML

للحصول على معلومات حول جميع المفاتيح في بناء جملة Yaml، راجع بناء جملة Yaml لمهمة تصنيف الصور. هنا نصف فقط المفاتيح التي لها قيم مختلفة مقارنة بما هو محدد لمهمة تصنيف الصور.

المفتاح النوع الوصف القيم المسموح بها القيمة الافتراضية
task const مطلوب نوع مهمة AutoML. image_classification_multilabel image_classification_multilabel
primary_metric سلسلة المقياس الذي سيحسنه AutoML لاختيار النموذج. iou iou

الملاحظات

يمكن استخدام الأمر az ml job لإدارة وظائف التعلم الآلي من Microsoft Azure.

أمثلة

الأمثلة متوفرة في مستودع أمثلة GitHub. يتم عرض الأمثلة ذات الصلة بمهمة تصنيف الصور متعددة التسميات أدناه.

YAML: مهمة تصنيف الصور متعددة التسميات AutoML

$schema: https://azuremlsdk2.blob.core.windows.net/preview/0.0.1/autoMLJob.schema.json
type: automl

experiment_name: dpv2-cli-automl-image-classification-multilabel-experiment
description: A multi-label Image classification job using fridge items dataset

compute: azureml:gpu-cluster

task: image_classification_multilabel
log_verbosity: debug
primary_metric: iou

target_column_name: label
training_data:
  # Update the path, if prepare_data.py is using data_path other than "./data"
  path: data/training-mltable-folder
  type: mltable
validation_data:
  # Update the path, if prepare_data.py is using data_path other than "./data"
  path: data/validation-mltable-folder
  type: mltable

limits:
  timeout_minutes: 60
  max_trials: 10
  max_concurrent_trials: 2

training_parameters:
  early_stopping: True
  evaluation_frequency: 1

sweep:
  sampling_algorithm: random
  early_termination:
    type: bandit
    evaluation_interval: 2
    slack_factor: 0.2
    delay_evaluation: 6

search_space:
  - model_name:
      type: choice
      values: [vitb16r224]
    learning_rate:
      type: uniform
      min_value: 0.005
      max_value: 0.05
    number_of_epochs:
      type: choice
      values: [15, 30]
    gradient_accumulation_step:
      type: choice
      values: [1, 2]

  - model_name:
      type: choice
      values: [seresnext]
    learning_rate:
      type: uniform
      min_value: 0.005
      max_value: 0.05
    validation_resize_size:
      type: choice
      values: [288, 320, 352]
    validation_crop_size:
      type: choice
      values: [224, 256]
    training_crop_size:
      type: choice
      values: [224, 256]

YAML: مهمة مسار تصنيف الصور متعددة التسميات AutoML

$schema: https://azuremlschemas.azureedge.net/latest/pipelineJob.schema.json
type: pipeline

description: Pipeline using AutoML Image Multilabel Classification task

display_name: pipeline-with-image-classification-multilabel
experiment_name: pipeline-with-automl

settings:
  default_compute: azureml:gpu-cluster

inputs:
  image_multilabel_classification_training_data:
    type: mltable
    # Update the path, if prepare_data.py is using data_path other than "./data"
    path: data/training-mltable-folder
  image_multilabel_classification_validation_data:
    type: mltable
    # Update the path, if prepare_data.py is using data_path other than "./data"
    path: data/validation-mltable-folder

jobs:
  image_multilabel_classification_node:
    type: automl
    task: image_classification_multilabel
    log_verbosity: info
    primary_metric: iou
    limits:
      timeout_minutes: 180
      max_trials: 10
      max_concurrent_trials: 2
    target_column_name: label
    training_data: ${{parent.inputs.image_multilabel_classification_training_data}}
    validation_data: ${{parent.inputs.image_multilabel_classification_validation_data}}
    training_parameters:
      early_stopping: True
      evaluation_frequency: 1
    sweep:
      sampling_algorithm: random
      early_termination:
        type: bandit
        evaluation_interval: 2
        slack_factor: 0.2
        delay_evaluation: 6
    search_space:
      - model_name:
          type: choice
          values: [vitb16r224]
        learning_rate:
          type: uniform
          min_value: 0.005
          max_value: 0.05
        number_of_epochs:
          type: choice
          values: [15, 30]
        gradient_accumulation_step:
          type: choice
          values: [1, 2]

      - model_name:
          type: choice
          values: [seresnext]
        learning_rate:
          type: uniform
          min_value: 0.005
          max_value: 0.05
        validation_resize_size:
          type: choice
          values: [288, 320, 352]
        validation_crop_size:
          type: choice
          values: [224, 256]
        training_crop_size:
          type: choice
          values: [224, 256]

    # currently need to specify outputs "mlflow_model" explicitly to reference it in following nodes
    outputs:
      best_model:
        type: mlflow_model
  register_model_node:
    type: command
    component: file:./components/component_register_model.yaml
    inputs:
      model_input_path: ${{parent.jobs.image_multilabel_classification_node.outputs.best_model}}
      model_base_name: fridge_items_multilabel_classification_model

الخطوات التالية