Skip to content

Commit

Permalink
Add test for deepsparse.yolov8.annotate (#1620)
Browse files Browse the repository at this point in the history
* Add test for `deepsparse.yolov8.annotate`

* Format

* Update test-check.yaml

* Format test
  • Loading branch information
mgoin authored Feb 26, 2024
1 parent 3da9761 commit 97401ef
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
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)

0 comments on commit 97401ef

Please sign in to comment.