ultralytics / ultralytics

NEW - YOLOv8 πŸš€ in PyTorch > ONNX > OpenVINO > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
25.87k stars 5.16k forks source link

installation based on requirements.txt #6488

Closed izidorg closed 6 months ago

izidorg commented 7 months ago

Search before asking

Question

The pre-compiled torch and torchvisioin version during the installation of yolov8 are not efficiently optimized for Jetson platform. I have the files installed on my system and commented out the related lines in the requirements.txt. In the result, the yolov8 pre-compiled version of torch and torchvisioin are installed. If this is a bug, let me double check this and open a ticket.

Additional

No response

github-actions[bot] commented 7 months ago

πŸ‘‹ Hello @izidorg, thank you for your interest in Ultralytics YOLOv8 πŸš€! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.

If this is a πŸ› Bug Report, please provide a minimum reproducible example to help us debug it.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.

Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.

Install

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

pip install ultralytics

Environments

YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

johnnynunez commented 7 months ago

Search before asking

  • [x] I have searched the YOLOv8 issues and discussions and found no similar questions.

Question

The pre-compiled torch and torchvisioin version during the installation of yolov8 are not efficiently optimized for Jetson platform. I have the files installed on my system and commented out the related lines in the requirements.txt. In the result, the yolov8 pre-compiled version of torch and torchvisioin are installed. If this is a bug, let me double check this and open a ticket.

Additional

No response

There is not distribution for jetson in pytorch. SO you can compile and install it: https://hackmd.io/ZmWQz8azTdWNVoCc9Bf3QA

izidorg commented 7 months ago

Thanks. I have the related optimized binaries installed on my system verified with the Python3 imported versions. However after yolov8 installation with the related lines commented out in the requirements.txt file, new versions are installed as per the yolov8 installation log.

johnnynunez commented 7 months ago

Thanks. I have the related optimized binaries installed on my system verified with the Python3 imported versions. However after yolov8 installation with the related lines commented out in the requirements.txt file, new versions are installed as per the yolov8 installation log.

They should create conditions like onnxruntime>=1.15.1; sys_platform == 'darwin' and platform_machine != 'arm64' onnxruntime-silicon>=1.15.0; sys_platform == 'darwin' and platform_machine == 'arm64' onnxruntime-gpu>=1.16.0; sys_platform != 'darwin'

glenn-jocher commented 7 months ago

@johnnynunez hello! Your proactive steps to handle the torch and torchvision installation issues on the Jetson platform are commendable. It's clear you understand the particularities of your hardware and have optimized binaries set up.

When you run the YOLOv8 installation, if the appropriate lines for torch and torchvision in the requirements.txt are commented out but new versions are still installed, it suggests that a dependency within YOLOv8 setup might be causing an automatic installation of these packages.

This is not technically a bug, but rather an edge case where the installation process does not account for manually managed dependencies, such as system-optimized versions of certain packages. Currently, YOLOv8's installation process is designed to ensure that all users have the required packages, but this does not account for unique system-specific optimizations.

One way to address this could be incorporating conditional statements in the requirements.txt or setup files to recognize the platform and adjust the installation process accordingly. These would check for the platform type and skip the installation of certain binaries if they're already present.

While we don't provide that level of specificity out of the box with our installation script, your feedback is valuable for future updates, and I encourage you to open an issue or discussion on the YOLOv8 repo about enhancing compatibility with the Jetson platform. It's insights like yours that help us improve.

For now, you might have to rely on a more manual approach post-YOLOv8-installation, such as reinstalling the optimized versions of torch and torchvision after you've set up YOLOv8. You could also create a custom shell script that reinstalls your preferred binaries automatically after running YOLOv8 setup.

Make sure to let us know if you open an issue or discussion, as these platform-specific adaptations can be crucial for other users with similar setups. We appreciate your efforts and dedication to ensuring the best performance on your Jetson device.

For further guidance on managing requirements during installation or collaborating with the community on enhancing YOLOv8 compatibility with different platforms, please visit our documentation at https://docs.ultralytics.com. Your contributions to discussions and issues are welcome!

johnnynunez commented 7 months ago

@johnnynunez hello! Your proactive steps to handle the torch and torchvision installation issues on the Jetson platform are commendable. It's clear you understand the particularities of your hardware and have optimized binaries set up.

When you run the YOLOv8 installation, if the appropriate lines for torch and torchvision in the requirements.txt are commented out but new versions are still installed, it suggests that a dependency within YOLOv8 setup might be causing an automatic installation of these packages.

