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

Addig gif metrics cards to sandbox #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions systems/hello_world/metrics/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ LABEL description="Demo metrics build docker image"

COPY metrics.py /metrics.py
COPY requirements_lock.txt /requirements_lock.txt
COPY data /data/
RUN pip install --no-cache-dir -r /requirements_lock.txt

CMD [ "python", "/metrics.py" ]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions systems/hello_world/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import numpy as np
import typing
import shutil
import sys
from pathlib import Path
from dataclasses import dataclass
Expand All @@ -10,6 +11,7 @@
from resim.metrics.python.metrics_writer import ResimMetricsWriter

from resim.metrics.python.metrics import (
ExternalFileMetricsData,
Timestamp,
DoubleFailureDefinition,
SeriesMetricsData,
Expand Down Expand Up @@ -284,6 +286,22 @@ def states_over_time_metric_demo(writer):
.with_importance(MetricImportance.HIGH_IMPORTANCE)
)

def gif_metric_demo(writer):
shutil.copy("/data/detection_clip_01.gif", "/tmp/resim/outputs/detection_clip_01.gif")

METRIC_DATA = ExternalFileMetricsData(name="Clip", filename="detection_clip_01.gif")
(
writer
.add_image_metric("Clip of interest")
.with_description("A clip of intersection negotiation.")
.with_blocking(False)
.with_should_display(True)
.with_status(MetricStatus.PASSED_METRIC_STATUS)
.with_importance(MetricImportance.HIGH_IMPORTANCE)
.with_image_data(METRIC_DATA)
)



def write_proto(writer):
metrics_proto = writer.write()
Expand All @@ -310,6 +328,7 @@ def main():
experience = load_experience()

metrics_writer = ResimMetricsWriter(uuid.uuid4()) # Make metrics writer!
gif_metric_demo(metrics_writer)
double_summary_metric_demo(metrics_writer, experience, log)
double_over_time_metric_demo(metrics_writer, experience, log)
scalar_metric_demo(metrics_writer, experience, log)
Expand Down
4 changes: 2 additions & 2 deletions systems/hello_world/metrics/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy==1.26.4
pandas==2.2.2
https://github.com/resim-ai/open-core/releases/download/v0.0.10/resim_metrics-0.0.10-py3-none-manylinux2014_x86_64.whl
https://github.com/resim-ai/open-core/releases/download/v0.0.10/resim_metrics_schema-0.0.10-py3-none-any.whl
https://github.com/resim-ai/open-core/releases/download/v0.0.12/resim_metrics-0.0.12-py3-none-manylinux2014_x86_64.whl
https://github.com/resim-ai/open-core/releases/download/v0.0.12/resim_metrics_schema-0.0.12-py3-none-any.whl
4 changes: 2 additions & 2 deletions systems/hello_world/metrics/requirements_lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ python-dateutil==2.9.0.post0
# via pandas
pytz==2024.1
# via pandas
resim-metrics @ https://github.com/resim-ai/open-core/releases/download/v0.0.10/resim_metrics-0.0.10-py3-none-manylinux2014_x86_64.whl
resim-metrics @ https://github.com/resim-ai/open-core/releases/download/v0.0.12/resim_metrics-0.0.12-py3-none-manylinux2014_x86_64.whl
# via -r requirements.txt
resim-metrics-schema @ https://github.com/resim-ai/open-core/releases/download/v0.0.10/resim_metrics_schema-0.0.10-py3-none-any.whl
resim-metrics-schema @ https://github.com/resim-ai/open-core/releases/download/v0.0.12/resim_metrics_schema-0.0.12-py3-none-any.whl
# via -r requirements.txt
six==1.16.0
# via python-dateutil
Expand Down