dotnet / dotnet/machinelearning
Retrain Custom TensorFlow Model Feature Request
- Dominant language
- C#
- Stars
- 9.4k
- Forks
- 2k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 11
Description
I designed (not trained) a siamese CNN network in Keras (python) and exported it as a SavedModel with the random weights.
_Input = 4 dimensions (left/right image, height, width, RGB).
Output = change of images being equal (sigmoid)
But I don't understand how I can train this model from .NET Core?
When I use:
```csharp
using var tensorFlowModel = mlContext.Model.LoadTensorFlowModel("./model");
var pipeline = tensorFlowModel.ScoreTensorFlowModel(
new[] { inputComparer.Name },
new[] { outputComparer.Name }, addBatchDimensionInput: true);
```
Then I potentially can get the output from the model, but it's untrained, so this makes no sense.
So I need a trainer. I tried with LbfgsLogisticRegression but then I get "Schema mismatch for label column 'StatefulPartitionedCall': expected Boolean, got Vector" which makes sense as the Tensorflow model don't output Booleans, but a Vector. Do I need another trainer?
When I use the [ImageClassification](https://docs.microsoft.com/en-us/dotnet/machine-learning/tutorials/image-classification-api-transfer-learning) from this tutorial, I can only train one of the embedded networks from ImageClassificationTrainer.Architecture. It's a class output instead of binary, but that's OK. One class is also binary. But I want to train my own network.
[This example](https://github.com/dotnet/machinelearning/blob/master/test/Microsoft.ML.Tests/ScenariosWithDirectInstantiation/TensorflowTests.cs) was the closest I could find.
How do I train my binary output Tensorflow siamese network?
The reason I want to train this network from .NET Core instead of Python is to test the speed improvements and rollout something independently of Python.
Contributor guide
Assessment
This issue has not been assessed yet.