Bladeren bron

some minor fixes

Dimitri Korsch 4 jaren geleden
bovenliggende
commit
4a16eddc7c

+ 1 - 1
cvdatasets/annotation/types/__init__.py

@@ -22,7 +22,7 @@ class AnnotationType(BaseChoiceType):
 		else:
 			info_file = read_info_file(opts.data)
 			assert opts.dataset in info_file.DATASETS, \
-				f"No information was found about the dataset \"{args.dataset}\" in the info file \"{args.data}\""
+				f"No information was found about the dataset \"{opts.dataset}\" in the info file \"{args.data}\""
 			ds_info = info_file.DATASETS[opts.dataset]
 			annot = cls[ds_info.annotation_type.lower()].value
 

+ 2 - 1
cvdatasets/dataset/part/base.py

@@ -7,6 +7,7 @@ from matplotlib import pyplot as plt
 from skimage.transform import resize
 
 from cvdatasets import utils
+from cvdatasets.dataset.part.surrogate import SurrogateType
 
 class BasePartCollection(ABC):
 
@@ -76,7 +77,7 @@ class BasePartCollection(ABC):
 
 
 class BasePart(ABC):
-	_surrogate_type = None
+	_surrogate_type: SurrogateType = SurrogateType.DEFAULT
 
 	def __repr__(self):
 		return repr(self.as_annotation)

+ 4 - 1
cvdatasets/dataset/part/surrogate.py

@@ -10,7 +10,10 @@ class SurrogateType(enum.Enum):
 	MIDDLE = enum.auto()
 	IMAGE = enum.auto()
 
+	DEFAULT = MIDDLE
+
 	def __call__(self, im, w, h, dtype=np.uint8):
+		im = utils.asarray(im)
 		if self is SurrogateType.BLANK:
 			return self._blank(im, w, h, dtype=dtype)
 
@@ -28,7 +31,7 @@ class SurrogateType(enum.Enum):
 		return np.zeros((h, w, c), dtype=dtype)
 
 	def _image(self, im, w, h, dtype):
-		_part_surrogate = resize(utils.asarray(im), (h, w),
+		_part_surrogate = resize(im, (h, w),
 			mode="constant",
 			anti_aliasing=True,
 			preserve_range=True)