Comments (7)
It seems that efficientSAM provided only works on CPU, I tried to use cuda() to move model and data to GPU , but it doesn't help a lot.
Also tried the seg-everything to cuda method in pull requests, doesn't help a lot as well.
Maybe the box-promted SAM needs a function like " predictor.set_image() " in SAM and Mobile-SAM to save time used in a same image.
I have found that GPU can effectively accelerate, with approximately 30-40ms per image on 3090ti. The problem is that the speed will be slower when running the first inference, I'm not sure why
from efficientsam.
@silinsi, it should very fast to run EfficientSAM on GPU. Can you share more information?
from efficientsam.
@liutongkun, for the first inference, loading the model to GPU and moving the data to GPU may take time. Can you share the latency for the first inference?
from efficientsam.
@liutongkun, for the first inference, loading the model to GPU and moving the data to GPU may take time. Can you share the latency for the first inference?
Thanks for your reply. I put the data and model to GPU before starting the timing, here are my codes based on EfficientSAM_example.py
for i in range(10):
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = model.to(device)
a = sample_image_tensor[None, ...]
a = a.to(device)
input_points = input_points.to(device)
input_labels = input_labels.to(device)
t1 = time.time()
print('Running inference using ', model_name)
predicted_logits, predicted_iou = model(
a,
input_points,
input_labels,
)
t2 = time.time()
print(f'timecost{t2-t1}')
and it shows:
Running inference using efficientsam_ti
timecost0.5455219745635986
Running inference using efficientsam_ti
timecost0.035993099212646484
Running inference using efficientsam_ti
timecost0.03607749938964844
Running inference using efficientsam_ti
timecost0.03591561317443848
Running inference using efficientsam_ti
timecost0.0360107421875
......
from efficientsam.
@liutongkun, can you move the model/data before the loop?
from efficientsam.
@liutongkun, can you move the model/data before the loop?
I modify the code to:
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = models['efficientsam_ti'].to(device)
a = sample_image_tensor[None, ...]
a = a.to(device)
input_points = input_points.to(device)
input_labels = input_labels.to(device)
for i in range(10):
t1 = time.time()
print('Running inference u sing ', 'efficientsam_ti')
predicted_logits, predicted_iou = model(
a,
input_points,
input_labels,
)
t2 = time.time()
print(f'timecost{t2-t1}')
and it shows:
Running inference u sing efficientsam_ti
timecost0.56357741355896
Running inference u sing efficientsam_ti
timecost0.035813331604003906
Running inference u sing efficientsam_ti
timecost0.035944223403930664
Running inference u sing efficientsam_ti
timecost0.03553032875061035
Running inference u sing efficientsam_ti
timecost0.03602123260498047
......
from efficientsam.
@liutongkun, for the first inference, loading the model to GPU and moving the data to GPU may take time. Can you share the latency for the first inference?
Thanks for your reply. I put the data and model to GPU before starting the timing, here are my codes based on EfficientSAM_example.py
for i in range(10): device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') model = model.to(device) a = sample_image_tensor[None, ...] a = a.to(device) input_points = input_points.to(device) input_labels = input_labels.to(device) t1 = time.time() print('Running inference using ', model_name) predicted_logits, predicted_iou = model( a, input_points, input_labels, ) t2 = time.time() print(f'timecost{t2-t1}')
and it shows: Running inference using efficientsam_ti timecost0.5455219745635986 Running inference using efficientsam_ti timecost0.035993099212646484 Running inference using efficientsam_ti timecost0.03607749938964844 Running inference using efficientsam_ti timecost0.03591561317443848 Running inference using efficientsam_ti timecost0.0360107421875 ......
Thanks, it is useful
from efficientsam.
Related Issues (20)
- 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
- 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
- pre-training code and fine-tuning code
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.