removing unused code / refactoring for coverage maximization

This commit is contained in:
Matthias Bisping 2022-03-30 18:03:21 +02:00
parent a95cc4e06b
commit ce3d33955e
4 changed files with 6 additions and 9 deletions

View File

@ -2,10 +2,11 @@ import abc
class Preprocessor(abc.ABC): class Preprocessor(abc.ABC):
@staticmethod @staticmethod
@abc.abstractmethod @abc.abstractmethod
def preprocess(batch): def preprocess(batch):
pass raise NotImplementedError
def __call__(self, batch): def __call__(self, batch):
return self.preprocess(batch) return self.preprocess(batch)

View File

@ -8,6 +8,3 @@ class BasicPreprocessor(Preprocessor):
@staticmethod @staticmethod
def preprocess(images): def preprocess(images):
return images_to_batch_tensor(images) return images_to_batch_tensor(images)
def __call__(self, images):
return self.preprocess(images)

View File

@ -15,10 +15,7 @@ class ExtractorClassifier:
self.extractor = image_extractor self.extractor = image_extractor
def __process_batch(self, batch): def __process_batch(self, batch):
try:
images, metadata = zip(*batch) images, metadata = zip(*batch)
except ValueError:
return []
predictions = self.classifier(images) predictions = self.classifier(images)
responses = ({"prediction": prd, **mdt} for prd, mdt in zip(predictions, metadata)) responses = ({"prediction": prd, **mdt} for prd, mdt in zip(predictions, metadata))

View File

@ -2,5 +2,7 @@ import abc
class Formatter(abc.ABC): class Formatter(abc.ABC):
@abc.abstractmethod
def format(self, info: dict): def format(self, info: dict):
pass raise NotImplementedError