tools/accuracy_checker/accuracy_checker/annotation_converters/mnist.py
def convert(self, check_content=False, progress_callback=None, progress_interval=100, **kwargs):
        """
        This method is executed automatically when convert.py is started.
        All arguments are automatically got from command line arguments or config file in method configure

        Returns:
            annotations: list of annotation representation objects.
            meta: dictionary with additional dataset level metadata.
        """
        annotations = []
        check_images = check_content and not self.convert_images
        meta = self.generate_meta()
        labels_to_id = meta['label_map']
        content_errors = None
        if check_content:
            self.converted_images_dir = self.converted_images_dir or self.test_csv_file.parent / 'converted_images'

        if self.converted_images_dir and check_content:
            if not self.converted_images_dir.exists():
                content_errors = ['{}: does not exist'.format(self.converted_images_dir)]
                check_images = False
        # read original dataset annotation
        annotation_table = read_csv(self.test_csv_file)
        num_iterations = len(annotation_table)
        for index, annotation in enumerate(annotation_table):
            identifier = '{}.png'.format(index)
            label = labels_to_id.get(annotation['label'], int(annotation['label']))
            if self.convert_images:
                image = Image.fromarray(self.convert_image(annotation))
                image = image.convert("L")
                image.save(str(self.converted_images_dir / identifier))
            annotations.append(ClassificationAnnotation(identifier, label))
            if check_images:
                if not check_file_existence(self.converted_images_dir / identifier):
                    # add error to errors list if file not found
                    content_errors.append('{}: does not exist'.format(self.converted_images_dir / identifier))

            if progress_callback is not None and index % progress_interval == 0:
                progress_callback(index / num_iterations * 100)

        return ConverterReturn(annotations, meta, content_errors)

        This method is executed automatically when convert.py is started.
        All arguments are automatically got from command line arguments or config file in method configure

        Returns:
            annotations: list of annotation representation objects.
            meta: dictionary with additional dataset level metadata.
        
This method is executed automatically when convert.py is started.
All arguments are automatically got from command line arguments or config file in method configure
This method is executed automatically when convert . py is started . All arguments are automatically got from command line arguments or config file in method configure
def convert(self, check_content=False, progress_callback=None, progress_interval=100, **kwargs):
        annotations = []
        check_images = check_content and not self.convert_images
        meta = self.generate_meta()
        labels_to_id = meta['label_map']
        content_errors = None
        if check_content:
            self.converted_images_dir = self.converted_images_dir or self.test_csv_file.parent / 'converted_images'
        if self.converted_images_dir and check_content:
            if not self.converted_images_dir.exists():
                content_errors = ['{}: does not exist'.format(self.converted_images_dir)]
                check_images = False
        annotation_table = read_csv(self.test_csv_file)
        num_iterations = len(annotation_table)
        for index, annotation in enumerate(annotation_table):
            identifier = '{}.png'.format(index)
            label = labels_to_id.get(annotation['label'], int(annotation['label']))
            if self.convert_images:
                image = Image.fromarray(self.convert_image(annotation))
                image = image.convert("L")
                image.save(str(self.converted_images_dir / identifier))
            annotations.append(ClassificationAnnotation(identifier, label))
            if check_images:
                if not check_file_existence(self.converted_images_dir / identifier):
                    content_errors.append('{}: does not exist'.format(self.converted_images_dir / identifier))
            if progress_callback is not None and index % progress_interval == 0:
                progress_callback(index / num_iterations * 100)
        return ConverterReturn(annotations, meta, content_errors)
def convert ( self , check_content = False , progress_callback = None , progress_interval = 100 , ** kwargs ) : annotations = [ ] check_images = check_content and not self . convert_images meta = self . generate_meta ( ) labels_to_id = meta [ 'label_map' ] content_errors = None if check_content : self . converted_images_dir = self . converted_images_dir or self . test_csv_file . parent / 'converted_images' if self . converted_images_dir and check_content : if not self . converted_images_dir . exists ( ) : content_errors = [ '{}: does not exist' . format ( self . converted_images_dir ) ] check_images = False annotation_table = read_csv ( self . test_csv_file ) num_iterations = len ( annotation_table ) for index , annotation in enumerate ( annotation_table ) : identifier = '{}.png' . format ( index ) label = labels_to_id . get ( annotation [ 'label' ] , int ( annotation [ 'label' ] ) ) if self . convert_images : image = Image . fromarray ( self . convert_image ( annotation ) ) image = image . convert ( "L" ) image . save ( str ( self . converted_images_dir / identifier ) ) annotations . append ( ClassificationAnnotation ( identifier , label ) ) if check_images : if not check_file_existence ( self . converted_images_dir / identifier ) : content_errors . append ( '{}: does not exist' . format ( self . converted_images_dir / identifier ) ) if progress_callback is not None and index % progress_interval == 0 : progress_callback ( index / num_iterations * 100 ) return ConverterReturn ( annotations , meta , content_errors )
This method is executed automatically when convert.py is started.
This method is executed automatically when convert . py is started .
"""
        This method is executed automatically when convert.py is started.
        All arguments are automatically got from command line arguments or config file in method configure

        Returns:
            annotations: list of annotation representation objects.
            meta: dictionary with additional dataset level metadata.
        """ # read original dataset annotation # add error to errors list if file not found
list of annotation representation objects.
meta: dictionary with additional dataset level metadata.
list of annotation representation objects . meta : dictionary with additional dataset level metadata .
annotations
self
check_content
progress_callback
progress_interval