Image classification training convert to onnx file format
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- csharp
调研方向
从 C# 图像分类示例和 ConvertToOnnx 入口点开始,然后使用 issue 中所示的 pipeline 重现异常。确定哪些阶段可以在 ONNX 中表示,并就预期的 best-effort 行为达成一致;对于此示例,支持的转换路径或所请求的功能已定义并得到演示,即表示完成。
由索引模型根据 Issue 内容生成。
描述
I've been doing experiments with the C# image classification examples, and I've been struggling trying to modify the sample to save an ONNX file without success, since it gives me the usual "The targeted pipeline can not be fully converted into a well-defined ONNX model" exception.
So which would be the steps required to be able to save an onnx file?
I am aware some pipeline might contain ML transformers that are not available in ONNX, but maybe the ConvertToOnnx method could have a "best effort" option that would automatically convert what can be converted.
In other words, I would like to save the raw ONNX model that's in between the transformers that cannot be converted to ONNX.
var trainTestSplit = _mlContext.Data.TrainTestSplit(data, testFraction: 0.2);
var trainData = trainTestSplit.TrainSet;
var testData = trainTestSplit.TestSet;
var pipeline = _mlContext.Transforms.Conversion.MapValueToKey(
outputColumnName: "LabelKey",
inputColumnName: "Label")
.Append(_mlContext.Transforms.LoadRawImageBytes(
outputColumnName: "Image",
imageFolder: null,
inputColumnName: "ImagePath"))
.Append(_mlContext.MulticlassClassification.Trainers.ImageClassification(
new ImageClassificationTrainer.Options()
{
LabelColumnName = "LabelKey",
FeatureColumnName = "Image",
Arch = ImageClassificationTrainer.Architecture.InceptionV3,
Epoch = _settings.Epochs,
BatchSize = _settings.BatchSize,
LearningRate = 0.001f,
MetricsCallback = (metrics) => _logger.LogInformation($"Epoch: {metrics.Train?.Epoch}, Top1Accuracy: {metrics.Train?.Accuracy}")
}))
.Append(_mlContext.Transforms.Conversion.MapKeyToValue(
outputColumnName: "PredictedLabel",
inputColumnName: "PredictedLabel"));
- 主要语言
- PowerShell
- 星标
- 4.7k
- 派生
- 2.7k
- 平均合并
- 2 天 22 小时
- 30 天内合并 PR
- 1
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotnet/machinelearning-samples 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
-
难度 1/5 1 小时以内 新手友好度 68/100
-
难度 4/5 3-5 天 新手友好度 20/100
dotnet/machinelearning-samples#1044 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 15/100
dotnet/machinelearning-samples#1043 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
dotnet/machinelearning-samples#1042 · 1 个 reaction ·
查看 dotnet/machinelearning-samples 的全部 Issue
相似的 Issue
-
backend::vllm diffusion multimodal
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
google-deepmind/dm_control#559 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
pytorch/torchtitan#4924 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复