def test_unsupported_device_in_create_onnx_launcher_raises_config_error_exception(self):
        config = {
            'framework': 'paddle_paddle', 'model': 'model.pdmodel', 'params': 'params.pdiparams',
            'device': 'UNSUPPORTED'}

        with pytest.raises(ConfigError):
            create_launcher(config)
 def test_dlsdk_launcher(self):
     launcher = {
         'framework': 'dlsdk',
         'model': 'custom',
         'weights': 'custom',
         'adapter': 'ssd',
         'device': 'cpu'
     }
     create_launcher(launcher, model_name='custom')
Пример #3
0
def test_missed_model_in_create_caffe_launcher_raises_config_error_exception():
    launcher = {
        'framework': 'caffe',
        'weights': 'custom',
        'adapter': 'classification'
    }

    with pytest.raises(ConfigError):
        create_launcher(launcher)
    def test_missed_adapter_in_create_dlsdk_launcher_raises_config_error_exception(
            self):
        launcher_config = {
            'framework': 'dlsdk',
            'model': 'custom',
            'weights': 'custom'
        }

        with pytest.raises(ConfigError):
            create_launcher(launcher_config)
    def test_unsupported_device_in_create_onnx_launcher_raises_config_error_exception(
            self):
        config = {
            'framework': 'onnx_runtime',
            'model': 'model.onnx',
            'device': 'UNSUPPORTED'
        }

        with pytest.raises(ConfigError):
            create_launcher(config)
    def test_missed_model_in_create_dlsdk_launcher_raises_config_error_exception(
            self):
        config = {
            'framework': 'dlsdk',
            'weights': 'custom',
            'adapter': 'classification',
            'device': 'cpu'
        }

        with pytest.raises(ConfigError):
            create_launcher(config)
Пример #7
0
 def test_missed_device_in_create_gapi_launcher_raises_config_error_exception(self):
     config = {
         'framework': 'g-api',
         'model': 'model.xml',
         'weights': 'weights.bin',
         # 'device': 'not_device',
         'adapter': 'classification',
         'inputs': [{'name': 'data', 'type': 'INPUT'}],
         'outputs': ['out']
     }
     with pytest.raises(ConfigError):
         create_launcher(config)
 def test_missed_model_in_create_opencv_launcher_raises_config_error_exception(self):
     config = {
         'framework': 'opencv',
         # 'model': 'model.ocv',
         'weights': 'weights.ocv',
         'device': 'not_device',
         'backend': 'not_backend',
         'adapter': 'classification',
         'inputs': [{'name': 'data', 'type': 'INPUT'}]
     }
     with pytest.raises(ConfigError):
         create_launcher(config, 'model')
    def test_dlsdk_launcher_model_no_image_inputs_raise_value_error(self):
        launcher_config = {
            'framework': 'dlsdk',
            'model': 'custom',
            'weights': 'custom',
            'adapter': {
                'key': 'val'
            }
        }

        with pytest.raises(ValueError):
            create_launcher(launcher_config)
Пример #10
0
    def test_missed_shape_in_inputs_in_create_mxnet_launcher_raises_config_error_exception(
            self):
        config = {
            'framework': 'mxnet',
            'model': 'model-0000.params',
            'inputs': [{
                'name': 'data',
                'type': 'INPUT'
            }]
        }

        with pytest.raises(ConfigError):
            create_launcher(config)
    def test_undefined_type_in_dir_adapter_in_create_dlsdk_launcher_raises_config_error_exception(
            self):
        launcher_config = {
            'framework': 'dlsdk',
            'model': 'custom',
            'weights': 'custom',
            'adapter': {
                'type': 'undefined'
            }
        }

        with pytest.raises(ConfigError):
            create_launcher(launcher_config)
 def test_auto_model_search(self, models_dir):
     config = {
         "framework": "onnx_runtime",
         "model": models_dir,
     }
     launcher = create_launcher(config, 'samplenet')
     assert launcher.model == models_dir / "samplenet.onnx"
def get_pdpd_test_model(models_dir):
    config = {
        "framework": "paddle_paddle",
        "model": str(models_dir / "samplenet.pdmodel"),
        'params': str(models_dir / 'samplenet.pdiparams'),
        "adapter": "classification",
    }
    return create_launcher(config)
def get_opencv_test_onnx_model(models_dir):
    config = {
        "framework": "opencv",
        "model": str(models_dir / "samplenet.onnx"),
        "adapter": "classification",
        "device": "cpu",
        "backend": "ocv",
        "inputs": [{"name": "input", "type": "INPUT", "shape": "(3, 32, 32)"}]
    }
    return create_launcher(config)
Пример #15
0
def get_caffe_test_model(models_dir):
    config = {
        "framework": "caffe",
        "weights": str(models_dir / "SampLeNet.caffemodel"),
        "model": str(models_dir / "SampLeNet.prototxt"),
        "adapter": 'classification',
        "device": "cpu"
    }

    return create_launcher(config)
    def test_dlsdk_launcher_model_with_several_image_inputs_raise_value_error(
            self, mocker):
        launcher_config = {
            'framework': 'dlsdk',
            'model': 'custom',
            'weights': 'custom',
            'adapter': {
                'key': 'val'
            }
        }

        with pytest.raises(ValueError):
            mocker.patch(
                'openvino.tools.accuracy_checker.launcher.dlsdk_launcher.DLSDKLauncher.inputs',
                new_callable=PropertyMock(return_value={
                    'data1': [3, 227, 227],
                    'data2': [3, 227, 227]
                }))
            create_launcher(launcher_config)
