YOLO-World icon indicating copy to clipboard operation
YOLO-World copied to clipboard

onnx模型导出成功,但是运行推理失败。

Open Meicsu199345 opened this issue 1 year ago • 2 comments
trafficstars

感谢非常好的工作。 如题,参考:https://github.com/AILab-CVC/YOLO-World/blob/master/deploy/easydeploy/docs/model_convert.md

生成onnx成功: PYTHONPATH=./ /mnt/bn/tob-lq/miniconda3/envs/yolo-world/bin/python deploy/export_onnx.py configs/finetune_coco_tob/yolo_world_v2_l_vlpan_bn_sgd_1e-3_40e_8gpus_finetune_coco88.py work_dirs/yolo_world_v2_l_vlpan_bn_sgd_1e-3_40e_8gpus_finetune_coco88/epoch_1.pth --custom-text coco_80_cls_name_list.json --opset 11

但是运行 推理报错: python main_onnxruntime.py
"image_path_to_detect"
/mnt/bn/tob-lq/code/yolo/YOLO-World/work_dirs/epoch_1.onnx
--out-dir work_dir
--img-size 640 640
--show
--score-thr 0.3
--iou-thr 0.7

Traceback (most recent call last): File "/mnt/bn/tob-lq/code/yolo/YOLO-World/projects/easydeploy/examples/main_onnxruntime.py", line 110, in main() File "/mnt/bn/tob-lq/code/yolo/YOLO-World/projects/easydeploy/examples/main_onnxruntime.py", line 63, in main model_type = ModelType(args.type.lower()) AttributeError: 'NoneType' object has no attribute 'lower' image

发现要加一个type,加完以后新的错误 python main_onnxruntime.py /mnt/bn/tob-lq/code/yolo/YOLO-World/vulgar_multi_cls_20240129_27410.jpg /mnt/bn/tob-lq/code/yolo/YOLO-World/work_dirs/epoch_1.onnx --type yolov8 --out-dir work_dir --img-size 640 640 --show --score-thr 0.3 --iou-thr 0.7 请问如何解决呀,请问有没有具体的例子 image

我换成 easy_deploy里面的导出代码: python ./projects/easydeploy/tools/export_onnx.py
configs/finetune_coco_tob/yolo_world_v2_l_vlpan_bn_sgd_1e-3_40e_8gpus_finetune_coco88.py
work_dirs/yolo_world_v2_l_vlpan_bn_sgd_1e-3_40e_8gpus_finetune_coco88/epoch_1.pth
--work-dir work_dir
--img-size 640 640
--batch 1
--device cuda:0
--simplify
--opset 11
--backend 1
--pre-topk 1000
--keep-topk 100
--iou-threshold 0.65
--score-threshold 0.25

img_v3_02bb_95df6a3f-fa4f-462b-b80d-474d14b2662g

x created! Traceback (most recent call last): File "/mnt/bn/tob-lq/code/yolo/YOLO-World/./projects/easydeploy/tools/export_onnx.py", line 157, in main() File "/mnt/bn/tob-lq/code/yolo/YOLO-World/./projects/easydeploy/tools/export_onnx.py", line 116, in main deploy_model(fake_input) File "/mnt/bn/tob-lq/miniconda3/envs/yolo-world/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "/mnt/bn/tob-lq/code/yolo/YOLO-World/projects/easydeploy/model/model.py", line 176, in forward neck_outputs = self.baseModel(inputs) File "/mnt/bn/tob-lq/miniconda3/envs/yolo-world/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "/mnt/bn/tob-lq/miniconda3/envs/yolo-world/lib/python3.9/site-packages/mmdet/models/detectors/base.py", line 96, in forward return self._forward(inputs, data_samples) File "/mnt/bn/tob-lq/code/yolo/YOLO-World/yolo_world/models/detectors/yolo_world.py", line 69, in _forward img_feats, txt_feats = self.extract_feat(batch_inputs, File "/mnt/bn/tob-lq/code/yolo/YOLO-World/yolo_world/models/detectors/yolo_world.py", line 80, in extract_feat texts = self.texts File "/mnt/bn/tob-lq/miniconda3/envs/yolo-world/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1185, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'YOLOWorldDetector' object has no attribute 'texts'

Meicsu199345 avatar May 29 '24 07:05 Meicsu199345

同样的问题, 请问有解决么?

kezhang-cs avatar Jul 09 '24 18:07 kezhang-cs

同样的问题, 请问有解决么?

andynnnnn avatar Jul 11 '24 08:07 andynnnnn