dcscn-super-resolution icon indicating copy to clipboard operation
dcscn-super-resolution copied to clipboard

When Inferencing OOM error even for just one image

Open nareshmungpara opened this issue 5 years ago • 3 comments

Hi, the input shape is 196 * 720 * 1280. It looks you are feeding 196 images at once. It's obvious that you don't have an enough memory to process it at once.

I don't know you are using the model, but that is the reason. Thx!

Hi @UrYuWang and @jiny2001 ,

I am loading only 1 image and with dimension [1809,1164] and getting the issue

Resource exhausted: OOM when allocating tensor with shape[1,108,1809,1164] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator @#GPU_0_bfc

Now I don’t understand why it is showing me 108 even though I have loaded only one image. Can you please help me with that

Originally posted by @nareshmungpara in https://github.com/jiny2001/dcscn-super-resolution/issues/81#issuecomment-564857357

nareshmungpara avatar Dec 12 '19 09:12 nareshmungpara

Update:-

  • I tried to freeze the model and then run code for .pb file and now I am getting following error Resource exhausted: OOM when allocating tensor with shape[1,196,1809,1164] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc [[{{node prefix/CNN1/prelu/Abs}}]]

  • shape[1,196,1809,1164] now it has become 196 and still, I am passing only 1 image as input. Not sure why it happened, can you please help me understand it and resolve it.

  • For freezing, I have used TensorRT and converted the model to .pb file which I am using above.

nareshmungpara avatar Dec 12 '19 09:12 nareshmungpara

I know this is too late for you, but for others, you can split the image into patches using functionality like this https://github.com/idealo/image-super-resolution/blob/master/ISR/utils/image_processing.py

Sylvus avatar Nov 15 '20 15:11 Sylvus

Thank you, @Sylvus !

Yes, "Resource exhausted: OOM" error simply means memory was not sufficient. This is because, the model size is proportional to the input image resolution.

So in your case, as @Sylvus suggested, you can split the image into smaller pieces to feed the model. Thx.

jiny2001 avatar Nov 16 '20 05:11 jiny2001