|
@@ -0,0 +1,68 @@
|
|
|
+from cvdatasets.annotations.impl.birdsnap import BSNAP_Annotations
|
|
|
+from cvdatasets.annotations.impl.cars import CARS_Annotations
|
|
|
+from cvdatasets.annotations.impl.cub import CUB_Annotations
|
|
|
+from cvdatasets.annotations.impl.dogs import DOGS_Annotations
|
|
|
+from cvdatasets.annotations.impl.flowers import FLOWERS_Annotations
|
|
|
+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
|
|
|
+
|
|
|
+from cvargparse.utils import BaseChoiceType
|
|
|
+from functools import partial
|
|
|
+
|
|
|
+class AnnotationType(BaseChoiceType):
|
|
|
+ IMAGENET = INET_Annotations
|
|
|
+
|
|
|
+ CUB200 = CUB_Annotations
|
|
|
+ BIRDSNAP = BSNAP_Annotations
|
|
|
+ NAB = NAB_Annotations
|
|
|
+
|
|
|
+ CARS = CARS_Annotations
|
|
|
+ DOGS = DOGS_Annotations
|
|
|
+
|
|
|
+ FLOWERS = FLOWERS_Annotations
|
|
|
+
|
|
|
+ HED = HED_Annotations
|
|
|
+ TIGERS = TIGERS_Annotations
|
|
|
+
|
|
|
+ INAT18 = INAT18_Annotations
|
|
|
+ INAT19 = INAT19_Annotations
|
|
|
+ INAT20 = INAT20_Annotations
|
|
|
+
|
|
|
+ Default = CUB200
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def phony(cls, key):
|
|
|
+ """ returns for a key a list of datasets,
|
|
|
+ that use the same annotation class """
|
|
|
+
|
|
|
+ return {
|
|
|
+ cls.CUB200 : [ "CUB200_2FOLD", "CUB200_GOOGLE", "CUB200_GOOGLE_SEM" ],
|
|
|
+ cls.TIGERS : [ "TIGERS_TEST" ],
|
|
|
+ cls.INAT19 : [ "INAT19_TEST", "INAT19_MINI" ],
|
|
|
+ cls.INAT20 : [ "INAT20_TEST",
|
|
|
+ "INAT20_IN_CLASS",
|
|
|
+ "INAT20_OUT_CLASS",
|
|
|
+ "INAT20_NOISY_IN_CLASS",
|
|
|
+ "INAT20_NOISY_OUT_CLASS",
|
|
|
+ "INAT20_U_IN_CLASS",
|
|
|
+ "INAT20_U_OUT_CLASS",
|
|
|
+ ],
|
|
|
+ cls.IMAGENET : [ "IMAGENET_TOP_INAT20" ],
|
|
|
+ }.get(key, [])
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def as_choices(cls, add_phony=True):
|
|
|
+ choices = super(AnnotationType, cls).as_choices()
|
|
|
+ if not add_phony:
|
|
|
+ return choices
|
|
|
+
|
|
|
+ for key in cls:
|
|
|
+ for phony in cls.phony(key):
|
|
|
+ choices[phony.lower()] = choices[key.name.lower()]
|
|
|
+
|
|
|
+ return choices
|