-
-
Notifications
You must be signed in to change notification settings - Fork 16.4k
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
Remove models and utils folders for detection #1155
Comments
@fjsaezm see export tutorial https://docs.ultralytics.com/yolov5 for standalone YOLOv5 inference. |
BTW, for pytorch inference, the module dependencies are required to be available in your system path. The folders do not need to be at a high level, but they do need to be present, just like you can not run torch commands without importing torch. |
Ok, so I've assumed that these folders will have to be in my system. So now, would It be possible to create a folder like "Resources" in which I will have
And call the detect function from outside this folder? My current Folder distribution is:
Is it possible to call the detect function from a script located in "Root"? I'm trying to do it and I'm getting the exact same error that I mentioned above... |
@fjsaezm you probably want to load YOLOv5 from torch hub, where pytorch automatically downloads the yolov5 repo and adds it to your sys path. You can run inference directly on a PIL image or cv2 image and everything is handled automatically. The torch hub tutorial has recently been updated here: https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading |
Thank you for your answer! However, I think it doesnt solve my problem, since that loads a pretrained YOLOv5 and I'd like to use my own weights. Is there any way to load my weights? Do I have to train it again after loading YOLOv5 from torch hub? Thank you again! |
@fjsaezm you'd need to swap your model params in. There are many pytorch examples on the web for this. |
Hello @fjsaezm ! |
Hey @MuhammadShifa! We currently don't support YOLOv7 as it's not an official release. Regarding combining pose estimation with YOLOv5, you might want to consider creating a custom model that combines both functionalities. Feel free to check out the Ultralytics YOLOv5 documentation for guidance: https://docs.ultralytics.com/yolov5/ 🚀 |
Hi there!
I have trained the model in my own dataset and the results are great! I'm quite happy with it!
Now I want to use the trained model in an app and, in order to save some space, I'd like to have only 1 scripts for it that does the job, and obviously the weights file.
However, if I delete the folders models and utils in order to do inference, I get errors trying to load the weights file with torch.
If I dont delete these folders, the model works perfectly fine.
Is there any way to save the weights or change any configuration so that I don't need to have these 2 folders where I want to make the inference?
Thank you!
The text was updated successfully, but these errors were encountered: