# Copyright (C) 2019 Intel Corporation # # SPDX-License-Identifier: MIT from datumaro.components.config import Config, \ DefaultConfig as _DefaultConfig, \ SchemaBuilder as _SchemaBuilder SOURCE_SCHEMA = _SchemaBuilder() \ .add('url', str) \ .add('format', str) \ .add('options', dict) \ .build() class Source(Config): def __init__(self, config=None): super().__init__(config, schema=SOURCE_SCHEMA) MODEL_SCHEMA = _SchemaBuilder() \ .add('launcher', str) \ .add('model_dir', str, internal=True) \ .add('options', dict) \ .build() class Model(Config): def __init__(self, config=None): super().__init__(config, schema=MODEL_SCHEMA)
import os, os.path as osp import requests from datumaro.components.config import ( Config, SchemaBuilder as _SchemaBuilder, ) import datumaro.components.extractor as datumaro from datumaro.util.image import lazy_image, load_image, Image from cvat.utils.cli.core import CLI as CVAT_CLI, CVAT_API_V1 CONFIG_SCHEMA = _SchemaBuilder() \ .add('task_id', int) \ .add('server_host', str) \ .add('server_port', int) \ .build() DEFAULT_CONFIG = Config({'server_port': 80}, schema=CONFIG_SCHEMA, mutable=False) class cvat_rest_api_task_images(datumaro.SourceExtractor): def _image_local_path(self, item_id): task_id = self._config.task_id return osp.join( self._cache_dir, 'task_{}_frame_{:06d}.jpg'.format(task_id, int(item_id)))
# Copyright (C) 2019-2021 Intel Corporation # # SPDX-License-Identifier: MIT from datumaro.components.config import Config from datumaro.components.config import DictConfig as _DictConfig from datumaro.components.config import SchemaBuilder as _SchemaBuilder from datumaro.util import find SOURCE_SCHEMA = _SchemaBuilder() \ .add('url', str) \ .add('path', str) \ .add('format', str) \ .add('options', dict) \ .add('hash', str) \ .build() class Source(Config): def __init__(self, config=None): super().__init__(config, schema=SOURCE_SCHEMA) @property def is_generated(self) -> bool: return not self.url MODEL_SCHEMA = _SchemaBuilder() \ .add('launcher', str) \ .add('options', dict) \ .build()