-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
Save my model and use in my code #9488
Comments
👋 Hello @ilayasis, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://ultralytics.com or email [email protected]. RequirementsPython>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started: git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on macOS, Windows, and Ubuntu every 24 hours and on every commit. |
Can u help me? |
@ilayasis 👋 Hello! Yes you can train a model in Colab and use it anywhere. YOLOv5 🚀 PyTorch Hub models allow for simple model loading and inference in a pure python environment without using Simple Inference ExampleThis example loads a pretrained YOLOv5s model from PyTorch Hub as import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # yolov5n - yolov5x6 official model
# 'custom', 'path/to/best.pt') # custom model
# Images
im = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, URL, PIL, OpenCV, numpy, list
# Inference
results = model(im)
# Results
results.print() # or .show(), .save(), .crop(), .pandas(), etc.
results.xyxy[0] # im predictions (tensor)
results.pandas().xyxy[0] # im predictions (pandas)
# xmin ymin xmax ymax confidence class name
# 0 749.50 43.50 1148.0 704.5 0.874023 0 person
# 2 114.75 195.75 1095.0 708.0 0.624512 0 person
# 3 986.00 304.00 1028.0 420.0 0.286865 27 tie
results.pandas().xyxy[0].value_counts('name') # class counts (pandas)
# person 2
# tie 1 See YOLOv5 PyTorch Hub Tutorial for details. Good luck 🍀 and let us know if you have any other questions! |
|
Hi, i don;t know if it's ok to ask , but maybe u can try to help my in
discord/zoom i try to solve this problem for 2 days
בתאריך יום ב׳, 19 בספט׳ 2022 ב-13:02 מאת Glenn Jocher <
***@***.***>:
… @ilayasis <https://github.com/ilayasis> 👋 Hello! Yes you can train a
model in Colab and use it anywhere.
YOLOv5 🚀 PyTorch Hub <https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading>
models allow for simple model loading and inference in a pure python
environment without using detect.py.
Simple Inference Example
This example loads a pretrained YOLOv5s model from PyTorch Hub as model
and passes an image for inference. 'yolov5s' is the YOLOv5 'small' model.
For details on all available models please see the README
<https://github.com/ultralytics/yolov5#pretrained-checkpoints>. Custom
models can also be loaded, including custom trained PyTorch models and
their exported <https://docs.ultralytics.com/yolov5/tutorials/model_export>
variants, i.e. ONNX, TensorRT, TensorFlow, OpenVINO YOLOv5 models.
import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # yolov5n - yolov5x6 official model
# 'custom', 'path/to/best.pt') # custom model
# Images
im = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, URL, PIL, OpenCV, numpy, list
# Inference
results = model(im)
# Results
results.print() # or .show(), .save(), .crop(), .pandas(), etc.
results.xyxy[0] # im predictions (tensor)
results.pandas().xyxy[0] # im predictions (pandas)
# xmin ymin xmax ymax confidence class name
# 0 749.50 43.50 1148.0 704.5 0.874023 0 person
# 2 114.75 195.75 1095.0 708.0 0.624512 0 person
# 3 986.00 304.00 1028.0 420.0 0.286865 27 tie
results.pandas().xyxy[0].value_counts('name') # class counts (pandas)
# person 2
# tie 1
<https://user-images.githubusercontent.com/26833433/149679662-b2021c78-59b2-4f52-b768-1e5161537c85.png>
See YOLOv5 PyTorch Hub Tutorial
<https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading> for details.
Good luck 🍀 and let us know if you have any other questions!
—
Reply to this email directly, view it on GitHub
<#9488 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AW6VSB5J2M7GBE7I4UMDEZTV7A237ANCNFSM6AAAAAAQP4VGEQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs. Access additional YOLOv5 🚀 resources:
Access additional Ultralytics ⚡ resources:
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 YOLOv5 🚀 and Vision AI ⭐! |
@ilayasis hi, thanks for reaching out. Unfortunately, we can't provide support via Discord or Zoom. Please share your issue here, and I'll do my best to assist you. |
Search before asking
Question
Hii :) ,
I have a training model for my purpose, I create that using yolov5 (s) in google collab,
Now I want to use this model in my own code, in VS code.
but I don't found how I can do it.
Additional
No response
The text was updated successfully, but these errors were encountered: