applied black

This commit is contained in:
Matthias Bisping 2022-03-28 16:39:34 +02:00
parent b818ee4724
commit e818b05472
5 changed files with 3 additions and 3 deletions

View File

@ -14,6 +14,7 @@ class ImageClassifier:
"""Combines a classifier with a preprocessing pipeline: Receives images, chunks into batches, converts to tensors,
applies transformations and finally sends to internal classifier.
"""
def __init__(self, classifier: Classifier, preprocessor: Preprocessor = None):
self.estimator = classifier
self.preprocessor = preprocessor if preprocessor else BasicPreprocessor()

View File

@ -9,6 +9,7 @@ from image_prediction.utils import chunk_iterable
class ExtractorClassifier:
"""Extracts images from an object and classifies them. When called, returns an iterable of dictionaries, where
each dictionary has a filed 'label' for the classification and possibly additional fields for metadata."""
def __init__(self, image_extractor: ImageExtractor, image_classifier: ImageClassifier):
self.classifier = image_classifier
self.extractor = image_extractor

View File

@ -6,7 +6,6 @@ ImageMetadataPair = namedtuple("ImageMetadataPair", ["image", "metadata"])
class ImageExtractor(abc.ABC):
@abc.abstractmethod
def extract(self, obj) -> Iterable[ImageMetadataPair]:
"""Extracts images from an object"""

View File

@ -2,7 +2,6 @@ from image_prediction.image_extractor.extractor import ImageExtractor, ImageMeta
class ImageExtractorMock(ImageExtractor):
def extract(self, image_container):
for i, image in enumerate(image_container):
yield ImageMetadataPair(image, {"image_id": i})

View File

@ -29,7 +29,7 @@ class ParsablePDFImageExtractor(ImageExtractor):
"x1": x1,
"x2": x2,
"y1": y1,
"y2": y2
"y2": y2,
}
rounder = rcompose(round, int)