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 otx micro benchmark #3762

Merged
merged 48 commits into from
Aug 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
e59098e
Add an entry for benchmark
sovrasov Jul 22, 2024
d5bb01e
Draft implementation
sovrasov Jul 24, 2024
aef4b6f
Merge remote-tracking branch 'origin/develop' into vs/micro_benchmark
sovrasov Jul 24, 2024
f9bd2b9
Update benchmark implementation
sovrasov Jul 24, 2024
e0eecc0
Cover cls models with benchmark
sovrasov Jul 24, 2024
8eda19c
Update becnhamark output
sovrasov Jul 24, 2024
abedae7
Merge remote-tracking branch 'origin/develop' into vs/micro_benchmark
sovrasov Jul 25, 2024
d6c0e24
Address comments
sovrasov Jul 26, 2024
d21d41d
Enable OV det model benchmark
sovrasov Jul 26, 2024
a2ec9b9
Update torch detection dummy input
sovrasov Jul 26, 2024
043d6f5
Add benchmarking for OV sseg models
sovrasov Jul 26, 2024
e67c8d5
Minor updates in benchmark
sovrasov Jul 26, 2024
9b228e7
Update segmentation and detection support
sovrasov Jul 26, 2024
d5fe882
Add flops counter failure processing
sovrasov Jul 26, 2024
f2b6d60
Cover instance segmentation
sovrasov Jul 26, 2024
6cda33e
Cover anomaly OV model
sovrasov Jul 27, 2024
dd09211
Cover action classification
sovrasov Jul 27, 2024
d4e4929
Cover VPT
sovrasov Jul 27, 2024
cfbb075
Make anomaly model forward runnable (but not functional)
sovrasov Jul 29, 2024
2cfc93f
Fix anomaly forward
sovrasov Jul 29, 2024
e798a67
Simplify OV dummy input
sovrasov Jul 29, 2024
a60e1f5
Add dummy input for VPT
sovrasov Jul 30, 2024
2e84c0f
Add a file output
sovrasov Jul 30, 2024
93f5884
Fix precommit
sovrasov Jul 30, 2024
4053be0
Merge remote-tracking branch 'origin/develop' into vs/micro_benchmark
sovrasov Jul 30, 2024
501a67e
Update changelog
sovrasov Jul 30, 2024
62e51f3
Del unused var
sovrasov Jul 30, 2024
1262642
Add benchmark tests
sovrasov Jul 30, 2024
64e7326
Merge remote-tracking branch 'origin/develop' into vs/micro_benchmark
sovrasov Jul 30, 2024
a0b47a3
Update ZSL
sovrasov Jul 30, 2024
0919312
Fix linters
sovrasov Jul 30, 2024
fc1b59f
Add init tests for benchmark
sovrasov Jul 31, 2024
97e522c
Improve unit test coverage
sovrasov Jul 31, 2024
04efb71
Cover VPT
sovrasov Jul 31, 2024
ae27278
Fix typos
sovrasov Jul 31, 2024
0e9175a
Update the engine docstring
sovrasov Jul 31, 2024
61e816d
Fix cls tests
sovrasov Jul 31, 2024
ced91c7
Merge branch 'vs/micro_benchmark' of https://github.com/sovrasov/open…
sovrasov Jul 31, 2024
66467f2
Merge remote-tracking branch 'origin/develop' into vs/micro_benchmark
sovrasov Jul 31, 2024
c4b83f8
Fix linter
sovrasov Jul 31, 2024
1e06129
Add todo to anomaly task
sovrasov Jul 31, 2024
f74f1b1
Update docs
sovrasov Jul 31, 2024
f4deeb6
Merge remote-tracking branch 'origin/develop' into vs/micro_benchmark
sovrasov Aug 1, 2024
3ebbad9
Fix missing image size error message
sovrasov Aug 1, 2024
69ed5fd
Fix linters
sovrasov Jul 31, 2024
9a1e800
Revert explicit type conversion
sovrasov Aug 1, 2024
1a56943
Update exporter error message and image size type
sovrasov Aug 1, 2024
fbec481
Merge remote-tracking branch 'origin/develop' into vs/micro_benchmark
sovrasov Aug 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add dummy input for VPT
  • Loading branch information
sovrasov committed Jul 30, 2024
commit a60e1f545bd727ba76aff306349993c14085d337
2 changes: 1 addition & 1 deletion src/otx/core/model/anomaly.py
Original file line number Diff line number Diff line change
@@ -401,4 +401,4 @@ def get_dummy_input(self, batch_size: int = 1) -> AnomalyModelInputs:
labels=[torch.LongTensor(0)],
boxes=torch.tensor(0),
masks=torch.tensor(0),
)
)
24 changes: 23 additions & 1 deletion src/otx/core/model/visual_prompting.py
Original file line number Diff line number Diff line change
@@ -255,6 +255,14 @@ def _set_label_info(self, _: LabelInfoTypes) -> None:
msg = f"Reconfiguring label_info has no effect on {self.__class__.__name__}."
log.warning(msg)

def get_dummy_input(self, batch_size: int = 1) -> VisualPromptingBatchDataEntity:
"""Returns a dummy input for VPT model"""
images = [torch.rand(3, self.model.image_size, self.model.image_size) for _ in range(batch_size)]
labels = [{"points": torch.LongTensor([0] * batch_size)}] * batch_size
prompts = [torch.zeros((1, 2))] * batch_size
return VisualPromptingBatchDataEntity(batch_size, images, imgs_info=[], labels=labels, points=prompts,
masks=[None]*batch_size, polygons=[None]*batch_size, bboxes=[None]*batch_size)


class OTXZeroShotVisualPromptingModel(
OTXModel[ZeroShotVisualPromptingBatchDataEntity, ZeroShotVisualPromptingBatchPredEntity],
@@ -421,6 +429,20 @@ def _set_label_info(self, _: LabelInfoTypes) -> None:
msg = f"Reconfiguring label_info has no effect on {self.__class__.__name__}."
log.warning(msg)

def get_dummy_input(self, batch_size: int = 1) -> ZeroShotVisualPromptingBatchDataEntity:
"""Returns a dummy input for ZSL VPT model"""
images = [torch.rand(3, self.model.image_size, self.model.image_size) for _ in range(batch_size)]
labels = [{"points": torch.LongTensor([0] * batch_size)}] * batch_size
prompts = [torch.zeros((1, 2))] * batch_size
infos = []
for i, img in enumerate(images):
infos.append(ImageInfo(
img_idx=i,
img_shape=img.shape,
ori_shape=img.shape,
))
return ZeroShotVisualPromptingBatchDataEntity(batch_size, images, imgs_info=infos, labels=labels, prompts=prompts, masks=[], polygons=[])


class OVVisualPromptingModel(
OVModel[
@@ -1340,4 +1362,4 @@ def get_dummy_input(self, batch_size: int = 1) -> ZeroShotVisualPromptingBatchDa
img_shape=img.shape,
ori_shape=img.shape,
))
return ZeroShotVisualPromptingBatchDataEntity(batch_size, images, imgs_info=infos, labels=labels, prompts=prompts, masks=[], polygons=[])
return ZeroShotVisualPromptingBatchDataEntity(batch_size, images, imgs_info=infos, labels=labels, prompts=prompts, masks=[], polygons=[])