Skip to content
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

Add benchmark script for segment anything v2 #22169

Merged
merged 1 commit into from
Sep 21, 2024
Merged

Conversation

tianleiwu
Copy link
Contributor

@tianleiwu tianleiwu commented Sep 20, 2024

Description

Add benchmark script segment anything v2.
It depends on #22119 for onnx export, and #22167 for sam2 graph fusion.

Motivation and Context

Benchmark SAM2 model performance.

print(f"Start {config.repeats} runs of performance tests...")
start = time.time()
for _ in range(config.repeats):
_image_features_0, _image_features_1, _image_embeddings = sam2_encoder(img)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable _image_features_0 is not used.
print(f"Start {config.repeats} runs of performance tests...")
start = time.time()
for _ in range(config.repeats):
_image_features_0, _image_features_1, _image_embeddings = sam2_encoder(img)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable _image_features_1 is not used.
print(f"Start {config.repeats} runs of performance tests...")
start = time.time()
for _ in range(config.repeats):
_image_features_0, _image_features_1, _image_embeddings = sam2_encoder(img)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable _image_embeddings is not used.
print(f"Start {config.repeats} runs of performance tests...")
start = time.time()
for _ in range(config.repeats):
_masks, _iou_predictions, _low_res_masks = sam2_decoder(*torch_inputs)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable _masks is not used.
print(f"Start {config.repeats} runs of performance tests...")
start = time.time()
for _ in range(config.repeats):
_masks, _iou_predictions, _low_res_masks = sam2_decoder(*torch_inputs)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable _iou_predictions is not used.
print(f"Start {config.repeats} runs of performance tests...")
start = time.time()
for _ in range(config.repeats):
_masks, _iou_predictions, _low_res_masks = sam2_decoder(*torch_inputs)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable _low_res_masks is not used.
@tianleiwu tianleiwu merged commit 171b901 into main Sep 21, 2024
86 of 87 checks passed
@tianleiwu tianleiwu deleted the tlwu/sam2_benchmark branch September 21, 2024 04:32
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

Successfully merging this pull request may close these issues.

2 participants