Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ML.Net deep-learning classification tutorial code hits InvalidOperationException error #7071

Open
khteh opened this issue Mar 15, 2024 · 0 comments
Labels
untriaged New issue has not been triaged

Comments

@khteh
Copy link

khteh commented Mar 15, 2024

System Information (please complete the following information):

  • OS & Version: [e.g. Windows 10] Windows 11
  • ML.NET Version: [e.g. ML.NET v1.5.5] 3.0.1
  • .NET Version: [e.g. .NET 5.0] .Net 8

Describe the bug
Following this tutorial https://learn.microsoft.com/en-us/dotnet/machine-learning/tutorials/image-classification-api-transfer-learning,
the following code snippet:

ITransformer BuildAndTrainModel(IDataView trainingDataView, ImageClassificationTrainer.Options classifierOptions)
{
    WriteLine($"Build and train model...");
    var trainingPipeline = mlContext.MulticlassClassification.Trainers.ImageClassification(classifierOptions)
                                .Append(mlContext.Transforms.Conversion.MapKeyToValue("PredictedLabel"));
    return trainingPipeline.Fit(trainingDataView); <<- Error
}

hits a runtime error:

System.InvalidOperationException
  HResult=0x80131509
  Message=Error downloading resource from 'https://aka.ms/mlnet-resources/meta/resnet_v2_101_299.meta': DownloadFailed with exception One or more errors occurred. (Object synchronization method was called from an unsynchronized block of code.)\nDownloadFailed with exception One or more errors occurred. (The wait completed due to an abandoned mutex.)\nDownloadFailed with exception One or more errors occurred. (Object synchronization method was called from an unsynchronized block of code.)\nDownloadFailed with exception One or more errors occurred. (The wait completed due to an abandoned mutex.)\nDownloadFailed with exception One or more errors occurred. (The wait completed due to an abandoned mutex.)\n
Meta file could not be downloaded! Please copy the model file 'resnet_v2_101_299.meta' from 'meta\resnet_v2_101_299.meta' to 'C:\Users\me\AppData\Local\Temp\MLNET'.
  Source=Microsoft.ML.TensorFlow
  StackTrace:
   at Microsoft.ML.TensorFlow.TensorFlowUtils.DownloadIfNeeded(IHostEnvironment env, String url, String dir, String fileName, Int32 timeout)
   at Microsoft.ML.Vision.ImageClassificationTrainer.LoadTensorFlowSessionFromMetaGraph(IHostEnvironment env, Architecture arch)
   at Microsoft.ML.Vision.ImageClassificationTrainer.InitializeTrainingGraph(IDataView input)
   at Microsoft.ML.Vision.ImageClassificationTrainer.TrainModelCore(TrainContext trainContext)
   at Microsoft.ML.Trainers.TrainerEstimatorBase`2.TrainTransformer(IDataView trainSet, IDataView validationSet, IPredictor initPredictor)
   at Microsoft.ML.Trainers.TrainerEstimatorBase`2.Fit(IDataView input)
   at Microsoft.ML.Data.EstimatorChain`1.Fit(IDataView input)
   at Program.<<Main>$>g__BuildAndTrainModel|0_2(IDataView trainingDataView, Options classifierOptions, <>c__DisplayClass0_0& ) in C:\Projects\ML.Net\DeepLearning_ImageClassification_Binary\src\Program.cs:line 83
   at Program.<Main>$(String[] args) in C:\Projects\ML.Net\DeepLearning_ImageClassification_Binary\src\Program.cs:line 21

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
Runs successfully

Screenshots, Code, Sample Projects
If applicable, add screenshots, code snippets, or sample projects to help explain your problem.

Additional context
Add any other context about the problem here.

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged label Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

1 participant