Skip to content

Fix iterrows unpacking in export_formats for benchmark export #IEEESOC #13601

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dorkdiaries9
Copy link

@dorkdiaries9 dorkdiaries9 commented May 22, 2025

What does this PR do?

Fixes a bug in benchmarks.py where export.export_formats().iterrows() was incorrectly unpacked as:

for i, (name, f, suffix, cpu, gpu) in export.export_formats().iterrows():
This caused a runtime error since iterrows() returns (index, Series), which is not directly unpackable like that.

✅ Replaced with:

for i, row in export.export_formats().iterrows():
    name = row['name']
    f = row['file']
    suffix = row['suffix']
    cpu = row['cpu']
    gpu = row['gpu']

This prevents unpacking errors during benchmark export.

I have read the CLA document and I sign the CLA.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved how export format details are accessed in the benchmarking script for better code clarity and reliability. 🛠️

📊 Key Changes

  • Updated the way export format information is retrieved from the export formats table:
    • Switched from unpacking row values directly to accessing them by column name (e.g., row["name"]).
  • Added comments for clarity on unsupported formats.

🎯 Purpose & Impact

  • Makes the code more readable and less error-prone, especially if the export formats table changes in the future.
  • Helps future developers maintain and extend the benchmarking script more easily.
  • No changes to user-facing features or model performance.

Copy link
Contributor

github-actions bot commented May 22, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I sign the CLA


1 out of 2 committers have signed the CLA.
✅ (UltralyticsAssistant)[https://github.com/UltralyticsAssistant]
@jetirs
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@UltralyticsAssistant UltralyticsAssistant added bug Something isn't working exports Model exports (ONNX, TensorRT, TFLite, etc.) python Pull requests that update python code labels May 22, 2025
@UltralyticsAssistant
Copy link
Member

👋 Hello @dorkdiaries9, thank you for submitting a ultralytics/yolov5 🚀 PR! This is an automated response to help streamline the review process. An Ultralytics engineer will review your contribution soon.

To ensure a seamless integration of your update, please review the following checklist:

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and follow the project's conventions.
  • Synchronize with Source: Make sure your PR is up to date with the main branch of ultralytics/yolov5. If it's behind, update it using the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify that all Ultralytics Continuous Integration (CI) checks have passed. If any checks fail, please resolve the issues.
  • Update Documentation: Update the relevant documentation for any new or changed features.
  • Add Tests: If applicable, add or update tests to cover your changes, and confirm all tests are passing.
  • Sign the CLA: Please make sure you've signed our Contributor License Agreement by commenting "I have read the CLA Document and I sign the CLA" if this is your first Ultralytics PR.
  • Minimize Changes: Keep your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

If your PR addresses a bug, please provide a minimum reproducible example (MRE) if you haven’t already. This helps us verify and resolve issues faster.

For more details, check out our Contributing Guide. If you have any questions, feel free to leave a comment. Thank you for contributing to Ultralytics! 🚀🛠️

@glenn-jocher
Copy link
Member

@dorkdiaries9 thank you! Please sign the CLA by writing a new comment like this:

I have read the CLA Document and I sign the CLA

@dorkdiaries9
Copy link
Author

I have read the CLA Document and I sign the CLA

@dorkdiaries9 dorkdiaries9 deleted the feature/benchmark-exports branch May 26, 2025 12:56
@dorkdiaries9 dorkdiaries9 changed the title Fix iterrows unpacking in export_formats for benchmark export Fix iterrows unpacking in export_formats for benchmark export #IEEESOC May 26, 2025
@dorkdiaries9 dorkdiaries9 restored the feature/benchmark-exports branch May 26, 2025 13:00
@dorkdiaries9 dorkdiaries9 reopened this May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working exports Model exports (ONNX, TensorRT, TFLite, etc.) python Pull requests that update python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants