Last active
July 8, 2018 21:08
-
-
Save CESARDELATORRE/080f9a9e89bff1f9634f281f97729cab to your computer and use it in GitHub Desktop.
export-onnx-model-from-mlnet-model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var onnxPath = GetOutputPath(subDir, "SaveModelToOnnxTest.onnx"); | |
var onnxAsJsonPath = GetOutputPath(subDir, "SaveModelToOnnxTest.json"); | |
OnnxConverter converter = new OnnxConverter() | |
{ | |
InputsToDrop = new[] { "Label" }, | |
OutputsToDrop = new[] { "Label", "Features" }, | |
Onnx = onnxPath, | |
Json = onnxAsJsonPath, | |
Domain = "com.mydomain" | |
}; | |
converter.Convert(model); | |
// Strip the version. | |
var fileText = File.ReadAllText(onnxAsJsonPath); | |
fileText = Regex.Replace(fileText, "\"producerVersion\": \"([^\"]+)\"", "\"producerVersion\": \"##VERSION##\""); | |
File.WriteAllText(onnxAsJsonPath, fileText); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment