You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: demo/README.md
+29-6Lines changed: 29 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Navigate to [`http://localhost:8081/`](http://localhost:8081/)
14
14
15
15
Move your cursor around to see the mask prediction update in real time.
16
16
17
-
## Change the image, embedding and ONNX model
17
+
## Export the image embedding
18
18
19
19
In the [ONNX Model Example notebook](https://github.com/facebookresearch/segment-anything/blob/main/notebooks/onnx_model_example.ipynb) upload the image of your choice and generate and save corresponding embedding.
Save the new image and embedding in `/assets/data`and update the following paths to the files at the top of`App.tsx`:
40
+
Save the new image and embedding in `/assets/data`.
41
+
42
+
## Export the ONNX model
43
+
44
+
You also need to export the quantized ONNX model from the [ONNX Model Example notebook](https://github.com/facebookresearch/segment-anything/blob/main/notebooks/onnx_model_example.ipynb).
45
+
46
+
Run the cell in the notebook which saves the `sam_onnx_quantized_example.onnx` file, download it and copy it to the path `/model/sam_onnx_quantized_example.onnx`.
47
+
48
+
Here is a snippet of the export/quantization code:
Optionally you can also export the ONNX model. Currently the example ONNX model from the notebook is saved at `/model/sam_onnx_quantized_example.onnx`.
49
-
50
-
**NOTE: if you change the ONNX model by using a new checkpoint you need to also re-export the embedding.**
51
-
52
75
## ONNX multithreading with SharedArrayBuffer
53
76
54
77
To use multithreading, the appropriate headers need to be set to create a cross origin isolation state which will enable use of `SharedArrayBuffer` (see this [blog post](https://cloudblogs.microsoft.com/opensource/2021/09/02/onnx-runtime-web-running-your-machine-learning-model-in-browser/) for more details)
0 commit comments