|
| 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