コード例 #1
0
    def test_ignore_subset_parameters_if_file_provided(self, mocker):
        mocker.patch('pathlib.Path.exists', return_value=True)
        mocker.patch('openvino.tools.accuracy_checker.utils.read_yaml',
                     return_value=['1'])

        subset_maker_mock = mocker.patch(
            'openvino.tools.accuracy_checker.dataset.make_subset')
        addition_options = {
            'annotation_conversion': {
                'converter': 'wider',
                'annotation_file': Path('file')
            },
            'subsample_size': 1,
            'shuffle': False,
            "subset_file": "subset.yml"
        }
        config = copy_dataset_config(self.dataset_config)
        config.update(addition_options)
        converted_annotation = make_representation(
            ['0 0 0 5 5', '0 1 1 10 10'], True)
        mocker.patch(
            'openvino.tools.accuracy_checker.annotation_converters.WiderFormatConverter.convert',
            return_value=ConverterReturn(converted_annotation, None, None))
        Dataset.load_annotation(config)
        assert not subset_maker_mock.called
コード例 #2
0
 def test_annotation_conversion_closer_to_zero_subset_ratio(self, mocker):
     addition_options = {
         'annotation_conversion': {
             'converter': 'wider',
             'annotation_file': Path('file')
         },
         'subsample_size': '0.001%'
     }
     config = copy_dataset_config(self.dataset_config)
     config.update(addition_options)
     converted_annotation = make_representation(
         ['0 0 0 5 5', '0 1 1 10 10'], True)
     mocker.patch(
         'openvino.tools.accuracy_checker.annotation_converters.WiderFormatConverter.convert',
         return_value=ConverterReturn(converted_annotation, None, None))
     subset_maker_mock = mocker.patch(
         'openvino.tools.accuracy_checker.dataset.make_subset')
     Dataset.load_annotation(config)
     subset_maker_mock.assert_called_once_with(converted_annotation, 1, 666,
                                               True, False)
コード例 #3
0
 def test_annotation_conversion_subset_with_disabled_shuffle(self, mocker):
     addition_options = {
         'annotation_conversion': {
             'converter': 'wider',
             'annotation_file': Path('file')
         },
         'subsample_size': 1,
         'shuffle': False
     }
     config = copy_dataset_config(self.dataset_config)
     config.update(addition_options)
     converted_annotation = make_representation(
         ['0 0 0 5 5', '0 1 1 10 10'], True)
     mocker.patch(
         'openvino.tools.accuracy_checker.annotation_converters.WiderFormatConverter.convert',
         return_value=ConverterReturn(converted_annotation, None, None))
     annotation, _ = Dataset.load_annotation(config)
     assert annotation == [converted_annotation[0]]
コード例 #4
0
 def test_annotation_conversion_subset_more_than_dataset_size(self, mocker):
     addition_options = {
         'annotation_conversion': {
             'converter': 'wider',
             'annotation_file': Path('file')
         },
         'subsample_size': 3,
         'subsample_seed': 1
     }
     config = copy_dataset_config(self.dataset_config)
     config.update(addition_options)
     converted_annotation = make_representation(
         ['0 0 0 5 5', '0 1 1 10 10'], True)
     mocker.patch(
         'openvino.tools.accuracy_checker.annotation_converters.WiderFormatConverter.convert',
         return_value=ConverterReturn(converted_annotation, None, None))
     with pytest.warns(UserWarning):
         annotation, _ = Dataset.load_annotation(config)
         assert annotation == converted_annotation