xenova / transformers.js

State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!
https://huggingface.co/docs/transformers.js
Apache License 2.0
9.97k stars 589 forks source link

convert.py has errors when i use yolov9 #833

Open jifeng632 opened 4 days ago

jifeng632 commented 4 days ago

Question

your repo https://huggingface.co/Xenova/gelan-c is really good and helpful for me but i need to use the gelan-t, gelan-s edition , coz of mobile phone depoyment

when i u convert.py to convert to onnx edition , errors happen

The checkpoint you are trying to load has model type yolov9 but Transformers does not recognize this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers is out of date

jifeng632 commented 4 days ago

i also tried export.py in yolov9 repo, but when i use the converted onnx model in transformer.js it said model input images is missing , did i missing sth ?

jifeng632 commented 4 days ago

https://huggingface.co/Xenova/gelan-c_all this one has nms?

xenova commented 4 days ago

Hi there 👋 Those models weren't converted using our conversion script - instead, they were exported with https://github.com/WongKinYiu/yolov9/blob/5b1ea9a8b3f0ffe4fe0e203ec6232d788bb3fcff/export.py#L39.

jifeng632 commented 3 days ago

tks https://huggingface.co/Xenova/gelan-c_all or gelan-c also use yolov9 export.py to export the onnx model? i found the xenova/gelan-c_all outputs [xxx, 6] directly but when i export the model, the output is just [84, xxx] i dont know why haha

jifeng632 commented 3 days ago

i check you https://huggingface.co/Xenova/gelan-c_all with netron.ap img_v3_02cd_fcecef1c-badb-4468-ab39-ce96000ec6bh img_v3_02cd_37bd517a-6b60-4fa9-90eb-6cf8c26b57dh

jifeng632 commented 3 days ago

and i use yolov9 export.py my exported model is like this img_v3_02cd_416142c8-7983-49e5-99d4-e0dfdb2e01ch img_v3_02cd_53dfcc3b-6f0b-4ff1-8546-cd56df5fee0h your model already has nms, how can we do this?

xenova commented 3 days ago

Oh right, I patched the modelling code to add the NMS module before exporting to ONNX. I unfortunately don't have access to that code anymore, but it was a simple modification... If I remember correctly, I just modified predict.py to export the model to ONNX after prediction occurs using torch.onnx.export.

jifeng632 commented 3 days ago

thks