SysCV / sam-hq

Segment Anything in High Quality [NeurIPS 2023]
https://arxiv.org/abs/2306.01567
Apache License 2.0
3.73k stars 224 forks source link

Error when trying to load embedding image in browser using onnx #70

Open moneyhotspring opened 1 year ago

moneyhotspring commented 1 year ago

Error: input 'interm_embeddings' is missing in 'feeds'. at d.run (ort.min.js:6:1) at runONNX (App.tsx:118:1) at App.tsx:96:1 at commitHookEffectListMount (react-dom.development.js:23150:1) at commitPassiveMountOnFiber (react-dom.development.js:24931:1) at commitPassiveMountEffects_complete (react-dom.development.js:24891:1) at commitPassiveMountEffects_begin (react-dom.development.js:24878:1) at commitPassiveMountEffects (react-dom.development.js:24866:1) at flushPassiveEffectsImpl (react-dom.development.js:27039:1) at flushPassiveEffects (react-dom.development.js:26984:1)

crapthings commented 12 months ago

same same here

crapthings commented 12 months ago

i've tried the original sam exporting, its working. but same process to export onnx doesn't work with official react demo.

i think maybe its in different form?

image

maybe convert these code to javascript? but how?

embed_size = sam.prompt_encoder.image_embedding_size

encoder_embed_dim_dict = {"vit_b":768,"vit_l":1024,"vit_h":1280}
encoder_embed_dim = encoder_embed_dim_dict[model_type]

"interm_embeddings": torch.randn(4, 1, *embed_size, encoder_embed_dim, dtype=torch.float),
crapthings commented 12 months ago
image

its working, but slow