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

Synthetic Semantic Segmentation Benchmark #820

Merged
merged 36 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c3bb2dd
wip - found semseg bug
czaloom Nov 4, 2024
9a00cfa
fixed bug
czaloom Nov 4, 2024
7c9dfb5
Merge branch 'czaloom-bug-lite-semseg-814' into czaloom-synthetic-ben…
czaloom Nov 4, 2024
24af843
add background as option to generate
czaloom Nov 4, 2024
09e77d4
Merge branch 'main' into czaloom-synthetic-benchmarking
czaloom Nov 5, 2024
21101ec
adding synthetic benchmarks
czaloom Nov 7, 2024
609dfaf
found bug in obj det iou computation
czaloom Nov 8, 2024
0f5602e
fixed iou computation in object detection
czaloom Nov 8, 2024
d89638b
merging in bugfix
czaloom Nov 8, 2024
3f4ddb0
wip
czaloom Nov 8, 2024
15bd4f3
suggested change
czaloom Nov 8, 2024
579314f
Merge branch 'czaloom-objdet-iou-bugfix' into czaloom-synthetic-bench…
czaloom Nov 8, 2024
4914664
added notebook
czaloom Nov 12, 2024
566fe29
added new benchmark workflow
czaloom Nov 12, 2024
e476008
remove intentional fail
czaloom Nov 12, 2024
f442d05
Merge branch 'main' into czaloom-synthetic-semseg-bench
czaloom Nov 12, 2024
0334391
renamed api-client tests to valor service tests
czaloom Nov 12, 2024
22785fc
renamed api-client tests to valor service tests
czaloom Nov 12, 2024
af47d9c
precommit
czaloom Nov 12, 2024
00aeaa7
weird bitnami bug
czaloom Nov 12, 2024
2e505e8
weird bitnami bug
czaloom Nov 12, 2024
7824270
weird bitnami stuff
czaloom Nov 12, 2024
e5945f1
docstring
czaloom Nov 12, 2024
d7cdc1e
more bitnami stuff
czaloom Nov 12, 2024
0890f3c
remove bitnami fix
czaloom Nov 12, 2024
79ab34e
Merge branch 'main' into czaloom-synthetic-semseg-bench
czaloom Nov 12, 2024
2b497b8
remove obj det example from notebook
czaloom Nov 12, 2024
8d19d2e
remove make stop-env from lite benchmarks
czaloom Nov 13, 2024
f201e3d
intermediate compuation 10x speedup
czaloom Nov 13, 2024
e44484c
bugfix
czaloom Nov 13, 2024
4d8ff83
revert computation improvement as its handled in a separate commit
czaloom Nov 13, 2024
5108d94
moved generate function
czaloom Nov 13, 2024
c974f41
Merge remote-tracking branch 'origin/main' into czaloom-synthetic-sem…
czaloom Nov 13, 2024
829a44b
added generator test
czaloom Nov 13, 2024
5251970
adjusted benchmark
czaloom Nov 13, 2024
9bc5217
expanded on test
czaloom Nov 13, 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
25 changes: 25 additions & 0 deletions .github/workflows/lite-synthetic-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "[valor-lite] synthetic benchmarks"

on:
push:
branches: "**"

permissions:
id-token: write
contents: read

jobs:
run-benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: install lite
run: pip install -e .
working-directory: ./lite
- name: benchmark semantic segmentation
run: python benchmark_semantic_segmentation.py
working-directory: ./lite/benchmarks/synthetic/
- run: make stop-env
czaloom marked this conversation as resolved.
Show resolved Hide resolved
94 changes: 94 additions & 0 deletions lite/benchmarks/synthetic/benchmark_semantic_segmentation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
from valor_lite.profiling import Benchmark, BenchmarkError
from valor_lite.semantic_segmentation.benchmark import (
benchmark_add_data,
benchmark_evaluate,
benchmark_finalize,
)


def benchmark(
bitmask_shape: tuple[int, int],
number_of_unique_labels: int,
number_of_images: int,
*_,
memory_limit: float = 4.0,
time_limit: float = 10.0,
repeat: int = 1,
verbose: bool = False,
):
"""
Runs a single benchmark.

Parameters
----------
bitmask_shape : tuple[int, int]
The size (h, w) of the bitmask array.
number_of_unique_labels : int
The number of unique labels used in the synthetic example.
number_of_images : int
The number of distinct datums that are created.
memory_limit : float
The maximum amount of system memory allowed in gigabytes (GB).
time_limit : float
The maximum amount of time permitted before killing the benchmark.
repeat : int
The number of times to run a benchmark to produce an average runtime.
verbose : bool, default=False
Toggles terminal output of benchmark results.
"""

b = Benchmark(
time_limit=time_limit,
memory_limit=int(memory_limit * (1024**3)),
repeat=repeat,
verbose=verbose,
)

_, failed, details = b.run(
benchmark=benchmark_add_data,
n_labels=[number_of_unique_labels],
shape=[bitmask_shape],
)
if failed:
raise BenchmarkError(
benchmark=details["benchmark"],
error_type=failed[0]["error"],
error_message=failed[0]["msg"],
)

_, failed, details = b.run(
benchmark=benchmark_finalize,
n_datums=[number_of_images],
n_labels=[number_of_unique_labels],
)
if failed:
raise BenchmarkError(
benchmark=details["benchmark"],
error_type=failed[0]["error"],
error_message=failed[0]["msg"],
)

_, failed, details = b.run(
benchmark=benchmark_evaluate,
n_datums=[number_of_images],
n_labels=[number_of_unique_labels],
)
if failed:
raise BenchmarkError(
benchmark=details["benchmark"],
error_type=failed[0]["error"],
error_message=failed[0]["msg"],
)


if __name__ == "__main__":

benchmark(
bitmask_shape=(4000, 4000),
number_of_images=10,
number_of_unique_labels=10,
memory_limit=4.0,
time_limit=10.0,
repeat=1,
verbose=True,
)
Loading
Loading