torchgeo icon indicating copy to clipboard operation
torchgeo copied to clipboard

Add Transforms Benchmark

Open isaaccorley opened this issue 4 years ago • 6 comments

  • Add benchmark_transforms.py which allows one to compare the execution time of a sequential pipeline of our transforms + kornia augmentations for CPU vs GPU and various batch image/mask sizes.

isaaccorley avatar Sep 30 '21 20:09 isaaccorley

Overall thoughts:

  1. How fast are these transforms? I assume ~1 sec or less. We might want to loop over them multiple times to get a more accurate speed measurement.
  2. Do we want to benchmark the CPU transforms in parallel with multiple workers? Users could use them after data loading or as an argument to dataset right?
  1. Depends. CPU/GPU are quite similar for small images and small batch sizes, as expected. For the opposite case, GPU will outperform CPU greatly. However it's not exactly an apples to apples comparison as you mention because CPU, in this case, is not taking advantage of any parallelism.
  2. No we don't. This is a tricky one to measure but I think we can use a torch.utils.data.TensorDataset so there should be no overhead for I/O when loading a batch using multiple workers since the tensors will already be loaded to memory.

isaaccorley avatar Oct 10 '21 01:10 isaaccorley

Let's not merge this yet so I can implement a true comparison per my above comment for GPU augs vs CPU augs with multiple workers.

isaaccorley avatar Oct 10 '21 01:10 isaaccorley

Also, other benchmark scripts and experiment scripts are missing the license comment, just a heads up.

isaaccorley avatar Oct 10 '21 01:10 isaaccorley

Let's not merge this yet so I can implement a true comparison per my above comment for GPU augs vs CPU augs with multiple workers.

let us know about this and see if we can be of any help here. We are currently refactoring the augmentations module just reorganizing code for further improvements /cc @shijianjian @twsl

edgarriba avatar Jan 07 '22 10:01 edgarriba

@isaaccorley is this still a WIP or should we close it?

adamjstewart avatar Feb 18 '22 22:02 adamjstewart

This is still a WIP but it's close to done. I think the only thing that's left is to figure out how we want to compare to CPU in an apples to apples way.

isaaccorley avatar Feb 20 '22 15:02 isaaccorley