Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 97401ef

Browse files
authored
Add test for deepsparse.yolov8.annotate (#1620)
* Add test for `deepsparse.yolov8.annotate` * Format * Update test-check.yaml * Format test
1 parent 3da9761 commit 97401ef

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

.github/workflows/test-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: "Clean sparsezoo directory"
4646
run: rm -r sparsezoo/
4747
- name: ⚙️ Install dependencies
48-
run: pip install .[dev,server,image_classification,transformers,clip]
48+
run: pip install .[dev,server,image_classification,yolov8,transformers,clip]
4949
- name: Run base tests
5050
run: make test
5151
cli-smoke-tests:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing,
10+
# software distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
from typing import Dict, List
17+
18+
import pytest
19+
from tests.helpers import run_command
20+
21+
22+
@pytest.mark.smoke
23+
def test_yolov8_annotate(cleanup: Dict[str, List]):
24+
sample_img_path = f"{os.path.dirname(__file__)}/sample_images/basilica.jpg"
25+
cmd = [
26+
"deepsparse.yolov8.annotate",
27+
"--source",
28+
sample_img_path,
29+
"--model_filepath",
30+
"zoo:yolov8-n-coco-base_quantized",
31+
]
32+
expected_output_path = "annotation-results/deepsparse-annotations/result-0.jpg"
33+
34+
cleanup["files"].append(expected_output_path)
35+
print(f"\n==== test_yolov8_annotate command ====\n{' '.join(cmd)}")
36+
res = run_command(cmd)
37+
if res.stdout is not None:
38+
print(f"\n==== test_yolov8_annotate output ====\n{res.stdout}")
39+
assert res.returncode == 0
40+
assert "error" not in res.stdout.lower()
41+
assert "fail" not in res.stdout.lower()
42+
43+
# check output file exists
44+
assert os.path.exists(expected_output_path)

0 commit comments

Comments
 (0)