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

TensorFlow.js export enhancements #4905

Merged
merged 6 commits into from
Sep 24, 2021

Conversation

zldrobit
Copy link
Contributor

@zldrobit zldrobit commented Sep 24, 2021

  • Add arguments to TensorFlow NMS call:
    --topk-per-class, --topk-all, --iou-thres and --conf-thres
  • Add regex substitution to reorder Identity_* in TFLite models (model.json)
  • Delete reorder in docstring. No need to manually reorder Identity_*.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Enhancement of TensorFlow.js export ability in YOLOv5 with improved post-processing configuration options.

📊 Key Changes

  • Refactored TensorFlow.js JSON Model Export: The export process for TensorFlow.js models now automatically sorts the Identity outputs in the model's JSON configuration, eliminating the need for manual editing.
  • Additional Post-processing Parameters for TF.js: Added command-line arguments to specify topk_per_class, topk_all, iou_thres, and conf_thres during TensorFlow.js model export.
  • Bug Fixes in AgnosticNMS: Resolved a potential type-related error within the AgnosticNMS class by using a lambda function in the tf.map_fn call to provide topk_all, iou_thres, and conf_thres arguments to the _nms method.

🎯 Purpose & Impact

  • Simplifies TensorFlow.js Workflow: The automatic sorting of Identity outputs streamlines the process for developers, making it easier to work with the exported TensorFlow.js models.
  • Enhances Model Customization: Users can now better customize the non-maximum suppression (NMS) parameters for TensorFlow.js models, optimizing performance for specific applications.
  • Improves Reliability: By fixing a potential error in the AgnosticNMS layer call, the reliability of exporting models for TensorFlow.js is increased, leading to a smoother experience for developers.

@glenn-jocher glenn-jocher merged commit 2c2ef25 into ultralytics:master Sep 24, 2021
@glenn-jocher
Copy link
Member

@zldrobit PR is merged. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐

CesarBazanAV pushed a commit to CesarBazanAV/yolov5 that referenced this pull request Sep 29, 2021
* Add arguments to TensorFlow NMS call

* Add regex substitution to reorder Identity_*

* Delete reorder in docstring

* Cleanup

* Cleanup2

* Removed `+ \` on string ends (not needed)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* Add arguments to TensorFlow NMS call

* Add regex substitution to reorder Identity_*

* Delete reorder in docstring

* Cleanup

* Cleanup2

* Removed `+ \` on string ends (not needed)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
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.

2 participants