Skip to content

Improve ONNX Object Detection Flow#531

Merged
CESARDELATORRE merged 8 commits intodotnet:masterfrom
luisquintanilla:onnx-drawboundingbox
Jul 18, 2019
Merged

Improve ONNX Object Detection Flow#531
CESARDELATORRE merged 8 commits intodotnet:masterfrom
luisquintanilla:onnx-drawboundingbox

Conversation

@luisquintanilla
Copy link
Copy Markdown
Contributor

@luisquintanilla luisquintanilla commented Jun 21, 2019

Refactored sample to improve flow / readability

List of Changes

  1. Renamed YoloWinMlParser to YoloOutputParser.
  2. Fixed namespaces on classes within subdirectories to match their location in the project structure.
  3. Changed return type of LoadModel method to ITransformer
  4. Removed CreateEmptyDataView since it is only used once and replaced it with _mlContext.Data.LoadFromEnumerable(new List<ImageNetData>()); inside of LoadModel method.
  5. Changed PredictDataUsingModel method signature to decouple post-processing steps.
  6. Use Transform method instead of PredictionEngine to score data using the model in PredictDataUsingModel method.
  7. Updated Score method to reflect changes in other helper methods.
  8. Removed GetImagesData method. Moved logic to ImageNetData class as part of ReadFromFile method.
  9. Moved DrawBoundingBox method to Program class
  10. Expanded logic in Main method of Program class and broke down into steps (1) load data, (2) score data with model (3) post-process data (4) draw bounding boxes

@luisquintanilla luisquintanilla changed the title Make DrawBoundingBox Private Make DrawBoundingBox Private Jun 21, 2019
@luisquintanilla luisquintanilla changed the title Make DrawBoundingBox Private Improve ONNX Object Detection Flow Jun 26, 2019
@natke natke requested review from JRAlexander and natke June 26, 2019 16:47
Console.WriteLine($"Default parameters: image size=({ImageNetSettings.imageWidth},{ImageNetSettings.imageHeight})");

var data = CreateEmptyDataView();
var data = _mlContext.Data.LoadFromEnumerable(new List<ImageNetData>());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a comment to explain why we create an empty data view

Copy link
Copy Markdown
Contributor

@CESARDELATORRE CESARDELATORRE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and reviewed. Thanks! 👍

@CESARDELATORRE CESARDELATORRE merged commit 5a622bb into dotnet:master Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants