You can also create your custom pre-processing pipeline using only openCV. You can also load images as PIL Image perform pre process using torchvision and convert the image back to openCV image if you want. Refer to the documentation of the libraries to set your parameters correctly.