Closed lannguyen0910 closed 2 years ago
👋 Hello @lannguyen0910, 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 support@ultralytics.com.
Python>=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
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.
@lannguyen0910 AutoShape() classes act as pass-throughs for Tensor inputs: https://github.com/ultralytics/yolov5/blob/e6e36aac109794999f1dafab244b9ec4887a33d1/models/common.py#L524-L527
@lannguyen0910 AutoShape() classes act as pass-throughs for Tensor inputs:
Thank you for your reply, i have changed the loading from the hub to (based on the hubconf.py
module):
torch.hub.load('ultralytics/yolov5', 'custom', path=weight, autoshape=True, force_reload=True)
But the inference model still returns a Tensor, not a models.common.Detections
object. Could you show me where i was missing or provide me with a more specific solution? Thank you very much!
@lannguyen0910 the only solution is not to supply a Tensor. As I said AutoShape wrappers treat Tensors as passthoughs. You can pass anything else, i.e. files, PIL images, numpy arrays, lists, etc.
@lannguyen0910 the only solution is not to supply a Tensor. As I said AutoShape wrappers treat Tensors as passthoughs. You can pass anything else, i.e. files, PIL images, numpy arrays, lists, etc.
I misunderstood the meaning of "pass-through". Thank you very much for the clarification!
Search before asking
Question
Hi, i'm using
torch.hub.load
to load my custom weights. There is no problem if i use the model input as an image list, which usecv2.imread(IMAGE_PATH)[..., ::-1]
to convert from the path of the image. The output after inference is:However, when i try to load an image in
Tensor
type. Because i use some augmentation techniques liketesting-time augmentation (TTA)
. The result after inference now becomes, for example:Therefore, i cannot use some methods from https://github.com/ultralytics/yolov5/issues/36 to get the
bboxes, classes, scores
such as.pandas()
,.to_json()
.Is there any approach to solve my problem? Thank you so much in advance!
Additional
No response