quic / qidk

Other
105 stars 23 forks source link

model convert error #50

Open sinnuswong opened 5 days ago

sinnuswong commented 5 days ago

Hi, I miss some issue

snpe-onnx-to-dlc -i models/yolo_nas_s.onnx -o models/yolo_nas_s.dlc --out_node 877 --out_node 885 2024-11-20 07:52:50,115 - 235 - INFO - Simplified model validation is successful 2024-11-20 07:52:50,501 - 240 - WARNING - Output node 877, specified via command line, does not exist in graph. 2024-11-20 07:52:50,502 - 240 - WARNING - Output node 885, specified via command line, does not exist in graph. Encountered Error: After pruning disconnected nodes, this model is empty.

Stack Trace: Traceback (most recent call last): File "/opt/qcom/aistack/qairt/2.27.0.240926/bin/x86_64-linux-clang/snpe-onnx-to-dlc", line 62, in optimized_graph = optimizer.optimize(graph) File "/opt/qcom/aistack/qairt/2.27.0.240926/lib/python/qti/aisw/converters/common/converter_ir/op_graph_optimizations.py", line 432, in optimize remove_disconnected_nodes(graph) File "/opt/qcom/aistack/qairt/2.27.0.240926/lib/python/qti/aisw/converters/common/converter_ir/op_graph_optimizations.py", line 1468, in remove_disconnected_nodes raise ValueError("After pruning disconnected nodes, this model is empty.")

quic-vraidu commented 5 days ago

Hi @sinnuswong,

The output node for your onnx yolo nas seems to be different. Please check via netron application.

sinnuswong commented 4 days ago

In GenerateDLC.ipynb from super_gradients.common.object_names import Models model = models.get(Models.YOLO_NAS_S, pretrained_weights=\"coco\")

in the newest repo super_gradients model yolonas_s url is updated to https://sg-hub-nv.s3.amazonaws.com/models/yolo_nas_s_coco.pth I converted to onnx and checked it at neutron the output node is only 887, has no 877 or 855, this caused crash at JNI I think the pretrained yolonas_s model has changed. Do you know where can I download a pretrained pth model that works well at GenerateDLC.ipynb ? @quic-vraidu

quic-vraidu commented 4 days ago

I am not sure how you converted pth -> onnx.

You can follow the steps in GenerateDLC.ipynb by making below modifications in super_gradients in your environment. This works. training/pretrained_models.py:47: "yolo_nas_s_coco": "https://sg-hub-nv.s3.amazonaws.com/models/yolo_nas_s_coco.pth", training/utils/checkpoint_utils.py:316: uniquefilename = url.split("https://sg-hub-nv.s3.amazonaws.com/models/")[1].replace("/", "").replace(" ", "_")