This is not technically a bug, but rather an edge case where the installation process does not account for manually managed dependencies, such as system-optimized versions of certain packages. Currently, YOLOv8's installation process is designed to ensure that all users have the required packages, but this does not account for unique system-specific optimizations.

One way to address this could be incorporating conditional statements in the requirements.txt or setup files to recognize the platform and adjust the installation process accordingly. These would check for the platform type and skip the installation of certain binaries if they're already present.

While we don't provide that level of specificity out of the box with our installation script, your feedback is valuable for future updates, and I encourage you to open an issue or discussion on the YOLOv8 repo about enhancing compatibility with the Jetson platform. It's insights like yours that help us improve.

For now, you might have to rely on a more manual approach post-YOLOv8-installation, such as reinstalling the optimized versions of torch and torchvision after you've set up YOLOv8. You could also create a custom shell script that reinstalls your preferred binaries automatically after running YOLOv8 setup.

Make sure to let us know if you open an issue or discussion, as these platform-specific adaptations can be crucial for other users with similar setups. We appreciate your efforts and dedication to ensuring the best performance on your Jetson device.

For further guidance on managing requirements during installation or collaborating with the community on enhancing YOLOv8 compatibility with different platforms, please visit our documentation at https://docs.ultralytics.com. Your contributions to discussions and issues are welcome!

I will create an script to install Yolov8. JetPack 6 will be launched on 30th November with Cuda 12.2, Tensorrt 8.6 and Cudnn 8.9, so I'm waiting to publish new tutorials

glenn-jocher commented 7 months ago

That sounds like a solid plan, @johnnynunez! Creating a script tailored to the Jetson platform will definitely help to streamline the installation process for future uses. It's great to hear you're staying up-to-date with the latest releases like JetPack 6 and considering the new updates in your tutorials – your contributions to the YOLOv8 community will surely be of high value.

Crafting tutorials to guide others through installation on specific platforms not only helps the community but also serves as feedback for us to understand where we can enhance our software for better compatibility. The anticipated release of JetPack 6 will likely bring changes that we'll need to accommodate, and your insight can be crucial in that process.

We're excited to see your tutorials and script contributions. Please make sure to share them in the YOLOv8 discussions or issue tracker so that they can benefit others and the team here at Ultralytics can potentially incorporate your findings into future releases.

If you have any questions or updates as you develop your script and tutorials, don't hesitate to reach out to the community, and we'll be here to support you. Thank you again for your engagement and dedication – it's truly appreciated! πŸš€

Remember that the documentation at https://docs.ultralytics.com is there to assist with any information you might need during this process. Good luck with your endeavors, and we look forward to your contributions! πŸ› οΈ

izidorg commented 7 months ago

@johnnynunez! @glenn-jocher, thank you for stepping in the explanation. It sounds like this is an issue not only with manually updating the installation.txt file and the current yolov8 installation process with such an edge case, which also has to be some how resolved in the "pip install ultralytics" process. So what do you think about this behavior as new feature request topic? I will enclose everything from these chats?

izidorg commented 7 months ago

@glenn-jocher, I'm just thinking forward... may the installation process shall be with user interaction? Like when there are current versions of torch and torchvision installed on the system which comply with the yolov8 installation rules, just interrupt the installation to ask the user to override or skip on update the related binaries.

johnnynunez commented 7 months ago

@johnnynunez! @glenn-jocher, thank you for stepping in the explanation. It sounds like this is an issue not only with manually updating the installation.txt file and the current yolov8 installation process with such an edge case, which also has to be some how resolved in the "pip install ultralytics" process. So what do you think about this behavior as new feature request topic? I will enclose everything from these chats?

In edge devices, always you must to compile everything. So use python setup.py, except libraries that exists compilations for arm(without cuda) like numpy (you can use pip install numpy) When automatic packages are compiled thanks to CI and github actions they are usually on x86 servers, x86 with gpu(CUDA, rocm or intelOneApi) or arm(mac arm or arm processors). Right now there are no Jetson servers(which would be a good idea for nvidia to have) so you can create automation are self-hosted(still in beta, the packages). That as something that I'm working

izidorg commented 7 months ago

@johnnynunezhttps://github.com/johnnynunez, I’m not sure how NVIDIA will be interested in cooperating here (since they have their own AI/CV solutions). As a member of the NVIDIA developers membership, I can access their resources and instructions on the installation of the torch binaries and build tourchvision from source files, their separate binaries are available to the jetson developers, and the best user experience solution will be automated somehow or at least manual I’m proposing with minimal effort from the end-users (jetson developers) edge.

