Skip to content

Add benchmark script for segment anything v2 #22169

Merged
tianleiwu merged 1 commit intomainfrom
tlwu/sam2_benchmark
Sep 21, 2024
Merged

Add benchmark script for segment anything v2 #22169
tianleiwu merged 1 commit intomainfrom
tlwu/sam2_benchmark

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

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

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

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

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

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

Variable _low_res_masks is not used.
@tianleiwu tianleiwu merged commit 171b901 into main Sep 21, 2024
@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