diff --git a/image_prediction/estimator/preprocessor/preprocessor.py b/image_prediction/estimator/preprocessor/preprocessor.py index e5da175..3959b51 100644 --- a/image_prediction/estimator/preprocessor/preprocessor.py +++ b/image_prediction/estimator/preprocessor/preprocessor.py @@ -2,10 +2,11 @@ import abc class Preprocessor(abc.ABC): + @staticmethod @abc.abstractmethod def preprocess(batch): - pass + raise NotImplementedError def __call__(self, batch): return self.preprocess(batch) diff --git a/image_prediction/estimator/preprocessor/preprocessors/basic.py b/image_prediction/estimator/preprocessor/preprocessors/basic.py index f8e5943..03e94e6 100644 --- a/image_prediction/estimator/preprocessor/preprocessors/basic.py +++ b/image_prediction/estimator/preprocessor/preprocessors/basic.py @@ -8,6 +8,3 @@ class BasicPreprocessor(Preprocessor): @staticmethod def preprocess(images): return images_to_batch_tensor(images) - - def __call__(self, images): - return self.preprocess(images) diff --git a/image_prediction/extractor_classifier/extractor_classifier.py b/image_prediction/extractor_classifier/extractor_classifier.py index 930dfb1..1206756 100644 --- a/image_prediction/extractor_classifier/extractor_classifier.py +++ b/image_prediction/extractor_classifier/extractor_classifier.py @@ -15,10 +15,7 @@ class ExtractorClassifier: self.extractor = image_extractor def __process_batch(self, batch): - try: - images, metadata = zip(*batch) - except ValueError: - return [] + images, metadata = zip(*batch) predictions = self.classifier(images) responses = ({"prediction": prd, **mdt} for prd, mdt in zip(predictions, metadata)) diff --git a/image_prediction/formatter/formatter.py b/image_prediction/formatter/formatter.py index 2d71ee5..a22bc1d 100644 --- a/image_prediction/formatter/formatter.py +++ b/image_prediction/formatter/formatter.py @@ -2,5 +2,7 @@ import abc class Formatter(abc.ABC): + + @abc.abstractmethod def format(self, info: dict): - pass + raise NotImplementedError