dotnet / dotnet/machinelearning-modelbuilder

'object reference not set to an instance of an object' when training a image classification model

Abierto
#2,913 1 comentario 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
Dockerfile
Estrellas
285
Forks
66
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**System Information (please complete the following information):**
- Model Builder Version (available in Manage Extensions dialog): 17.18.2.2415501
- Visual Studio Version : community 2022 17.9.6, in a .net Maui project

**Describe the bug**
- On which step of the process did you run into an issue: when training the model, it trains right and generate the cs files but raise the error "object reference not set to an instance of an object"
- Clear description of the problem: here are the log before and when the problem happen :
Updating nuget dependencies... (Microsoft.ML.ModelBuilder.Utils.Logger.Info)
2024-05-11 16:08:14.5148 INFO Starting update NuGet dependencies async. (Microsoft.ML.ModelBuilder.Utils.Logger.Info)
2024-05-11 16:08:14.5148 INFO Installing nuget package, package ID: Microsoft.ML, package Version: 3.0.1 (Microsoft.ML.ModelBuilder.Utils.Logger.Info)
2024-05-11 16:08:14.5441 INFO Installing nuget package, package ID: Microsoft.ML.Vision, package Version: 3.0.1 (Microsoft.ML.ModelBuilder.Utils.Logger.Info)
2024-05-11 16:08:14.5441 INFO Installing nuget package, package ID: SciSharp.TensorFlow.Redist, package Version: 2.3.1 (Microsoft.ML.ModelBuilder.Utils.Logger.Info)
2024-05-11 16:08:14.5681 INFO COMPLETED (Microsoft.ML.ModelBuilder.Utils.Logger.Info)
2024-05-11 16:08:15.0210 DEBUG update TrainViewModel_16.RemainingSeconds (Microsoft.ML.ModelBuilder.Utils.Logger.Debug)
2024-05-11 16:08:15.0210 DEBUG update TrainViewModel_16.RemainingTime (Microsoft.ML.ModelBuilder.Utils.Logger.Debug)
2024-05-11 16:08:15.0621 DEBUG La référence d'objet n'est pas définie à une instance d'un objet.
Microsoft.ML.ModelBuilder.Utils.Utilities.NeedsCompileTagsAdded(Project project) dans
/_/src/Microsoft.ML.ModelBuilder/Utils/Utilities.cs:ligne 408
Microsoft.ML.ModelBuilder.ViewModels.TrainViewModel.AddModelItemGroup(String stateFileNameWithoutExtension, CSharpCode pFICode) dans /_/src/Microsoft.ML.ModelBuilder/ViewModels/TrainViewModel.cs:ligne 1195
Microsoft.ML.ModelBuilder.ViewModels.TrainViewModel.d__98.MoveNext() dans
/_/src/Microsoft.ML.ModelBuilder/ViewModels/TrainViewModel.cs:ligne 1120 (Microsoft.ML.ModelBuilder.Utils.Logger.Debug)"
However, the training is considered as successful (see the screenshot)
![image](https://github.com/dotnet/machinelearning-modelbuilder/assets/93293525/84f73f30-5d9a-4bfa-973b-092ea90ef577)

training on cpu and gpu gave me the same error.

**To Reproduce**
Steps to reproduce the behavior:
1. create a .Net maui project
2. Add the ML.Net extension
3. Select the 'image classification' model, with cpu or gpu training, then select random data (2 folders for me, with 467 images total) and start training. For me the error came at the end of the training.

**Expected behavior**
A clear and concise description of what you expected to happen.
I expected it to end the training and generate model files

**Screenshots**
If applicable, add screenshots to help explain your problem.
Evaluate tab after training (with error) :
![image](https://github.com/dotnet/machinelearning-modelbuilder/assets/93293525/87572d7d-c13a-48fa-8370-aa54c3a861cb)
Consume tab after training (with error) :
![image](https://github.com/dotnet/machinelearning-modelbuilder/assets/93293525/765a83b8-644f-490f-b9c5-9c980506c653)

Also, I reinstalled Visual Studio and the ML.net extension twice and I still have the same error. My NuGet packages are up to date. However, I do not have this error on other type of project as c# console app (following this tutorial to set it up https://dotnet.microsoft.com/en-us/learn/ml-dotnet/get-started-tutorial/intro)

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza reproduciendo el entrenamiento de clasificación de imágenes en un proyecto .NET MAUI y, a continuación, inspecciona Utilities.cs en la línea 408 y TrainViewModel.cs en las líneas 1120 y 1195 utilizando el stack trace indicado. Confirma que el entrenamiento se completa sin el error de referencia nula y que el modelo y los archivos C# generados se pueden utilizar.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp
Área
machine-learning
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.