Parcourir la source

added iNat2020 annotations

Dimitri Korsch il y a 5 ans
Parent
commit
d6a0c2076e

+ 3 - 0
cvdatasets/annotations/__init__.py

@@ -7,6 +7,7 @@ from cvdatasets.annotations.impl.hed import HED_Annotations
 from cvdatasets.annotations.impl.imagenet import INET_Annotations
 from cvdatasets.annotations.impl.inat import INAT18_Annotations
 from cvdatasets.annotations.impl.inat import INAT19_Annotations
+from cvdatasets.annotations.impl.inat import INAT20_Annotations
 from cvdatasets.annotations.impl.nab import NAB_Annotations
 from cvdatasets.annotations.impl.tigers import TIGERS_Annotations
 
@@ -39,4 +40,6 @@ class AnnotationType(BaseChoiceType):
 	INAT19_MINI = partial(INAT19_Annotations)
 	INAT19_TEST = partial(INAT19_Annotations)
 
+	INAT20 = INAT20_Annotations
+
 	Default = CUB200

+ 26 - 0
cvdatasets/annotations/impl/inat.py

@@ -49,6 +49,32 @@ class BaseINAT_Annotations(BBoxMixin, PartsMixin, BaseAnnotations):
 	def meta(self):
 		raise NotImplementedError
 
+class INAT20_Annotations(BaseINAT_Annotations):
+
+	name="INAT20"
+
+	@property
+	def meta(self):
+		info = _MetaInfo(
+			images_folder="images",
+			content="trainval.json",
+			val_content="val.json",
+
+			# fake bounding boxes: the whole image
+			bounding_box_dtype=np.dtype([(v, np.int32) for v in "xywh"]),
+
+			parts_file=join("parts", "part_locs.txt"),
+			part_names_file=join("parts", "parts.txt"),
+		)
+
+		info.structure = [
+			[info.content, "_content"],
+			[info.val_content, "_val_content"],
+			[info.parts_file, "_part_locs"],
+			[info.part_names_file, "_part_names"],
+		]
+		return info
+
 class INAT19_Annotations(BaseINAT_Annotations):
 
 	name="INAT19"

+ 9 - 0
scripts/info_files/info.yml

@@ -100,6 +100,11 @@ DATASETS:
     annotations: "flowers102"
     n_classes: 102
 
+  INAT20:         &inat20
+    folder: inat
+    annotations: "2020/PLAIN"
+    n_classes: 200
+
   INAT19:         &inat19
     folder: inat
     annotations: "2019"
@@ -254,6 +259,10 @@ PARTS:
     <<: *parts_global
     feature_suffix: .test
 
+  INAT20_GLOBAL:
+    <<: *inat20
+    <<: *parts_global
+
   HED_GLOBAL:
     <<: *hed
     <<: *parts_global