dotnet / dotnet/machinelearning

MLImage disposes in some cases after CreateEnumerable .ToArray() if there is ResizeImages in the pipeline

Open
#7,444 0 comments 0 reactions 0 assignees View on GitHub
area-Vision
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

**System Information:**
- OS & Version: Windows 11
- ML.NET Version: ML.NET v4.0.2
- .NET Version: .NET 9.0

**Describe the bug**
In some cases MLImage disposes after CreateEnumerable .ToArray() if there is ResizeImages in the pipeline.
If SourceImage size == ResizedImage size, after CreateEnumerable .ToArray() SourceImage disposes.
If SourceImage size != ResizedImage size, after CreateEnumerable .ToArray() SourceImage doesn't dispose.

**To Reproduce**
Project with xUnit and reproduction:
https://github.com/Lavshyak/MLNetImageDisposingProblem

**Expected behavior**
Provide a choice whether to dispose or not. If not, then SourceImage doesn't dispose.
Or just never dispose.
Or just write about it in red text in the documentation.

**Screenshots, Code, Sample Projects**
Project with xUnit and reproduction:
https://github.com/Lavshyak/MLNetImageDisposingProblem

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.