From e818b05472dcdd02ab346801539eb67d30084966 Mon Sep 17 00:00:00 2001 From: Matthias Bisping Date: Mon, 28 Mar 2022 16:39:34 +0200 Subject: [PATCH] applied black --- image_prediction/classifier/image_classifier.py | 1 + image_prediction/extractor_classifier/extractor_classifier.py | 1 + image_prediction/image_extractor/extractor.py | 1 - image_prediction/image_extractor/extractors/mock.py | 1 - image_prediction/image_extractor/extractors/parsable.py | 2 +- 5 files changed, 3 insertions(+), 3 deletions(-) diff --git a/image_prediction/classifier/image_classifier.py b/image_prediction/classifier/image_classifier.py index 212205f..30b62ed 100644 --- a/image_prediction/classifier/image_classifier.py +++ b/image_prediction/classifier/image_classifier.py @@ -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() diff --git a/image_prediction/extractor_classifier/extractor_classifier.py b/image_prediction/extractor_classifier/extractor_classifier.py index 17bb5a9..bb8198e 100644 --- a/image_prediction/extractor_classifier/extractor_classifier.py +++ b/image_prediction/extractor_classifier/extractor_classifier.py @@ -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 diff --git a/image_prediction/image_extractor/extractor.py b/image_prediction/image_extractor/extractor.py index 1405aee..66bfc3b 100644 --- a/image_prediction/image_extractor/extractor.py +++ b/image_prediction/image_extractor/extractor.py @@ -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""" diff --git a/image_prediction/image_extractor/extractors/mock.py b/image_prediction/image_extractor/extractors/mock.py index cfbc4d8..86ced9a 100644 --- a/image_prediction/image_extractor/extractors/mock.py +++ b/image_prediction/image_extractor/extractors/mock.py @@ -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}) diff --git a/image_prediction/image_extractor/extractors/parsable.py b/image_prediction/image_extractor/extractors/parsable.py index 4ebbb6c..933b4b4 100644 --- a/image_prediction/image_extractor/extractors/parsable.py +++ b/image_prediction/image_extractor/extractors/parsable.py @@ -29,7 +29,7 @@ class ParsablePDFImageExtractor(ImageExtractor): "x1": x1, "x2": x2, "y1": y1, - "y2": y2 + "y2": y2, } rounder = rcompose(round, int)