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

Add IS_JETSON constant #9852

Merged
merged 4 commits into from Apr 8, 2024
Merged

Add IS_JETSON constant #9852

merged 4 commits into from Apr 8, 2024

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Apr 7, 2024

@lakshanthad per your earlier comment

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhanced device detection for Raspberry Pi and Jetson platforms in Ultralytics framework.

πŸ“Š Key Changes

  • πŸ“ Added a new function read_device_model() to read device model information efficiently.
  • πŸ”„ Modified is_raspberrypi() and is_jetson() functions to utilize cached device model information for faster and more reliable device checks.
  • 🧰 Introduced PROC_DEVICE_MODEL constant for caching the device model information right at the start, reducing redundant file reads.
  • βž• Added IS_JETSON constant for quick Jetson platform detection across the library.

🎯 Purpose & Impact

  • πŸš€ Faster Device Checks: With the caching of device model info, device checks for Raspberry Pi and Jetson devices become quicker, enhancing the overall performance when these functions are called.
  • πŸ€– Better Support for Edge Devices: By improving the reliability and speed of device detection, developers working on or targeting Raspberry Pi and Jetson platforms will experience smoother integrations and potentially fewer compatibility issues.
  • ⏱ Efficiency Boost: Reducing the need to repeatedly access system files for device model info minimizes I/O operations, leading to slightly better performance and efficiency, especially in environments where such checks are frequent.

@glenn-jocher
Copy link
Member Author

We've now got two separate functions attempting to load and read "/proc/device-tree/model", we should optimize so it's only read once.

Copy link

codecov bot commented Apr 7, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 76.16%. Comparing base (01b34a4) to head (9971d1a).

❗ Current head 9971d1a differs from pull request most recent head 8e39ad2. Consider uploading reports for the commit 8e39ad2 to get more accurate results

Files Patch % Lines
ultralytics/utils/__init__.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9852   +/-   ##
=======================================
  Coverage   76.15%   76.16%           
=======================================
  Files         121      121           
  Lines       15288    15294    +6     
=======================================
+ Hits        11643    11648    +5     
- Misses       3645     3646    +1     
Flag Coverage Ξ”
Benchmarks 36.13% <90.00%> (+0.02%) ⬆️
GPU 38.02% <90.00%> (+0.01%) ⬆️
Tests 71.45% <90.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@glenn-jocher
Copy link
Member Author

Fixed! Proc device model file only read once and now available in the workspace for further hardware discover.

@glenn-jocher glenn-jocher merged commit f2ddc96 into main Apr 8, 2024
@glenn-jocher glenn-jocher deleted the is-jetson branch April 8, 2024 10:25
@lakshanthad
Copy link
Collaborator

Thank you for the addition @glenn-jocher. However, there is a small issue here:
#9876

hmurari pushed a commit to hmurari/ultralytics that referenced this pull request Apr 17, 2024
Co-authored-by: UltralyticsAssistant <web@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.

None yet

3 participants