Bladeren bron

moved Opts class to this module

Dimitri Korsch 3 jaren geleden
bovenliggende
commit
1f33e98102
2 gewijzigde bestanden met toevoegingen van 11 en 1 verwijderingen
  1. 2 0
      cvdatasets/__init__.py
  2. 9 1
      cvdatasets/annotation/types/__init__.py

+ 2 - 0
cvdatasets/__init__.py

@@ -4,6 +4,7 @@ from cvdatasets.annotation.files import AnnotationFiles
 from cvdatasets.annotation.mixins.bbox_mixin import BBoxMixin
 from cvdatasets.annotation.mixins.features_mixin import FeaturesMixin
 from cvdatasets.annotation.mixins.parts_mixin import PartsMixin
+from cvdatasets.annotation.types import AnnotationArgs
 from cvdatasets.annotation.types import AnnotationType
 from cvdatasets.annotation.types.file_list import FileListAnnotations
 from cvdatasets.annotation.types.folder_annotations import FolderAnnotations
@@ -16,6 +17,7 @@ __all__ = [
 	"_MetaInfo",
 	"Annotations",
 	"AnnotationFiles",
+	"AnnotationArgs",
 	"AnnotationType",
 	"BaseAnnotations",
 	"BBoxMixin",

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

@@ -1,4 +1,5 @@
 import logging
+import typing
 
 from cvdatasets.annotation.types.file_list import FileListAnnotations
 from cvdatasets.annotation.types.folder_annotations import FolderAnnotations
@@ -8,6 +9,13 @@ from cvargparse.utils import BaseChoiceType
 from cvargparse.utils.enumerations import MetaBaseType
 from cvdatasets.utils import read_info_file
 
+
+class AnnotationArgs(typing.NamedTuple):
+	data: str
+	dataset: str
+	parts: str
+	feature_model: str
+
 class AnnotationType(BaseChoiceType):
 	FOLDER = FolderAnnotations
 	FILE_LIST = FileListAnnotations
@@ -16,7 +24,7 @@ class AnnotationType(BaseChoiceType):
 	Default = FILE_LIST
 
 	@classmethod
-	def new_annotation(cls, opts, **kwargs):
+	def new_annotation(cls, opts: AnnotationArgs, **kwargs):
 		info_file = read_info_file(opts.data)
 		ds_info = info_file.DATASETS[opts.dataset]