Comments (14)
@ArielleBF, @ximitiejiang, @chenin-wang, @alanzhai219, @fPecc, @kaka-lin, @lxfater, @mchaniotakis, EfficientSAM onnx files are available at Hugging Face Space. The export script and running example are provided. Feel free to give it a try.
from efficientsam.
@ArielleBF, @ximitiejiang, @chenin-wang, @alanzhai219, @fPecc, @kaka-lin, @lxfater, @mchaniotakis, EfficientSAM onnx files are available at Hugging Face Space. The export script and running example are provided. Feel free to give it a try.
Thanks yformer ~
I also create TensorFlow2.x version and coverted to tflite
model
If anyone need to use tflite to inference please check here EfficientSAM-tf2-demo.
Thanks!!!
from efficientsam.
Thanks yformer <3
FYI for other readers; the export tooling is on this repository
EfficientSAM/export_to_onnx.py
Lines 63 to 78 in c9408a7
from efficientsam.
same question.
from efficientsam.
@ArielleBF @ximitiejiang can you share more information on the export? I will try to export one and share it.
from efficientsam.
@ArielleBF @ximitiejiang can you share more information on the export? I will try to export one and share it.
When I try to export the image_encoder model using torch.onnx.export, a bug occurred.It is possible that the bug is caused by incompatibility between the jit format file and onnx during the export.
from efficientsam.
hello, i tried to export onnx with below codes which are similiar with SAM
def export_onnx():
model = torch.jit.load('efficientsam_s_gpu.jit')
output = "efficientsam_s_gpu.onnx"
output_names = ["masks_predictions", "iou_predictions"]
dummy_inputs = {
"images": torch.randn((1, 3, 1024, 1024), dtype=torch.float),
"point_coords": torch.randint(low=0, high=1024, size=(1, 1, 5, 2), dtype=torch.float),
"point_labels": torch.randint(low=0, high=4, size=(1, 1, 5), dtype=torch.float)
}
dynamic_axes = {
# "images": {2: "img_height", 3: "img_width"},
"point_coords": {2: "num_points"},
"point_labels": {2: "num_points"},
}
opset = 14
with open(output, "wb") as f:
print(f"Exporting onnx model to {output}...")
torch.onnx.export(
model,
tuple(dummy_inputs.values()),
f,
export_params=True,
verbose=False,
opset_version=opset,
do_constant_folding=True,
input_names=list(dummy_inputs.keys()),
output_names=output_names,
dynamic_axes=dynamic_axes,
)
and i got error as below:
torch.onnx.symbolic_registry.UnsupportedOperatorError: Exporting the operator ::tile to ONNX opset version 14 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub.
from efficientsam.
@ArielleBF @ximitiejiang thanks for sharing the information. We will be trying to export one.
from efficientsam.
same question.
from efficientsam.
same question.
from efficientsam.
Same problem here trying to export 'efficientsam_ti_gpu.jit' to ONNX using PyTorch 2.0.1 and opset_version set to 18.
from efficientsam.
Same problem
from efficientsam.
Same problem
from efficientsam.
The problem originates from torch.tile here:
# Tile the image embedding for all queries.
image_embeddings_tiled = torch.tile(
image_embeddings[:, None, :, :, :], [1, max_num_queries, 1, 1, 1]
).view(
batch_size * max_num_queries,
image_embed_dim_c,
image_embed_dim_h,
image_embed_dim_w,
)
This could probably be solved by replacing torch.tile() with tensor.repeat() or using a symbolic for onnx to patch it
from efficientsam.
Related Issues (20)
- SqueezeSAM HOT 2
- CoreML HOT 2
- How to do Saliency segmentation? HOT 1
- Saliency Segment CODE WANTED HOT 3
- how to train our dataset?thanks for your answer HOT 2
- SAMI Module and Training Codes? HOT 4
- Segment Anything CPP Wrapper for macOS HOT 1
- Is there GPU support for box-prompted SAM? HOT 7
- why zero-shot instance segmentation on COCO dataset is bad HOT 1
- Is that possible using this as pretrained with LLaVa?> HOT 4
- What does input_labels mean? HOT 1
- multibox-prompt inference HOT 2
- EfficientSAM available on the Microscopy Imaging software Fiji HOT 1
- how to use background point HOT 1
- When there are multiple points as prompts (for example, more than five points), some point areas cannot be segmented. HOT 1
- pre-trained parameters
- pre-trained parameters
- Why is it slow to segment everything? Is there a good solution? HOT 1
- Is it possible to fine-tune it to extract single-category objects based only on mask prompt
- Wrong EfficientSAM model from Model_zoo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efficientsam.