Skip to content

Commit

Permalink
test inf speed
Browse files Browse the repository at this point in the history
  • Loading branch information
almazgimaev committed Sep 4, 2024
1 parent b761b15 commit 9e6ae2f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
git+https://github.com/supervisely/supervisely.git@model-benchmark-inf-speed
# supervisely[model-benchmark]==6.73.175
29 changes: 16 additions & 13 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from typing import Optional

import src.functions as f
import src.globals as g
import src.workflow as w
import supervisely as sly
import supervisely.app.widgets as widgets
from supervisely.nn.benchmark import (
Expand All @@ -8,10 +11,6 @@
)
from supervisely.nn.inference.session import SessionJSON

import src.functions as f
import src.globals as g
import src.workflow as w


def main_func():
api = g.api
Expand Down Expand Up @@ -49,30 +48,34 @@ def main_func():
)
sly.logger.info(f"{g.session_id = }")
bm.run_evaluation(model_session=g.session_id)
bm.run_speedtest(
g.session_id,
g.project_id,
)
bm.visualize()

task_info = api.task.get_info_by_id(g.session_id)
task_dir = f"{g.session_id}_{task_info['meta']['app']['name']}"

eval_res_dir = f"/model-benchmark/evaluation/{project.id}_{project.name}/{task_dir}/"
eval_res_dir = api.storage.get_free_dir_name(g.team_id, eval_res_dir)
res_dir = f"/model-benchmark/{project.id}_{project.name}/{task_dir}/"
res_dir = api.storage.get_free_dir_name(g.team_id, res_dir)

bm.upload_eval_results(eval_res_dir)

bm.visualize()
remote_dir = bm.upload_visualizations(eval_res_dir + "/visualizations/")
bm.upload_eval_results(res_dir + "/evaluation/")
bm.upload_speedtest_results(res_dir + "/speedtest/")
remote_dir = bm.upload_visualizations(res_dir + "/visualizations/")

report = bm.upload_report_link(remote_dir)
api.task.set_output_report(g.task_id, report.id, report.name)

template_vis_file = api.file.get_info_by_path(
sly.env.team_id(), eval_res_dir + "/visualizations/template.vue"
sly.env.team_id(), res_dir + "/visualizations/template.vue"
)
report_model_benchmark.set(template_vis_file)
report_model_benchmark.show()
pbar.hide()

# ==================== Workflow output ====================
w.workflow_output(api, eval_res_dir, template_vis_file)
w.workflow_output(api, res_dir, template_vis_file)
# =======================================================

sly.logger.info(
Expand Down Expand Up @@ -186,4 +189,4 @@ def start_evaluation():
start_evaluation()

if g.project_id and g.session_id:
handle_selectors(True)
handle_selectors(True)

0 comments on commit 9e6ae2f

Please sign in to comment.