Skip to content

Demo demo failed to start #608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
linzuyw opened this issue Nov 2, 2023 · 9 comments
Open

Demo demo failed to start #608

linzuyw opened this issue Nov 2, 2023 · 9 comments

Comments

@linzuyw
Copy link

linzuyw commented Nov 2, 2023

I feel like there's something missing in it.
lizy
I created a model file
image
There was this mistake again. Is there a god who knows how to run this demo process?

@heyoeyo
Copy link

heyoeyo commented Nov 2, 2023

The first error seems to come from missing the onnx model file, while the second error comes from missing the image embedding.

It sounds like you got the model part working, but just to be sure, the instructions for how to do this can be found on the demo readme, under the Export the ONNX model section. It's more or less just running through the onnx example notebook. I ran into issues exporting the quantized model, due to the quantize_dynamic(...) function being given the argument optimize=True, which apparently isn't valid (at least with the onnx version I installed...?), commenting out that argument prevents the error and the model seems to work fine without it.

The instructions for generating the image embedding are also in the demo readme, under the Export the image embedding section. Unlike creating the model, you have to add/modify the notebook code in order to save the embedding, specifically the line that's missing from the notebook is:

np.save("dogs_embedding.npy", image_embedding)

This can be added to the onnx notebook, about mid-way down in the 'Using an ONNX model' section, just after the image_embedding = ... line. The notebook uses the truck image by default, which you may want to change as well (you have to modify the image that is loaded, which you change in the 'Example Image' section, with image = cv2.imread('path/to/image.jpg')).

Anyways, after placing the model + embedding files in the appropriate folders, you should be able to re-run the demo (using yarn start) and have it work without those errors.

@linzuyw
Copy link
Author

linzuyw commented Nov 2, 2023 via email

@WCH-Jason
Copy link

屏幕截图 2024-10-08 145249
May I ask how to solve this WARNING?

@heyoeyo
Copy link

heyoeyo commented Oct 10, 2024

I haven't seen that sort of warning before, so I'm not really sure of a solution. However, one thing that would be worth trying is to downgrade the install requirements. The SAMv1 repo was released over a year ago and it may be that newer versions of packages have breaking changes compared to what was available when the repo was first released.

That error seems like it might be javascript related, so you could try removing the ^ from the js dependencies and re-installing as a first test. I'm not sure if yarn also matters here, but the version I have installed (that worked for getting the SAM demo working originally) is 1.22.19.

@liufansizhe
Copy link

same error,how to fix

@heyoeyo
Copy link

heyoeyo commented Mar 5, 2025

There's a similar question/solutions in the comments on issue #777

@liufansizhe
Copy link

Image

@liufansizhe
Copy link

what should i do,there are something wrong

@heyoeyo
Copy link

heyoeyo commented Mar 6, 2025

That error is the same as the original post, as far as I can tell.
To fix it, you have to first save the dog image embedding as a .npy file and then export the SAM model as an .onnx file. The instructions for this are given in the demo readme section. There's also some more info in my reply above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants