I have a similar problem, only that I need a post-processing on the network output before I can pass it on. I was looking for some sort of DataLoader type approach, where I can got for a simple image and it automatically handles a batch of the same. The code by @kelam_goutam looks nice, but I was wondering if pytorch already has something.
My problem is my network outputs values in the range [-1, 1]. So I need to do a shift and scale, multiply by 255 and convert to uint8, before passing it on to imageio’s imwrite.
@soshishimada Would be interested to see your benchmarks on the code!