Comments (11)
After I trained a yolov9-e model, I wanted to run inference using detect.py
with
python3 detect.py --weights $EC_MODEL_PATH --conf-thres 0.1 --imgsz 640 --source $EC2_INPUT_PATH --project $EC2_OUTPUT_PATH --device 0 --nosave --save-txt
where $EC_MODEL_PATH
is the path to the model, $EC2_INPUT_PATH
is the place where the images are I want to run the inference for, and $EC2_OUTPUT_PATH
is the path where the output is supposed to be written to.
I run into the error:
[ec2-user@ip-xxx-xxx-xxx-xxx yolov9]$ python3 detect.py --weights $EC_MODEL_PATH --conf-thres 0.1 --imgsz 640 --source $EC2_INPUT_PATH --project $EC2_OUTPUT_PATH --device 0 --nosave --save-txt
detect: weights=['/home/ec2-user/yolo/yolov9//runs/train/yolov9-e4/weights/best.pt'], source=/home/ec2-user/yolo/images/inference/Test/GoPro_Academy_Dubai_vs_Banaat_FC/images_tiled, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.1, iou_thres=0.45, max_det=1000, device=0, view_img=False, save_txt=True, save_conf=False, save_crop=False, nosave=True, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=/home/ec2-user/yolo/yolov9/runs/val/, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False, vid_stride=1
YOLOv5 🚀 v0.1-26-g6d91e97 Python-3.10.9 torch-2.2.1+cu121 CUDA:0 (NVIDIA A10G, 22516MiB)
Fusing layers...
yolov9-e summary: 839 layers, 68547814 parameters, 0 gradients, 240.7 GFLOPs
Traceback (most recent call last):
File "/home/ec2-user/yolo/yolov9/detect.py", line 231, in <module>
main(opt)
File "/home/ec2-user/yolo/yolov9/detect.py", line 226, in main
run(**vars(opt))
File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/ec2-user/yolo/yolov9/detect.py", line 102, in run
pred = non_max_suppression(pred, conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det)
File "/home/ec2-user/yolo/yolov9/utils/general.py", line 905, in non_max_suppression
device = prediction.device
AttributeError: 'list' object has no attribute 'device'
The error got fixed as per Jaykumaran suggestion by chaging line 903 within /utils/general.py
from:
prediction = prediction[0] # select only inference output
to:
prediction = prediction[0][1]
from yolov9.
For list device not found ,under utils->general.py change line 903 as
prediction = prediction[0][1]
for yolov9-c.pt or yolov9-e.pt.
However for yolov9-c-converted you can run repo without any change
from yolov9.
device = prediction[1]
The correct writing should be: "device = prediction.device."
from yolov9.
I do not know meaning of device = prediction[1]
.
from yolov9.
I do not know meaning of
device = prediction[1]
.
应该是书写错误了吧
我在运行detect.py时,发现prediction是[[[tesnor ... ], [tesnor ...]], [[tesnor ... ], [tesnor ...]]],在nms的时候必须按照下面的方式获取数据才不会报错,不知道为何会这样:
if isinstance(prediction, (list, tuple)): # YOLO model in validation model, output = (inference_out, loss_out)
# prediction = prediction[0] # select only inference output yolov9源代码
prediction = prediction[0][0] # select only inference output zqj20240226
# prediction = prediction[0][1] # select only inference output zqj20240226
device = prediction.device
from yolov9.
I do not know meaning of
device = prediction[1]
.应该是书写错误了吧
我在运行detect.py时,发现prediction是[[[tesnor ... ], [tesnor ...]], [[tesnor ... ], [tesnor ...]]],在nms的时候必须按照下面的方式获取数据才不会报错,不知道为何会这样: if isinstance(prediction, (list, tuple)): # YOLO model in validation model, output = (inference_out, loss_out) # prediction = prediction[0] # select only inference output yolov9源代码 prediction = prediction[0][0] # select only inference output zqj20240226 # prediction = prediction[0][0] # select only inference output zqj20240226 device = prediction.device
although not ERROR , only solves the first pic of folder... if you want to apply NMS to every pic, just iterate
from yolov9.
I do not know meaning of
device = prediction[1]
.应该是书写错误了吧
我在运行detect.py时,发现prediction是[[[tesnor ... ], [tesnor ...]], [[tesnor ... ], [tesnor ...]]],在nms的时候必须按照下面的方式获取数据才不会报错,不知道为何会这样: if isinstance(prediction, (list, tuple)): # YOLO model in validation model, output = (inference_out, loss_out) # prediction = prediction[0] # select only inference output yolov9源代码 prediction = prediction[0][0] # select only inference output zqj20240226 # prediction = prediction[0][0] # select only inference output zqj20240226 device = prediction.device
I do not know meaning of
device = prediction[1]
.应该是书写错误了吧
我在运行detect.py时,发现prediction是[[[tesnor ... ], [tesnor ...]], [[tesnor ... ], [tesnor ...]]],在nms的时候必须按照下面的方式获取数据才不会报错,不知道为何会这样: if isinstance(prediction, (list, tuple)): # YOLO model in validation model, output = (inference_out, loss_out) # prediction = prediction[0] # select only inference output yolov9源代码 prediction = prediction[0][0] # select only inference output zqj20240226 # prediction = prediction[0][1] # select only inference output zqj20240226 device = prediction.device
Why are there two results and there is a difference between them?
from yolov9.
For list device not found ,under utils->general.py change line 903 as
prediction = prediction[0][1]
for yolov9-c.pt or yolov9-e.pt. However for yolov9-c-converted you can run repo without any change
Thanks a lot, it works.
from yolov9.
detect.py working on Kaggle after using
prediction = prediction[0][1] in /utils/general.py
from yolov9.
yolo-*.yaml
: use detect_dual.py
.
gelan-*.yaml
: use detect.py
.
from yolov9.
yolo-*.yaml
: usedetect_dual.py
.
gelan-*.yaml
: usedetect.py
.
Mark. Thank you
from yolov9.
Related Issues (20)
- Weights used for yolov9.yaml cfg
- [Useful Link] Deploy YOLOv9 on Qualcomm NPU-HTP
- Error while loading custom trained model HOT 4
- WorkNCCL(OpType=ALLREDUCE, Timeout(ms)=1800000) ran for 1801678 milliseconds before timing out. HOT 4
- issue of pt to onnx HOT 3
- How to update class names after model has already been trained? HOT 1
- File "/root/yolov9-main/utils/general.py", line 947, in non_max_suppression x = x.T[xc[xi]] # confidence IndexError
- The GPU memory usage seems to be unstable. When setting the batch size to 16 for the smallest model, the GPU memory usage exceeds 24GB.
- Hello, I would like to ask if there is any difference between SPPF and SPPFELAN?
- turning off the AMP in yolov9/train.py
- SSL Certificate Verification Error During YOLOv9 Training HOT 1
- 进行训练时不运行 HOT 1
- Auto anchor seem not run when custom data have long box HOT 2
- COnvert custom yolov9 model trained into tflite format
- pt to onnx and How to use onnx model HOT 1
- yolov9 for custom model on macos just sucks?!!!! HOT 1
- AttributeError: 'DualDDetect' object has no attribute 'nm' HOT 1
- YOLOv9 DDP training with COCO
- Generating or Plotting a 'result.png' from 'result.csv' HOT 1
- Running custom model detection on GPU fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yolov9.