Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move TF OD API docs to code + several fixes for TF OD API models conversion #7377

Merged

Conversation

lazarevevgeny
Copy link
Contributor

@lazarevevgeny lazarevevgeny commented Sep 5, 2021

Root cause analysis: The documentation and code comments related to the conversion of the TF OD API models is not up to date.

Solution:

  1. Merge most part of the documentation into the MO code. Removed a lot of out of date documentation sections.
  2. Updated node names to properly match content they produce.
  3. Removed old workaround to update the infer function of the DetectionOutput operation in the ObjectDetectionAPISSDPostprocessorReplacement. Implemented the same functionality with a sub-graph of nodes.
  4. Fixed MO transformation which removes the pre-processing block to properly work in case when the input image is scaled and mean value subtracted first, then resized and finally padded. In this case the scale/mean operations are removed as well.
  5. Fixed shape calculation function which produces output shape for case when "pad_to_max_dimension" is used. The padding is not counted anymore since this is not a true part of the pre-processing and is handled separately.
  6. Updated a lot of comments produced by MO when removing the pre-processing block.
  7. Fixed typo in the unit test for the PipelineConfig parser which results in parsing only part of the input file.
  8. Get rid of "coordinates_swap_method" parameter from the JSON config used to insert DetectionOutput operation. Now this information is obtained directly from the model.

Ticket: 51541, 24709

Additional e2e validation performed:

  • All TF 1.X OD API models of version 1.15.2 + RFCN 1.9 version of the model
  • All TF 1.X OD API models of version 1.15.2 with mode when second DetectionOutput is inserted instead of Proposal (to make sure that another branch of the Proposal op replacement works correctly)
  • TF 2.X OD API models which passed successfully with master branch
  • Validated with the models from tickets: 62407, 49852

Code:

  • Comments
  • Code style (PEP8)
  • Transformation generates reshape-able IR: no significant changes with respect to this feature
  • Transformation preserves original framework node names: no significant changes with respect to this feature

Validation:

  • Unit tests: Done
  • Framework operation tests: N/A no new op enabled
  • Transformation tests: updated some existing tests. Verified with testing of many TF OD API models e2e testing
  • Model Optimizer IR Reader check

Documentation:

  • Supported frameworks operations list: N/A no new ops enabled
  • Guide on how to convert the public model: Done
  • User guide update: Done

TODO:

  • Simplify code related to swapping XY->YX coordinates.

…nversion of the TD OD API models. Remove mean/scale if padding is used and mean/scale is applied before resize
…th incorrect test data for the PipelineConfig parser class
@lazarevevgeny lazarevevgeny changed the title Tf od api docs in code Move TF OD API docs to code + several fixes for TF OD API models conversion Sep 6, 2021
@lazarevevgeny lazarevevgeny added this to the 2022.1 milestone Sep 6, 2021
@lazarevevgeny lazarevevgeny added the category: MO Model Optimizer label Sep 6, 2021
@lazarevevgeny lazarevevgeny marked this pull request as ready for review September 7, 2021 11:17
@lazarevevgeny lazarevevgeny requested a review from a team as a code owner September 7, 2021 11:17
@lazarevevgeny lazarevevgeny requested review from a team, andrew-zaytsev, mvafin and iimironov and removed request for a team September 7, 2021 11:17
@lazarevevgeny lazarevevgeny merged commit 4547818 into openvinotoolkit:master Sep 8, 2021
akuporos pushed a commit to akuporos/openvino that referenced this pull request Sep 29, 2021
…ersion (openvinotoolkit#7377)

* Refactored code, updated comments and documentation related to TF OD API models pre-processing.

* Improved MO messages related to pre-processor block removal during conversion of the TD OD API models. Remove mean/scale if padding is used and mean/scale is applied before resize

* Updated TF OD API transformation and documentation for SSD models

* Updated comments and documentation for the ObjectDetectionAPIMaskRCNNSigmoidReplacement transformation

* Updated comments and documentation for the ObjectDetectionAPIMaskRCNNROIPoolingSecondReplacement transformation

* Updated comments and documentation for the ObjectDetectionAPIPSROIPoolingReplacement transformation

* Updated comments and documentation for the ObjectDetectionAPIProposalReplacement transformation

* Updated comments and documentation for the ObjectDetectionAPIDetectionOutputReplacement transformation

* Minor code style fixes

* Fixed unit tests for ObjectDetectionAPIPreprocessor2Replacement transformation

* Improved unit test for pipeline.config parser. Fixed very long bug with incorrect test data for the PipelineConfig parser class

* Code style fixes

* Get rid of "coordinates_swap_method" parameter in the JSON configuration file for TF OD API models

* Code style fixes and minor refactoring

* Simplied code related to swapping Proposal coordinates

* Removed incorrectly removed code

* Fixed code review comments about the code comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: MO Model Optimizer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants