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

Use older version of ultralytics #11563

Closed
1 task done
zkytony opened this issue May 22, 2023 · 5 comments
Closed
1 task done

Use older version of ultralytics #11563

zkytony opened this issue May 22, 2023 · 5 comments
Labels
bug Something isn't working Stale

Comments

@zkytony
Copy link

zkytony commented May 22, 2023

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

No response

Bug

Due to my environment requirements, I can't work with the latest version of ultralytics, because it requires opencv>=4.6.0, but my system only has opencv 4.5.0. I discovered that ultralytics 8.0.15 permits my opencv version. However, when I try to run the YOLOv5 model with this older ultralytics version, the newest ultralytics is pulled and opencv 4.7.0 is force installed onto my machine. That is not desirable behavior.

I am getting this message when running my code, even though I am not using YOLOv8.

requirements: YOLOv8 requirement "ultralytics>=8.0.100" not found, attempting 
AutoUpdate...

I don't like the fact that ultralytics is trying to update itself (and where does YOLOv8 come from?). Can I just use the earlier package so that it can work with the opencv version in my development environment?

@zkytony zkytony added the bug Something isn't working label May 22, 2023
@glenn-jocher
Copy link
Member

@zkytony hello! Thank you for bringing this to our attention.

I want to let you know that we take all comments seriously. You can try downgrading to an older version of Ultralytics and YOLOv5 if that works for your use case. However, we recommend that you upgrade to the latest Ultralytics version and use the latest version of YOLOv5 for optimal performance and stability.

Regarding the error message you are getting, it seems like the Ultralytics requirements are not being met. However, YOLOv8 is not a valid component in YOLOv5. Can you please confirm the version of YOLOv5 you are using and share the code snippet where this error is occurring? This will help us better understand the issue and assist you further.

Thank you for your patience and cooperation in resolving this issue.

@glenn-jocher
Copy link
Member

@zkytony after looking into this I think you can just git clone and checkout any commit before this PR that added the ultralytics dependency: #11529. Let us know if this helps resolve your issue.

@zkytony
Copy link
Author

zkytony commented May 25, 2023

I think the problem is, the requirements.txt for yolov5 requires

ultralytics>=8.0.100

while the ultralytics package version that has the desired opencv version is 8.0.15. That's why even though I've run pip install ultralytics==8.0.15, when I run yolov5, it force-installed the latest ultralytics version.

For my situation, cloning the repo is not desirable. I hope there is a less hacky way. Let me be clear about my situation/requirements:

  1. I would like to load a custom-trained yolov5 model. The one-liner that I've been using (which has worked well) is:

    yolomodel = torch.hub.load('ultralytics/yolov5', 'custom', path=model_path)

    (that should be the only line of code necessary to load a yolov5 model; I don't want to clone the yolov5 model & figure out how to build it, setting it up etc. Seems too time consuming).

  2. I would like to avoid force-install of ultralytics 8.0.100, if I already have ultralytics 8.0.15 installed.
    (Obviously, it'll be easier and more light-weight for me if the ultralytics package is not required. I just want the one-liner in 1. to work)

@glenn-jocher
Copy link
Member

Hello @zkytony,

Thank you for explaining your situation and requirements. I understand that you would like to avoid force-install of ultralytics 8.0.100, and would like the one-liner you have been using to load yolov5 to work.

I agree with you that cloning the yolov5 repository and building it can be time-consuming. I would like to suggest another approach that may work for you. Instead of using the torch.hub.load method to load the custom model, you can try loading it using the models module included in yolov5 as follows:

from models.experimental import attempt_load
yolomodel = attempt_load(model_path, map_location='cpu')

This method should work with any version of the ultralytics package, and does not require you to force-install 8.0.100.

Please let me know if this works for you, or if you have any other questions or concerns.

Thank you.

@github-actions
Copy link
Contributor

👋 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 ⭐

@github-actions github-actions bot added the Stale label Jun 25, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

2 participants