Пример #17
0
def get_gapi_test_model(models_dir):
    config = {
        "framework": "g-api",
        #"weights": str(models_dir / "SampLeNet.bin"),
        "model": models_dir,
        "adapter": "classification",
        "device": "cpu",
        "inputs": [{"name": "data", "type": "INPUT", "shape": "(3, 32, 32)"}],
        'outputs': ['fc3']
    }
    return create_launcher(config)
Пример #18
0
def get_pth_test_model(models_dir):
    config = {
        "framework": 'pytorch',
        "module": 'samplenet.SampLeNet',
        "checkpoint": models_dir/'pytorch_model'/'samplenet.pth',
        'python_path': models_dir/'pytorch_model',
        "adapter": 'classification',
        "device": 'cpu',
    }

    return create_launcher(config)
def get_opencv_test_caffe_model(models_dir):
    config = {
        "framework": "opencv",
        "weights": str(models_dir / "SampLeNet.caffemodel"),
        "model": str(models_dir / "SampLeNet.prototxt"),
        "adapter": "classification",
        "device": "cpu",
        "backend": "ocv",
        "inputs": [{"name": "input", "type": "INPUT", "shape": "(3, 32, 32)"}]
    }
    return create_launcher(config)
def get_onnx_test_model(model_dir, config_update=None):
    config = {
        'framework': 'dlsdk',
        'model': str(model_dir / 'samplenet.onnx'),
        'device': 'CPU',
        'adapter': 'classification'
    }
    if config_update:
        config.update(config_update)

    return create_launcher(config)
def get_tf2_test_model(models_dir, config_update=None):
    config = {
        "framework": "tf2",
        "saved_model_dir": str(models_dir / "samplenet_tf2"),
        "adapter": 'classification',
        "device": "cpu"
    }
    if config_update:
        config.update(config_update)

    return create_launcher(config)
def get_dlsdk_test_blob(models_dir, config_update=None):
    config = {
        'framework': 'dlsdk',
        'model': str(models_dir / 'SampLeNet.blob'),
        'device': 'MYRIAD',
        'adapter': 'classification',
    }
    if config_update:
        config.update(config_update)

    return create_launcher(config)
Пример #23
0
 def test_caffe_launcher_model_search(self, models_dir):
     config = {
         "framework": "caffe",
         "weights": models_dir,
         "model": models_dir,
         "adapter": 'classification',
         "device": "cpu"
     }
     caffe_model = create_launcher(config, 'SampleNet')
     assert caffe_model.model == models_dir / 'SampLeNet.prototxt'
     assert caffe_model.weights == models_dir / 'SampLeNet.caffemodel'
def get_onnx_test_model(models_dir, device=None, ep=None):
    config = {
        "framework": "onnx_runtime",
        "model": str(models_dir / "samplenet.onnx"),
        "adapter": "classification",
    }
    if device is not None:
        config['device'] = device
    if ep is not None:
        config['execution_providers'] = ep
    return create_launcher(config)
def get_mx_test_model(models_dir, config_override=None):
    config = {
        "framework": 'mxnet',
        "model": models_dir / 'samplenet-0000.params',
        "adapter": 'classification',
        "device": 'cpu',
        'inputs': [{'name': 'data', 'type': 'INPUT', 'shape': '3,32,32'}]
    }
    if config_override:
        config.update(config_override)

    return create_launcher(config)
def get_dlsdk_test_model(models_dir, config_update=None):
    config = {
        'framework': 'dlsdk',
        'weights': str(models_dir / 'SampLeNet.bin'),
        'model': str(models_dir / 'SampLeNet.xml'),
        'device': 'CPU',
        'adapter': 'classification',
    }
    if config_update:
        config.update(config_update)

    return create_launcher(config, model_name='SampLeNet')
    def test_missed_model_in_create_pdpd_launcher_raises_config_error_exception(self):
        config = {'framework': 'paddle_paddle'}

        with pytest.raises(ConfigError):
            create_launcher(config)
    def test_missed_inputs_in_create_mxnet_launcher_raises_config_error_exception(self):
        config = {'framework': 'mxnet', 'model': 'model-0000.params'}

        with pytest.raises(ConfigError):
            create_launcher(config)
    def test_unknown_device_in_tf2_launcher_config_raises_config_error_exception(self):
        launcher = {'framework': 'tf2', 'adapter': 'classification', 'saved_model_dir': 'custom', 'device': 'unknown'}

        with pytest.raises(ConfigError):
            create_launcher(launcher)
    def test_missed_model_in_tf_launcher_config_raises_config_error_exception(self):
        launcher = {'framework': 'tf', 'adapter': 'classification'}

        with pytest.raises(ConfigError):
            create_launcher(launcher)