Esempio n. 1
0
debug = not args.no_debug
camera = not args.video

if args.camera and args.video:
    raise ValueError(
        'Incorrect command line parameters! "-cam" cannot be used with "-vid"!'
    )
elif args.camera is False and args.video is None:
    raise ValueError(
        'Missing inference source! Either use "-cam" to run on DepthAI camera or "-vid <path>" to run on video file'
    )

parentDir = Path(__file__).parent
shaves = 6 if args.camera else 8
blobconverter.set_defaults(output_dir=parentDir / Path("models"))


def timer(function):
    """
    Decorator function timer
    :param function:The function you want to time
    :return:
    """
    def wrapper(*args, **kwargs):
        time_start = time.time()
        res = function(*args, **kwargs)
        cost_time = time.time() - time_start
        print("【 %s 】operation hours:【 %s 】second" %
              (function.__name__, cost_time))
        return res
Esempio n. 2
0
# coding=utf-8
import time
from pathlib import Path

import blobconverter
import click
import cv2
import depthai as dai
import numpy as np
from depthai_sdk import getDeviceInfo, FPSHandler, toTensorResult
from loguru import logger

from utils import run_nn, get_mini_box_frame, drawText

blobconverter.set_defaults(output_dir=Path(__file__).parent / Path("models"),
                           optimizer_params=None)

preview_size = (1080, 1080)


def create_pipeline(video):
    pipeline = dai.Pipeline()
    # pipeline.setOpenVINOVersion(dai.OpenVINO.VERSION_2021_4)

    mesh = pipeline.create(dai.node.NeuralNetwork)
    mesh.setBlobPath("models/face_landmark_openvino_2021.4_6shave.blob")
    mesh.setNumInferenceThreads(2)
    mesh.input.setBlocking(False)
    mesh.input.setQueueSize(2)

    if video:
Esempio n. 3
0
    'Artifactory password, can be also set using env variable ARTIFACTORY_PASSWORD',
    default=os.getenv('ARTIFACTORY_PASSWORD'))
parser.add_argument(
    '-url',
    '--blobconverter-url',
    type=str,
    help="URL to custom BlobConverter URL to be used for conversion",
    required=False)
args = parser.parse_args()

if None in (args.username, args.password):
    parser.print_help()
    sys.exit(1)

if args.blobconverter_url is not None:
    blobconverter.set_defaults(url=args.blobconverter_url)

path = ArtifactoryPath(
    "https://artifacts.luxonis.com/artifactory/blobconverter-backup/blobs",
    auth=(args.username, args.password))
if not path.exists():
    path.mkdir()

priority_models = [
    "mobilenet-ssd", "efficientnet-b0",
    "vehicle-license-plate-detection-barrier-0106",
    "vehicle-detection-adas-0002", "license-plate-recognition-barrier-0007"
    "vehicle-attributes-recognition-barrier-0039",
    "face-detection-retail-0004", "landmarks-regression-retail-0009"
]
backup_shaves = range(1, 17)