CodeFormer
CodeFormer copied to clipboard
189GB memory usage when processing a movie (around 100 minutes long)
Hi team!
I run CodeFormer in a Windows Hyper-V VM with a Tesla M40 DDA into it.
When I try a movie as the input video, CodeFormer takes 189GB of memory.
The input video is a movie, "Shaolin Soccer" from DVD. The data path is DVD=>mp4=>CodeFormer
As it may take several weeks to complete. I afraid that it may run out of memory in certain point.
May I know if the memory usage will be doubled when saving the video?
us ffmpg to split the movie into small period and process them one by one then join together again.
#split video into small period: the_file = "inputs/video/movie.avi" !ffmpeg -i $the_file -c copy -map 0 -segment_time 00:00:10 -f segment -reset_timestamps 1 inputs/video/splited/movie_%03d.mp4
import os import glob ipath = "inputs/video/R" done_path = "inputs/video/Done" opath = "results/R" # scan all the jpg and png images input_v_list = sorted(glob.glob(os.path.join(ipath, '*.mp4'))) test_v_num = len(input_v_list) print (f'total video : {test_v_num}')
-------------------- start to processing ---------------------
for i, img_path in enumerate(input_v_list):
clean all the intermediate results to process the next image
if isinstance(img_path, str): img_name = os.path.basename(img_path) basename, ext = os.path.splitext(img_name) save_path = os.path.join(opath, f'{img_name}') print(f'[{i+1}/{test_v_num}] U Processing: {img_name}, I:{img_path} O:{save_path}') !python inference_codeformer.py --bg_upsampler realesrgan -w 0.5 --input_path $img_path -o $opath -s 2 !mv $img_path $done_path #finally concat all file in done_path into one.