@@ -104,7 +104,7 @@ def __len__(self):
104
104
for _i , (img , _ ) in enumerate (data_loader ):
105
105
pbar .update (1 )
106
106
height , width = img .shape [- 2 :]
107
- aspect_ratio = float (height ) / float (width )
107
+ aspect_ratio = float (width ) / float (height )
108
108
aspect_ratios .append (aspect_ratio )
109
109
return aspect_ratios
110
110
@@ -115,7 +115,7 @@ def _compute_aspect_ratios_custom_dataset(dataset, indices=None):
115
115
aspect_ratios = []
116
116
for i in indices :
117
117
height , width = dataset .get_height_and_width (i )
118
- aspect_ratio = float (height ) / float (width )
118
+ aspect_ratio = float (width ) / float (height )
119
119
aspect_ratios .append (aspect_ratio )
120
120
return aspect_ratios
121
121
@@ -126,7 +126,7 @@ def _compute_aspect_ratios_coco_dataset(dataset, indices=None):
126
126
aspect_ratios = []
127
127
for i in indices :
128
128
img_info = dataset .coco .imgs [dataset .ids [i ]]
129
- aspect_ratio = float (img_info ["height " ]) / float (img_info ["width " ])
129
+ aspect_ratio = float (img_info ["width " ]) / float (img_info ["height " ])
130
130
aspect_ratios .append (aspect_ratio )
131
131
return aspect_ratios
132
132
@@ -138,7 +138,7 @@ def _compute_aspect_ratios_voc_dataset(dataset, indices=None):
138
138
for i in indices :
139
139
# this doesn't load the data into memory, because PIL loads it lazily
140
140
width , height = Image .open (dataset .images [i ]).size
141
- aspect_ratio = float (height ) / float (width )
141
+ aspect_ratio = float (width ) / float (height )
142
142
aspect_ratios .append (aspect_ratio )
143
143
return aspect_ratios
144
144
0 commit comments