Эх сурвалжийг харах

updated loading of folder-based annotations

Dimitri Korsch 5 жил өмнө
parent
commit
faca31a1b6

+ 1 - 1
cvdatasets/_version.py

@@ -1 +1 @@
-__version__ = "0.8.0"
+__version__ = "0.8.1"

+ 10 - 5
cvdatasets/annotation/types/folder_annotations.py

@@ -4,13 +4,18 @@ from cvdatasets.annotation.base import Annotations
 from cvdatasets.annotation.files import AnnotationFiles
 
 class FolderAnnotations(Annotations):
+	_default_folders = dict(
+		train_images="ILSVRC2012_img_train",
+		val_images="ILSVRC2012_img_val",
+		test_images=("ILSVRC2012_img_test", True)
+	)
+
+	def __init__(self, *args, folders=_default_folders, **kwargs):
+		self._folders = folders
+		super(FolderAnnotations, self).__init__(*args, **kwargs)
 
 	def load_files(self, file_obj) -> AnnotationFiles:
-		file_obj.load_files(
-			train_images="ILSVRC2012_img_train",
-			val_images="ILSVRC2012_img_val",
-			test_images=("ILSVRC2012_img_test", True),
-		)
+		file_obj.load_files(**self._folders)
 		return file_obj
 
 	@property