ECCV2022-RIFE icon indicating copy to clipboard operation
ECCV2022-RIFE copied to clipboard

Image encoding is a bottleneck - Implement multithreaded image writing?

Open n00mkrad opened this issue 4 years ago • 1 comments
trafficstars

Using uncompressed BMP instead of PNG increased my speed from ~14 FPS at 1080p to ~18 FPS, proving that the image encoding slows things down and bottlenecks the GPU.

Is it possible to run image writing in several threads to speed this up?

n00mkrad avatar Jan 18 '21 10:01 n00mkrad

True, noticed it as well while doing sequence processing with 16bit fp open-exr. Currently I'm giving each frame a thread:

path = os.path.join(os.path.abspath(args.output), '{:0>7d}.exr'.format(cnt)) p = mp.Process(target=cv2.imwrite, args=(path, item[:, :, ::-1], [cv2.IMWRITE_EXR_TYPE, cv2.IMWRITE_EXR_TYPE_HALF], )) p.start()

and limiting process number roughly by adjusting output queue size:

write_buffer = Queue(maxsize=mp.cpu_count() - 3)

might be wrong way doing it but works for now. Full code: https://github.com/talosh/flameTimewarpML/blob/main/bundle/inference_sequence.py

talosh avatar Jan 21 '21 20:01 talosh