Browse Source

added flowers dataset

Dimitri Korsch 6 years ago
parent
commit
a3e0438115
2 changed files with 26 additions and 6 deletions
  1. 11 6
      nabirds/annotations/flowers.py
  2. 15 0
      scripts/info_files/info.yml

+ 11 - 6
nabirds/annotations/flowers.py

@@ -18,8 +18,8 @@ class FLOWERS_Annotations(BaseAnnotations, BBoxMixin):
 			split_file="tr_ID.txt",
 			bounding_boxes="bounding_boxes.txt",
 			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"),
+			parts_file=join("parts", "part_locs.txt"),
+			part_names_file=join("parts", "parts.txt"),
 		)
 
 		info.structure = [
@@ -27,21 +27,26 @@ class FLOWERS_Annotations(BaseAnnotations, BBoxMixin):
 			[info.labels_file, "labels"],
 			[info.split_file, "_split"],
 			[info.bounding_boxes, "_bounding_boxes"],
-			# [info.parts_file, "_part_locs"],
-			# [info.part_names_file, "_part_names"],
+			[info.parts_file, "_part_locs"],
+			[info.part_names_file, "_part_names"],
 		]
 		return info
 
+	def __init__(self, *args, **kwargs):
+		super(FLOWERS_Annotations, self).__init__(*args, **kwargs)
+		# set labels from [1..200] to [0..199]
+		self.labels -= 1
+
 	def _load_parts(self):
 		self.part_names = {}
 
 		# load only if present
 		if self.has_parts:
-			super(CARS_Annotations, self)._load_parts(idx_offset=1)
+			super(FLOWERS_Annotations, self)._load_parts(idx_offset=0)
 
 		self._load_bounding_boxes()
 
 	def parts(self, *args, **kwargs):
 		if self.has_parts:
-			return super(CARS_Annotations, self).parts(*args, **kwargs)
+			return super(FLOWERS_Annotations, self).parts(*args, **kwargs)
 		return None

+ 15 - 0
scripts/info_files/info.yml

@@ -222,6 +222,21 @@ PARTS:
     annotations: L1_full
 
 
+  ####################################
+  # Flowers 102
+  ####################################
+
+  FLOWERS_L1_pred:
+    <<: *flowers
+    <<: *parts_l1p
+    annotations: L1_pred
+
+  FLOWERS_L1_full:
+    <<: *flowers
+    <<: *parts_l1f
+    annotations: L1_full
+
+
   ####################################
   # iNaturalist 2019
   ####################################