Closed breaveSun closed 1 year ago
👋 Hello @breaveSun, 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, validation, inference, export and benchmarks on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
Tensor has no pandas in it, it's not a (model) zoo
@breaveSun tensor inputs are currently handled differently, but there is a PR to change that in https://github.com/ultralytics/yolov5/pull/10139
Quick fix is to pass your image path directly rather than doing all the preprocessing you have:
results = model('/yolov5/data/images/zidane.jpg')
code: yolo_model = torch.hub.load(repo_or_dir='/yolov5', model='yolov5s',pretrained=True,source='local',device='cpu') results = model('/yolov5/data/images/zidane.jpg')
The problem has been solved. thank you~
@breaveSun you're welcome! If you have any more questions or need further assistance, feel free to ask. Good luck with your YOLOv5 project!
Search before asking
Question
code : yolo_model = torch.hub.load(repo_or_dir='/yolov5', model='yolov5s',pretrained=True,source='local') img = Image.open('/yolov5/data/images/zidane.jpg').resize((640,480),Image.Resampling.LANCZOS) img = torch.tensor(np.array(img)).permute((2,0,1)).unsqueeze(0) img = img.float()/255 img = img.cuda() result = model(img) print(result.pandas()) print result: tensor([[[3.86082e+00, 3.59408e+00, 8.77209e+00, ..., 1.26700e-03, 6.60222e-04, 2.63195e-03], [1.33856e+01, 4.16720e+00, 2.75875e+01, ..., 1.48501e-03, 1.06083e-03, 2.77131e-03], [1.82907e+01, 4.55514e+00, 3.32699e+01, ..., 1.20625e-03, 7.86196e-04, 2.23856e-03], ..., [5.69853e+02, 4.47487e+02, 1.29333e+02, ..., 1.77663e-03, 1.07624e-03, 6.96758e-04], [5.93650e+02, 4.41728e+02, 9.77063e+01, ..., 1.53087e-03, 8.04971e-04, 6.77827e-04], [6.14671e+02, 4.49220e+02, 1.13250e+02, ..., 1.52358e-03, 7.78174e-04, 7.11288e-04]]], device='cuda:0'), [tensor([[[[[-3.47987e-02, -1.01568e-01, -1.26982e-01, ..., -6.66984e+00, -7.32227e+00, -5.93739e+00], [ 3.49940e-01, 4.18052e-02, 1.58899e+00, ..., -6.51085e+00, -6.84764e+00, -5.88566e+00], [-4.34023e-01, 1.39009e-01, 2.33833e+00, ..., -6.71903e+00, -7.14752e+00, -6.09968e+00], ..., [ 1.16358e+00, 8.81170e-02, 1.41824e+00, ..., -6.71834e+00, -7.38348e+00, -5.88806e+00], [ 3.59448e-01, 1.38850e-01, 1.19550e+00, ..., -6.52709e+00, -7.24878e+00, -6.24815e+00], [-3.26910e-02, 1.57553e-01, -1.50827e-02, ..., -6.67337e+00, -7.35457e+00, -6.04706e+00]],
……………………
errmsg: Traceback (most recent call last): File "/home/huhu/catkin_ws/devel/lib/guge_test/multi_mediapipe3d.py", line 15, in
exec(compile(fh.read(), python_script, 'exec'), context)
File "/home/huhu/catkin_ws/src/guge_test/scripts/multi_mediapipe3d.py", line 60, in
print(result.pandas())
AttributeError: 'tuple' object has no attribute 'pandas'
Additional
No response