-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update visual prompting on 1.x (#3038)
* Refine v1 perf benchmark to align with v2 (#3006) * Add --benchmark-type w/ accuracy|efficiency|all options * Add perf-benchmark tox env * Refine perf workflow to align with v2 * Add dummy perf tests for visual prompting * Fix weekly workflow --------- Signed-off-by: Songki Choi <songki.choi@intel.com> * Update docstring * Update overlapped region refinement * Update templates * Remove `PromptGetter` during ov inference * Fix tests * For unittest coverage --------- Co-authored-by: Songki Choi <songki.choi@intel.com>
- Loading branch information
1 parent
8c669aa
commit d1a27ab
Showing
28 changed files
with
680 additions
and
679 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
src/otx/algorithms/visual_prompting/configs/zero_shot_sam_vit_b/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"""Initialization of Configurable Parameters for SAM Visual Prompting Task.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from .configuration import VisualPromptingConfig # noqa: F401 |
81 changes: 81 additions & 0 deletions
81
src/otx/algorithms/visual_prompting/configs/zero_shot_sam_vit_b/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
dataset: | ||
task: visual_prompting | ||
train_batch_size: 1 | ||
val_batch_size: 1 | ||
test_batch_size: 1 | ||
num_workers: 4 | ||
image_size: 1024 # dimensions to which images are resized (mandatory) | ||
normalize: | ||
mean: | ||
- 123.675 | ||
- 116.28 | ||
- 103.53 | ||
std: | ||
- 58.395 | ||
- 57.12 | ||
- 57.375 | ||
offset_bbox: 0 | ||
use_point: false | ||
use_bbox: false | ||
|
||
model: | ||
name: SAM | ||
image_size: 1024 | ||
mask_threshold: 0. | ||
return_logits: true | ||
backbone: vit_b | ||
freeze_image_encoder: true | ||
freeze_prompt_encoder: true | ||
freeze_mask_decoder: true | ||
checkpoint: https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth | ||
# just for inference | ||
return_single_mask: false | ||
use_stability_score: false | ||
stability_score_offset: 1. | ||
return_extra_metrics: false | ||
# zero-shot | ||
default_threshold_reference: 0.3 | ||
default_threshold_target: 0.65 | ||
save_outputs: True | ||
|
||
# PL Trainer Args. Don't add extra parameter here. | ||
trainer: | ||
enable_checkpointing: false | ||
gradient_clip_val: 0 | ||
gradient_clip_algorithm: norm | ||
num_nodes: 1 | ||
devices: 1 | ||
enable_progress_bar: true | ||
overfit_batches: 0.0 | ||
track_grad_norm: -1 | ||
check_val_every_n_epoch: 1 # Don't validate before extracting features. | ||
fast_dev_run: false | ||
accumulate_grad_batches: 1 | ||
max_epochs: 1 | ||
min_epochs: null | ||
max_steps: -1 | ||
min_steps: null | ||
max_time: null | ||
limit_train_batches: 1.0 | ||
limit_val_batches: 0 # No validation | ||
limit_test_batches: 1.0 | ||
limit_predict_batches: 1.0 | ||
val_check_interval: 1.0 | ||
log_every_n_steps: 10 | ||
accelerator: auto # <"cpu", "gpu", "tpu", "ipu", "hpu", "auto"> | ||
strategy: null | ||
sync_batchnorm: false | ||
precision: 32 | ||
enable_model_summary: true | ||
num_sanity_val_steps: 0 | ||
profiler: null | ||
benchmark: false | ||
deterministic: false | ||
reload_dataloaders_every_n_epochs: 0 | ||
auto_lr_find: false | ||
replace_sampler_ddp: true | ||
detect_anomaly: false | ||
auto_scale_batch_size: false | ||
plugins: null | ||
move_metrics_to_cpu: false | ||
multiple_trainloader_mode: max_size_cycle |
14 changes: 14 additions & 0 deletions
14
src/otx/algorithms/visual_prompting/configs/zero_shot_sam_vit_b/configuration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""Configuration file of OTX Visual Prompting.""" | ||
|
||
# Copyright (C) 2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
from attr import attrs | ||
|
||
from otx.algorithms.visual_prompting.configs.base import VisualPromptingBaseConfig | ||
|
||
|
||
@attrs | ||
class VisualPromptingConfig(VisualPromptingBaseConfig): | ||
"""Configurable parameters for Visual Prompting task.""" |
Oops, something went wrong.