I’ve run into similar issues 1. Yes, making the image smaller helps, OTOH, if you have already properly accounted for any leaking tensors by checking tf.memory() after each frame, then the problem is more likely fragmentation of the TF memory allocator, or internal TF leaks.
@Jason FWIW, 640x480 is not that big, depending on your GPU. On an A100, for instance, you can easily fit like 20 of those into a single batch. If you are using a GPU back-end running with CUDA, I believe the largest texture dim is 8K. TF should have no trouble handling larger images if your GPU has enough memory. Sure, for classification, they always use small ~300x300 images, but for running kernels that generate new images, folks will definitely need to be able to run much larger frames, ideally 4K and 8K.
One approach to handling the larger frame sizes is to tile the input. Of course this only works for kernels/models that only point sample the original image, rather than ones where the kernel is a larger region in the source, like a convolution. For fixed-width kernels, like convolution, you’ll need to pad the tiles by the kernel width and then throw away the extra bits when you recombine the tiles.