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 test for deepsparse.yolov8.annotate #1620

Merged
merged 5 commits into from
Feb 26, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/test-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: "Clean sparsezoo directory"
run: rm -r sparsezoo/
- name: ⚙️ Install dependencies
run: pip install .[dev,server,image_classification,transformers,clip]
run: pip install .[dev,server,image_classification,yolov8,transformers,clip]
- name: Run base tests
run: make test
cli-smoke-tests:
Expand Down
44 changes: 44 additions & 0 deletions tests/deepsparse/pipelines/test_yolov8_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
from typing import Dict, List

import pytest
from tests.helpers import run_command


@pytest.mark.smoke
def test_yolov8_annotate(cleanup: Dict[str, List]):
sample_img_path = f"{os.path.dirname(__file__)}/sample_images/basilica.jpg"
cmd = [
"deepsparse.yolov8.annotate",
"--source",
sample_img_path,
"--model_filepath",
"zoo:yolov8-n-coco-base_quantized",
]
expected_output_path = "annotation-results/deepsparse-annotations/result-0.jpg"

cleanup["files"].append(expected_output_path)
print(f"\n==== test_yolov8_annotate command ====\n{' '.join(cmd)}")
res = run_command(cmd)
if res.stdout is not None:
print(f"\n==== test_yolov8_annotate output ====\n{res.stdout}")
assert res.returncode == 0
assert "error" not in res.stdout.lower()
assert "fail" not in res.stdout.lower()

# check output file exists
assert os.path.exists(expected_output_path)
Loading