XintongHe commited on
Commit
7d1e22e
1 Parent(s): 5a77adc

Update Stomatal_Images_Datasets.py

Browse files
Files changed (1) hide show
  1. Stomatal_Images_Datasets.py +20 -12
Stomatal_Images_Datasets.py CHANGED
@@ -45,10 +45,14 @@ class NewDataset(datasets.GeneratorBasedBuilder):
45
  "annotations": datasets.Sequence({
46
  "category_id": datasets.Value("int32"),
47
  "bounding_box": {
48
- "x_min": datasets.Value("float32"),
49
- "y_min": datasets.Value("float32"),
50
- "x_max": datasets.Value("float32"),
51
- "y_max": datasets.Value("float32"),
 
 
 
 
52
  # "x_center_rel": datasets.Value("float32"),
53
  # "y_center_rel": datasets.Value("float32"),
54
  # "width_rel": datasets.Value("float32"),
@@ -102,17 +106,21 @@ class NewDataset(datasets.GeneratorBasedBuilder):
102
  # y_min = (y_center_rel - height_rel / 2) * height
103
  # x_max = (x_center_rel + width_rel / 2) * width
104
  # y_max = (y_center_rel + height_rel / 2) * height
105
- x_min = x_center_rel
106
- y_min = y_center_rel
107
- x_max = width_rel
108
- y_max = height_rel
109
  annotations.append({
110
  "category_id": int(class_id),
111
  "bounding_box": {
112
- "x_min": x_min,
113
- "y_min": y_min,
114
- "x_max": x_max,
115
- "y_max": y_max
 
 
 
 
116
  }
117
  })
118
  return annotations
 
45
  "annotations": datasets.Sequence({
46
  "category_id": datasets.Value("int32"),
47
  "bounding_box": {
48
+ "x_center_rel": datasets.Value("float32"),
49
+ "y_center_rel": datasets.Value("float32"),
50
+ "width_rel": datasets.Value("float32"),
51
+ "height_rel": datasets.Value("float32"),
52
+ # "x_min": datasets.Value("float32"),
53
+ # "y_min": datasets.Value("float32"),
54
+ # "x_max": datasets.Value("float32"),
55
+ # "y_max": datasets.Value("float32"),
56
  # "x_center_rel": datasets.Value("float32"),
57
  # "y_center_rel": datasets.Value("float32"),
58
  # "width_rel": datasets.Value("float32"),
 
106
  # y_min = (y_center_rel - height_rel / 2) * height
107
  # x_max = (x_center_rel + width_rel / 2) * width
108
  # y_max = (y_center_rel + height_rel / 2) * height
109
+ # x_min = x_center_rel
110
+ # y_min = y_center_rel
111
+ # x_max = width_rel
112
+ # y_max = height_rel
113
  annotations.append({
114
  "category_id": int(class_id),
115
  "bounding_box": {
116
+ "x_center_rel": x_center_rel ,
117
+ "y_center_rel": y_center_rel,
118
+ "width_rel": width_rel,
119
+ "height_rel": height_rel
120
+ # "x_min": x_min,
121
+ # "y_min": y_min,
122
+ # "x_max": x_max,
123
+ # "y_max": y_max
124
  }
125
  })
126
  return annotations