MCPcopy
hub / github.com/pytorch/vision / create_aspect_ratio_groups

Function create_aspect_ratio_groups

references/detection/group_by_aspect_ratio.py:187–196  ·  view source on GitHub ↗
(dataset, k=0)

Source from the content-addressed store, hash-verified

185
186
187def create_aspect_ratio_groups(dataset, k=0):
188 aspect_ratios = compute_aspect_ratios(dataset)
189 bins = (2 ** np.linspace(-1, 1, 2 * k + 1)).tolist() if k > 0 else [1.0]
190 groups = _quantize(aspect_ratios, bins)
191 # count number of elements per group
192 counts = np.unique(groups, return_counts=True)[1]
193 fbins = [0] + bins + [np.inf]
194 print(f"Using {fbins} as bins for aspect ratio quantization")
195 print(f"Count of instances per bin: {counts}")
196 return groups

Callers 1

mainFunction · 0.90

Calls 3

compute_aspect_ratiosFunction · 0.85
_quantizeFunction · 0.85
printFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…