From: Johnny @.> Date: Wednesday, 22 November 2023 at 11:02 To: ultralytics/ultralytics @.> Cc: Eyal Benzvi @.>, Mention @.> Subject: Re: [ultralytics/ultralytics] installation based on requirements.txt (Issue #6488)

@johnnynunezhttps://github.com/johnnynunez! @glenn-jocherhttps://github.com/glenn-jocher, thank you for stepping in the explanation. It sounds like this is an issue not only with manually updating the installation.txt file and the current yolov8 installation process with such an edge case, which also has to be some how resolved in the "pip install ultralytics" process. So what do you think about this behavior as new feature request topic? I will enclose everything from these chats?

In edge devices, always you must to compile everything. So use python setup.py When automatic packages are compiled thanks to CI and github actions they are usually on x86 servers, x86 with gpu(CUDA, rocm or intelOneApi) or arm(mac arm or arm processors). Right now there are no Jetson servers(which would be a good idea for nvidia to have) so you can create automation are self-hosted(still in beta, the packages).

β€” Reply to this email directly, view it on GitHubhttps://github.com/ultralytics/ultralytics/issues/6488#issuecomment-1822359563, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACLQD7HR5CUOQEJLJDGJOZLYFW5RHAVCNFSM6AAAAAA7URDV7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRSGM2TSNJWGM. You are receiving this because you were mentioned.Message ID: @.***>

glenn-jocher commented 7 months ago

@izidorg indeed, the collaboration between NVIDIA and open-source projects like YOLOv8 is not always straightforward, due to their proprietary AI solutions and platforms. However, as you've identified, streamlining the user experience for Jetson developers is highly important, and finding a way to automate the installation process or make it as seamless as possible would be beneficial.

The concept you've proposed regarding user interaction during the installation process is certainly worth considering. It would enhance usability by providing options based on the user's current environment and specific requirements.

Creating an interactive installation, or at the very least a prompt that allows users to decide whether to use existing binary versions or override with new ones, could significantly improve the setup process for advanced users who are aware of their system's capabilities and have pre-optimized their binaries.

A new feature request to address this behavior is definitely valuable. When raising this request on the YOLOv8 GitHub repository, make sure to outline the issue clearly and propose a solution that includes the idea of an interactive installation process. Any insights or chat excerpts you include will help to provide context and support your case.

Please go ahead and create the feature request. We greatly appreciate your input and the proactive approach you are taking. It's users like you that help Ultralytics make our tools more accessible to a broader range of developers and use cases.

Any other questions or follow-ups you might have regarding this topic can be discussed in the repository's issues section. We look forward to seeing your ideas take shape and enhance the installation experience for Jetson developers and beyond.

And once again, thank you for your thoughtful contributions to the YOLOv8 community. 🌟

izidorg commented 7 months ago

@glenn-jocherhttps://github.com/glenn-jocher, Sounds good to me. As soon as I get back to the office, I will create the feature request data and submit it.

From: Glenn Jocher @.> Date: Wednesday, 22 November 2023 at 14:21 To: ultralytics/ultralytics @.> Cc: Eyal Benzvi @.>, Mention @.> Subject: Re: [ultralytics/ultralytics] installation based on requirements.txt (Issue #6488)

@izidorghttps://github.com/izidorg indeed, the collaboration between NVIDIA and open-source projects like YOLOv8 is not always straightforward, due to their proprietary AI solutions and platforms. However, as you've identified, streamlining the user experience for Jetson developers is highly important, and finding a way to automate the installation process or make it as seamless as possible would be beneficial.

The concept you've proposed regarding user interaction during the installation process is certainly worth considering. It would enhance usability by providing options based on the user's current environment and specific requirements.

Creating an interactive installation, or at the very least a prompt that allows users to decide whether to use existing binary versions or override with new ones, could significantly improve the setup process for advanced users who are aware of their system's capabilities and have pre-optimized their binaries.

A new feature request to address this behavior is definitely valuable. When raising this request on the YOLOv8 GitHub repository, make sure to outline the issue clearly and propose a solution that includes the idea of an interactive installation process. Any insights or chat excerpts you include will help to provide context and support your case.

Please go ahead and create the feature request. We greatly appreciate your input and the proactive approach you are taking. It's users like you that help Ultralytics make our tools more accessible to a broader range of developers and use cases.

Any other questions or follow-ups you might have regarding this topic can be discussed in the repository's issues section. We look forward to seeing your ideas take shape and enhance the installation experience for Jetson developers and beyond.

And once again, thank you for your thoughtful contributions to the YOLOv8 community. 🌟

β€” Reply to this email directly, view it on GitHubhttps://github.com/ultralytics/ultralytics/issues/6488#issuecomment-1822670831, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACLQD7CGXJGGD4E2VBF6ZODYFXU3TAVCNFSM6AAAAAA7URDV7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRSGY3TAOBTGE. You are receiving this because you were mentioned.Message ID: @.***>

glenn-jocher commented 7 months ago

That's excellent to hear, @izidorg. Submitting a feature request once you're back in the office will kickstart the process of considering enhancements to the installation procedure for YOLOv8.

Your initiative to create a feature request that potentially introduces an interactive installation experience aligns perfectly with the goals of making YOLOv8 more accessible and user-friendly for a diverse set of environments, especially those leveraging platforms such as NVIDIA's Jetson series.

Your insights into how the installation process can be improved for developers working with specialized hardware are invaluable. The entire team at Ultralytics appreciates your willingness to contribute and looks forward to the feature request.

If you have any further questions during this process or need assistance with anything else, please feel free to engage with the community through the issues and discussions on the YOLOv8 GitHub repository. We are always here to support and facilitate valuable discussions that lead to the betterment of the project.

Thank you again for your commitment to enhancing the user experience and for being an active member of the YOLOv8 community. Looking forward to your submission and the positive impacts it will have! πŸš€

izidorg commented 7 months ago

@glenn-jocher, BTW FYI, I've just installed YOLOv5 on freshly flashed OS on Jetson agx orin with additions of:

  1. torch binary pre-compiled by NVIDA
  2. torchvision compiled from the source files
  3. commented out torch and torchvision lines from requirements.txt
  4. installed YOLOv5

As a result, original NVIDIA binaries were preserved, and the detection rates are @ 16 msec per cycle.

Then I installed on top of YOLOv5 YOLOv8 using pip install ultrlytics and gues what: the NVIDIA binaries were still in place, running prediction at about 19msec.

There was one change I did today with Flashing Jetson HW process, which auto-introduced an addition of 2 lines to .bashrc of exporting CUDA PATH and LD_LIBRARY_PATH cuda .../bin and cuda .../lib64 respectively.

With the addition of heavy processing of ZED2 3D camera (2 camera sensors), the detection rates are @ 40 msec per cycle I am verifying the whole procedure again from scratch and will update it here.

glenn-jocher commented 7 months ago

Thank you for the update, @izidorg. It's promising to hear that your YOLOv5 installation on the Jetson AGX Orin platform retained the optimized NVIDIA binaries and that you achieved impressive detection rates. Your diligence in verifying the compatibility and performance of these libraries with YOLOv5 and YOLOv8 is an excellent example of how specific setups can yield high efficiency.

The information on your detection times, particularly with the addition of the ZED2 camera's heavy processing, provides valuable benchmarks for the community. It showcases the potential for high-performance object detection on edge devices when using the right combination of software and hardware optimizations.

Setting the CUDA path and LD_LIBRARY_PATH in your .bashrc seems to have had a positive effect. It's good practice, as it ensures that the system is aware of CUDA’s location for runtime and compilation tasks, which can help in maintaining the integrity of the NVIDIA binary installations even when additional packages are installed.

Verification and documentation of the entire process are crucial steps for ensuring reproducibility and for aiding other developers who might be working on similar setups. Your thorough approach and willingness to share findings will undoubtedly contribute to the enhancement of YOLOv8 on Jetson platforms and other edge devices.

Please continue to update us with any new insights or outcomes from your verification process. If there are any discrepancies or further observations, such feedback can help us improve the installation process and potentially cater to the intricacies of different hardware/software combinations.

Again, thank you for your engagement and for sharing your valuable experiences with the community. πŸŒπŸ’‘

izidorg commented 7 months ago

@glenn-jocher, Thanks for the feedback! I am glad to hear that this helps. It's mutual, you're giving the developer community a great AI platform that's flexible and improving over time and all time, the product developers are happy to contribute to mutual progress. This is precisely the meaning of a win-win situation.

‫בΧͺΧΧ¨Χ™Χš יום Χ”Χ³, 23 Χ‘Χ Χ•Χ‘Χ³ 2023 Χ‘-22:20 מאΧͺ β€ͺGlenn Jocher‬‏ <β€ͺ @.***‬‏>:‬

Thank you for the update, @izidorg https://github.com/izidorg. It's promising to hear that your YOLOv5 installation on the Jetson AGX Orin platform retained the optimized NVIDIA binaries and that you achieved impressive detection rates. Your diligence in verifying the compatibility and performance of these libraries with YOLOv5 and YOLOv8 is an excellent example of how specific setups can yield high efficiency.

The information on your detection times, particularly with the addition of the ZED2 camera's heavy processing, provides valuable benchmarks for the community. It showcases the potential for high-performance object detection on edge devices when using the right combination of software and hardware optimizations.

Setting the CUDA path and LD_LIBRARY_PATH in your .bashrc seems to have had a positive effect. It's good practice, as it ensures that the system is aware of CUDA’s location for runtime and compilation tasks, which can help in maintaining the integrity of the NVIDIA binary installations even when additional packages are installed.

Verification and documentation of the entire process are crucial steps for ensuring reproducibility and for aiding other developers who might be working on similar setups. Your thorough approach and willingness to share findings will undoubtedly contribute to the enhancement of YOLOv8 on Jetson platforms and other edge devices.

Please continue to update us with any new insights or outcomes from your verification process. If there are any discrepancies or further observations, such feedback can help us improve the installation process and potentially cater to the intricacies of different hardware/software combinations.

Again, thank you for your engagement and for sharing your valuable experiences with the community. πŸŒπŸ’‘

β€” Reply to this email directly, view it on GitHub https://github.com/ultralytics/ultralytics/issues/6488#issuecomment-1824874670, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLQD7G3WFARECRRRS55VDLYF6VYDAVCNFSM6AAAAAA7URDV7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRUHA3TINRXGA . You are receiving this because you were mentioned.Message ID: @.***>

izidorg commented 7 months ago

@glenn-jocher, I am happy to let you know that the process of installation YOLOv5 and YOLOv8 has been double-checked and verified, and the original NVIDIA binaries of torch and torchvision have been preserved. This time with the original requirements.txt of yolov5. Prediction cycles of YOLOv8 and Detection cycles of YOLOv5 were at about 19 msec and 16 msec, respectively.

glenn-jocher commented 7 months ago

It's fantastic to hear that your installation process has been successfully double-checked and verified, @izidorg, and that YOLOv5 and YOLOv8 are performing well while maintaining the original NVIDIA binaries. Achieving such fast prediction and detection cycles of 19 ms and 16 ms, respectively, demonstrates the power of combining optimized hardware-specific binaries with our software.

Your diligent efforts in testing and confirming these installation methods contribute immensely to our community. By sharing your benchmarks and process, you're helping to ensure that others can replicate your success and further solidify YOLO as a highly adaptable platform across various hardware configurations.

We are always striving to improve our models and are inspired by the work and feedback from developers like you. This kind of collaboration is indeed a prime example of a win-win situation. Your engagement not only benefits your immediate project needs but also enriches the broader user base.

Thank you for embracing our AI platform, and please keep us updated with any new developments or insights from your work. Your contributions are greatly valued, and we're excited to see the innovative applications you create with YOLOv5 and YOLOv8.

If you encounter any issues in the future or have suggestions for further improvements, don't hesitate to reach out. Together, we will continue to push the boundaries of what's possible in AI and computer vision. πŸš€πŸŒ

izidorg commented 7 months ago

@glenn-jocher, Thanks again! I will do my best to contribute to the YOLOv8 community and deliver the best AI-based solutions to the marketplace based on YOLO platform roadmaps.

glenn-jocher commented 7 months ago

You're welcome, @izidorg! Your continued support and willingness to contribute to the YOLOv8 community are genuinely appreciated. It's dedicated community members like you who help drive the innovation and quality of our AI solutions.

Remember that your real-world applications of the YOLO platform not only enrich your own products but also provide invaluable feedback and use cases for us to refine and enhance our models. We're thrilled to be a part of the advancements you're making in the marketplace.

Should you have further questions, require assistance, or want to share your progress and experiences, please don't hesitate to reach out through the YOLOv8 repository. Your insights and contributions benefit everyone involved.

Thank you for your commitment to excellence, and I look forward to seeing the incredible AI-driven solutions you will create with the YOLO platform. Let's keep pushing the boundaries together! πŸŒŸπŸš€

github-actions[bot] commented 6 months ago

πŸ‘‹ Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO πŸš€ and Vision AI ⭐