In the TorchVision Finetuning tutorial, it was mentioned that ‘’‘get_height_and_width’’’ method should be implemented as part of the PyTorch dataset, when aspect-ratio grouping is implemented. I’ve searched the web for examples of such datasets with that method, but could not find any. Do you have an example of such datasets implementations? I wish to see how to aspect ration grouping and the get_height_and_width are commonly implemented.
Hello @HyamsG ,
(Sorry for bumping an old thread.)
I came across the same question today. I used the fine-tuning tutorial with my own custom dataset and saw a prompt asking me to implement get_height_and_width.
The structure of the get_height_and_width function can be inferred from the tutorial’s group_by_aspect_ratio.py, in particular its _compute_aspect_ratios_custom_dataset() where it reads height, width = dataset.get_height_and_width(i).
In my case, I simply implemented like so: