Share via


LearningModelEvaluationResult 클래스

정의

평가 결과를 가져옵니다.

public ref class LearningModelEvaluationResult sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.AI.MachineLearning.MachineLearningContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class LearningModelEvaluationResult final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.AI.MachineLearning.MachineLearningContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class LearningModelEvaluationResult
Public NotInheritable Class LearningModelEvaluationResult
상속
Object Platform::Object IInspectable LearningModelEvaluationResult
특성

Windows 요구 사항

디바이스 패밀리
Windows 10, version 1809 (10.0.17763.0에서 도입되었습니다.)
API contract
Windows.AI.MachineLearning.MachineLearningContract (v1.0에서 도입되었습니다.)

예제

다음 예제에서는 모델의 첫 번째 입력 및 출력 기능을 검색하고, 출력 프레임을 만들고, 입력 및 출력 기능을 바인딩하고, 모델을 평가합니다.

private async Task EvaluateModelAsync(
    VideoFrame _inputFrame, 
    LearningModelSession _session, 
    IReadOnlyList<ILearningModelFeatureDescriptor> _inputFeatures, 
    IReadOnlyList<ILearningModelFeatureDescriptor> _outputFeatures,
    LearningModel _model)
{
    ImageFeatureDescriptor _inputImageDescription;
    TensorFeatureDescriptor _outputImageDescription;
    LearningModelBinding _binding = null;
    VideoFrame _outputFrame = null;
    LearningModelEvaluationResult _results;

    try
    {
        // Retrieve the first input feature which is an image
        _inputImageDescription =
            _inputFeatures.FirstOrDefault(feature => feature.Kind == LearningModelFeatureKind.Image)
            as ImageFeatureDescriptor;

        // Retrieve the first output feature which is a tensor
        _outputImageDescription =
            _outputFeatures.FirstOrDefault(feature => feature.Kind == LearningModelFeatureKind.Tensor)
            as TensorFeatureDescriptor;

        // Create output frame based on expected image width and height
        _outputFrame = new VideoFrame(
            BitmapPixelFormat.Bgra8, 
            (int)_inputImageDescription.Width, 
            (int)_inputImageDescription.Height);

        // Create binding and then bind input/output features
        _binding = new LearningModelBinding(_session);

        _binding.Bind(_inputImageDescription.Name, _inputFrame);
        _binding.Bind(_outputImageDescription.Name, _outputFrame);

        // Evaluate and get the results
        _results = await _session.EvaluateAsync(_binding, "test");
    }
    catch (Exception ex)
    {
        StatusBlock.Text = $"error: {ex.Message}";
        _model = null;
    }
}

설명

Windows Server

Windows Server에서 이 API를 사용하려면 데스크톱 환경과 함께 Windows Server 2019를 사용해야 합니다.

스레드로부터의 안전성

이 API는 스레드로부터 안전합니다.

속성

CorrelationId

LearningModelSession.Evaluate에 전달된 선택적 문자열입니다.

ErrorStatus

평가에 실패한 경우 오류의 원인에 대한 오류 코드를 반환합니다.

Outputs

모델의 출력 기능을 가져옵니다.

Succeeded

평가가 성공적으로 완료되면 True입니다. 그렇지 않으면 false입니다.

적용 대상

추가 정보