Closed NarenZen closed 3 years ago
👋 Hello @NarenZen, 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 Glenn Jocher at glenn.jocher@ultralytics.com.
Python>=3.6.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
$ git clone https://github.com/ultralytics/yolov5
$ cd yolov5
$ pip install -r requirements.txt
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If 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.
@NarenZen your workflow is incorrect. See PyTorch Hub tutorial for correct workflow examples.
@glenn-jocher Found the issue
while giving the input to the model.,
reading the image should be done by this way
img = cv2.imread("6.png")[:,:,::-1]
Here is the source image:
When the input is the path., it comes out with correct color(yellow)., but when the input is in numpy array., the umbrella changes to blue color
Here is code which takes input as image path:
import torch
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5m, yolov5l, yolov5x, custom
# Images
img = "6.png"
# Inference
results = model(img)
# Results
results.save()
Here is code which takes input as numpy array:
import torch
import cv2
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5m, yolov5l, yolov5x, custom
# Images
img = cv2.imread("6.png")
# Inference
results = model(img)
# Results
results.save()
Here is the fix:
import torch
import cv2
# Model
model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # or yolov5m, yolov5l, yolov5x, custom
# Images
img = cv2.imread("6.png")[:,:,::-1]
# Inference
results = model(img)
# Results
results.save()
@NarenZen like I said, your workflow is incorrect, and my previous comment points you to the tutorial that contains the correct workflow.
👋 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 ⭐!
this block of code saves the images in different color: https://github.com/ultralytics/yolov5/blob/cd35a009ba964331abccd30f6fa0614224105d39/models/common.py#L368
Here is the output