I'm trying to complete this sketch2code tutorial by AI School https://aischool.microsoft.com/en-us/services/learning-paths/sketch2code/sketch2code-lab/train-an-object-detection-model
Step 9 of the tutorial says:
Enter the command
dotnet
run and press the enter key.
I'm using Visual Studio 2019 could that be the problem?
Unhandled Exception: Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'Unauthorized'
at Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training.TrainingApi.GetDomainsWithHttpMessagesAsync(Dictionary`2 customHeaders, CancellationToken cancellationToken)
at Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training.TrainingApiExtensions.GetDomainsAsync(ITrainingApi operations, CancellationToken cancellatio
nToken)
at Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training.TrainingApiExtensions.GetDomains(ITrainingApi operations)
at Import.Program.Main(String[] args) in C:\Users\Harry\Downloads\AISchoolTutorials\sketch2code\Import\Program.cs:line 29
You have to update Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training package.
Open your terminal and go to the Import folder
Run the following command
dotnet add package Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training --version 2.0.0
Open Program.cs and replace this line:
TrainingApi trainingApi = new TrainingApi() { ApiKey = trainingKey };
with this line:
CustomVisionTrainingClient trainingApi = new CustomVisionTrainingClient(new ApiKeyServiceClientCredentials(trainingKey)) {Endpoint = endpoint};
make sure to replace ENDPOINT with your yours from customvision.ai