dotnet / dotnet/machinelearning-modelbuilder

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

オープン
#2,913 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Dockerfile
スター
285
フォーク
66
PR マージ指標
30日以内にマージされた PR はありません

説明

**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)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

.NET MAUI プロジェクトで画像分類のトレーニングを再現することから始め、報告されたスタックトレースを使用して、Utilities.cs の 408 行目と TrainViewModel.cs の 1120 行目および 1195 行目を調査します。null 参照エラーなしでトレーニングが完了すること、および生成されたモデルと C# ファイルが使用可能であることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp
領域
machine-learning
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。