### Install CodeFormer and Dependencies Source: https://github.com/sczhou/codeformer/blob/master/README.md Clone the repository, create a new conda environment, and install Python dependencies. Optionally install dlib for enhanced face detection. ```bash git clone https://github.com/sczhou/CodeFormer cd CodeFormer conda create -n codeformer python=3.8 -y conda activate codeformer pip3 install -r requirements.txt python basicsr/setup.py develop conda install -c conda-forge dlib (only for face detection or cropping with dlib) ``` -------------------------------- ### Install CodeFormer and Dependencies Source: https://context7.com/sczhou/codeformer/llms.txt Clone the repository, create a conda environment, and install all necessary dependencies. Optional steps include installing dlib for more accurate face detection and downloading pretrained models. ```bash git clone https://github.com/sczhou/CodeFormer cd CodeFormer conda create -n codeformer python=3.8 -y conda activate codeformer pip3 install -r requirements.txt python basicsr/setup.py develop # Optional: Install dlib for more accurate face detection conda install -c conda-forge dlib # Download pretrained models python scripts/download_pretrained_models.py facelib python scripts/download_pretrained_models.py CodeFormer # Optional: Download dlib models for dlib face detector python scripts/download_pretrained_models.py dlib ``` -------------------------------- ### Install ffmpeg for Video Processing Source: https://context7.com/sczhou/codeformer/llms.txt Install ffmpeg, which is a required dependency for processing video files with CodeFormer. ```bash conda install -c conda-forge ffmpeg ``` -------------------------------- ### Run Video Enhancement Source: https://github.com/sczhou/codeformer/blob/master/README.md Commands to install dependencies and run inference on video files. ```bash # For Windows/Mac users, please install ffmpeg first conda install -c conda-forge ffmpeg ``` ```bash # For video clips # Video path should end with '.mp4'|'.mov'|'.avi' python inference_codeformer.py --bg_upsampler realesrgan --face_upsample -w 1.0 --input_path [video path] ``` -------------------------------- ### Video Enhancement for Supported Formats Source: https://context7.com/sczhou/codeformer/llms.txt Process video files in supported formats including .mp4, .mov, and .avi. Ensure ffmpeg is installed. ```bash python inference_codeformer.py -w 0.7 --input_path ./inputs/clip.mov ``` -------------------------------- ### Basic Video Enhancement Source: https://context7.com/sczhou/codeformer/llms.txt Perform basic face restoration on video files. Ensure ffmpeg is installed prior to running this command. ```bash python inference_codeformer.py -w 0.7 --input_path ./inputs/video.mp4 ``` -------------------------------- ### Download Pre-trained Models Source: https://github.com/sczhou/codeformer/blob/master/README.md Commands to download facelib, dlib, and CodeFormer pre-trained weights into the project directory. ```bash python scripts/download_pretrained_models.py facelib python scripts/download_pretrained_models.py dlib (only for dlib face detector) ``` ```bash python scripts/download_pretrained_models.py CodeFormer ``` -------------------------------- ### Prepare Testing Data Source: https://github.com/sczhou/codeformer/blob/master/README.md Command to crop and align faces for testing. ```bash # you may need to install dlib via: conda install -c conda-forge dlib python scripts/crop_align_face.py -i [input folder] -o [output folder] ``` -------------------------------- ### Deploy Gradio Web Interface Source: https://context7.com/sczhou/codeformer/llms.txt Python script to launch a Gradio interface for interactive face restoration using the CodeFormer model. ```python import gradio as gr import cv2 import torch from torchvision.transforms.functional import normalize from basicsr.utils import img2tensor, tensor2img from basicsr.utils.registry import ARCH_REGISTRY from facelib.utils.face_restoration_helper import FaceRestoreHelper # Initialize models (see previous examples for full setup) device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # ... load codeformer_net and upsampler ... def inference(image_path, background_enhance, face_upsample, upscale, fidelity): img = cv2.imread(image_path, cv2.IMREAD_COLOR) face_helper = FaceRestoreHelper( int(upscale), face_size=512, crop_ratio=(1, 1), det_model='retinaface_resnet50', save_ext='png', use_parse=True, device=device ) face_helper.read_image(img) face_helper.get_face_landmarks_5(resize=640, eye_dist_threshold=5) face_helper.align_warp_face() for cropped_face in face_helper.cropped_faces: cropped_face_t = img2tensor(cropped_face / 255., bgr2rgb=True, float32=True) normalize(cropped_face_t, (0.5, 0.5, 0.5), (0.5, 0.5, 0.5), inplace=True) cropped_face_t = cropped_face_t.unsqueeze(0).to(device) with torch.no_grad(): output = codeformer_net(cropped_face_t, w=fidelity, adain=True)[0] restored_face = tensor2img(output, rgb2bgr=True, min_max=(-1, 1)) face_helper.add_restored_face(restored_face.astype('uint8')) face_helper.get_inverse_affine(None) bg_img = upsampler.enhance(img, outscale=int(upscale))[0] if background_enhance else None restored_img = face_helper.paste_faces_to_input_image(upsample_img=bg_img) return cv2.cvtColor(restored_img, cv2.COLOR_BGR2RGB) demo = gr.Interface( fn=inference, inputs=[ gr.Image(type="filepath", label="Input Image"), gr.Checkbox(value=True, label="Background Enhancement"), gr.Checkbox(value=True, label="Face Upsample"), gr.Slider(1, 4, value=2, step=1, label="Upscale Factor"), gr.Slider(0, 1, value=0.5, step=0.01, label="Fidelity (0=quality, 1=identity)") ], outputs=gr.Image(type="numpy", label="Restored Image"), title="CodeFormer Face Restoration" ) demo.launch() ``` -------------------------------- ### Initialize and run CodeFormer model Source: https://context7.com/sczhou/codeformer/llms.txt Load the pre-trained CodeFormer model and perform inference on aligned 512x512 face images using different fidelity weights. ```python import cv2 import torch from torchvision.transforms.functional import normalize from basicsr.utils import img2tensor, tensor2img from basicsr.utils.registry import ARCH_REGISTRY device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Load model net = ARCH_REGISTRY.get('CodeFormer')( dim_embd=512, codebook_size=1024, n_head=8, n_layers=9, connect_list=['32', '64', '128', '256'] ).to(device) checkpoint = torch.load('weights/CodeFormer/codeformer.pth')['params_ema'] net.load_state_dict(checkpoint) net.eval() # Load and preprocess aligned face (must be 512x512) img = cv2.imread('aligned_face.png') img = cv2.resize(img, (512, 512), interpolation=cv2.INTER_LINEAR) img_t = img2tensor(img / 255., bgr2rgb=True, float32=True) normalize(img_t, (0.5, 0.5, 0.5), (0.5, 0.5, 0.5), inplace=True) img_t = img_t.unsqueeze(0).to(device) # Inference with different fidelity weights with torch.no_grad(): # w=0: best quality (relies more on codebook) output_quality, logits, lq_feat = net(img_t, w=0, adain=True) # w=0.5: balanced quality and fidelity output_balanced, _, _ = net(img_t, w=0.5, adain=True) # w=1: best fidelity (preserves more input details) output_fidelity, _, _ = net(img_t, w=1.0, adain=True) # Convert to images restored_quality = tensor2img(output_quality, rgb2bgr=True, min_max=(-1, 1)) restored_balanced = tensor2img(output_balanced, rgb2bgr=True, min_max=(-1, 1)) restored_fidelity = tensor2img(output_fidelity, rgb2bgr=True, min_max=(-1, 1)) cv2.imwrite('restored_w0.png', restored_quality.astype('uint8')) cv2.imwrite('restored_w05.png', restored_balanced.astype('uint8')) cv2.imwrite('restored_w1.png', restored_fidelity.astype('uint8')) ``` -------------------------------- ### Train VQGAN Model Source: https://github.com/sczhou/codeformer/blob/master/docs/train.md Use this command to train the VQGAN model. Ensure PyTorch version is compatible or use `torchrun` for versions >= 1.10. ```bash python -m torch.distributed.launch --nproc_per_node=gpu_num --master_port=4321 basicsr/train.py -opt options/VQGAN_512_ds32_nearest_stage1.yml --launcher pytorch ``` -------------------------------- ### Run Whole Image Enhancement Source: https://github.com/sczhou/codeformer/blob/master/README.md Inference command for enhancing whole images, with optional background and face upsampling. ```bash # For whole image # Add '--bg_upsampler realesrgan' to enhance the background regions with Real-ESRGAN # Add '--face_upsample' to further upsample restorated face with Real-ESRGAN python inference_codeformer.py -w 0.7 --input_path [image folder]|[image path] ``` -------------------------------- ### Restore Pre-cropped and Aligned Faces Source: https://context7.com/sczhou/codeformer/llms.txt Restore pre-cropped and aligned 512x512 face images. This method is recommended for best quality and fair benchmarking. ```bash python inference_codeformer.py -w 0.5 --has_aligned --input_path ./inputs/cropped_faces ``` -------------------------------- ### Run Face Colorization Source: https://github.com/sczhou/codeformer/blob/master/README.md Inference command for colorizing black and white or faded photos. ```bash # For cropped and aligned faces (512x512) # Colorize black and white or faded photo python inference_colorization.py --input_path [image folder]|[image path] ``` -------------------------------- ### Run Face Restoration Source: https://github.com/sczhou/codeformer/blob/master/README.md Inference command for restoring cropped and aligned faces. ```bash # For cropped and aligned faces (512x512) python inference_codeformer.py -w 0.5 --has_aligned --input_path [image folder]|[image path] ``` -------------------------------- ### Crop and Align Faces Source: https://context7.com/sczhou/codeformer/llms.txt Pre-process images by detecting, cropping, and aligning faces to 512x512 using the FFHQ alignment method. ```bash python scripts/crop_align_face.py -i ./inputs/whole_imgs -o ./inputs/cropped_faces ``` -------------------------------- ### Face Restoration for Single Image with Custom Output Source: https://context7.com/sczhou/codeformer/llms.txt Process a single image for face restoration and specify a custom output path for the results. The fidelity weight is set to 0.5. ```bash python inference_codeformer.py -w 0.5 --input_path ./inputs/whole_imgs/photo.jpg -o ./my_results ``` -------------------------------- ### Train Controllable Fidelity Stage III Source: https://context7.com/sczhou/codeformer/llms.txt Train the controllable module for quality-fidelity trade-off. ```bash python -m torch.distributed.launch --nproc_per_node=8 --master_port=4323 \ basicsr/train.py -opt options/CodeFormer_stage3.yml --launcher pytorch ``` -------------------------------- ### Basic Face Restoration on Whole Images Source: https://context7.com/sczhou/codeformer/llms.txt Perform basic face restoration on whole images. The `-w` parameter controls the fidelity weight, where smaller values result in higher quality and larger values result in higher fidelity. ```bash python inference_codeformer.py -w 0.7 --input_path ./inputs/whole_imgs ``` -------------------------------- ### Train Controllable Module Source: https://github.com/sczhou/codeformer/blob/master/docs/train.md Command to train the Controllable Module (Stage III). Ensure `gpu_num` is set correctly. ```bash python -m torch.distributed.launch --nproc_per_node=gpu_num --master_port=4323 basicsr/train.py -opt options/CodeFormer_stage3.yml --launcher pytorch ``` -------------------------------- ### Configure CodeFormer Training Source: https://context7.com/sczhou/codeformer/llms.txt YAML configuration file defining model architecture, dataset parameters, and training hyperparameters. ```yaml # Example: options/CodeFormer_stage3.yml name: CodeFormer_stage3 model_type: CodeFormerJointModel num_gpu: 8 manual_seed: 0 datasets: train: name: FFHQ type: FFHQBlindJointDataset dataroot_gt: datasets/ffhq/ffhq_512 in_size: 512 gt_size: 512 mean: [0.5, 0.5, 0.5] std: [0.5, 0.5, 0.5] use_hflip: true use_corrupt: true # Degradation parameters blur_kernel_size: 41 blur_sigma: [0.1, 10] downsample_range: [1, 12] noise_range: [0, 15] jpeg_range: [60, 100] batch_size_per_gpu: 3 dataset_enlarge_ratio: 100 network_g: type: CodeFormer dim_embd: 512 n_head: 8 n_layers: 9 codebook_size: 1024 connect_list: ['32', '64', '128', '256'] fix_modules: ['quantize', 'generator'] train: total_iter: 150000 optim_g: type: Adam lr: 5e-5 ema_decay: 0.997 pixel_opt: type: L1Loss loss_weight: 1.0 perceptual_opt: type: LPIPSLoss loss_weight: 1.0 gan_opt: type: GANLoss gan_type: hinge loss_weight: 1.0 logger: print_freq: 100 save_checkpoint_freq: 5000 use_tb_logger: true ``` -------------------------------- ### Run Face Inpainting Source: https://github.com/sczhou/codeformer/blob/master/README.md Inference command for inpainting masked face regions. ```bash # For cropped and aligned faces (512x512) # Inputs could be masked by white brush using an image editing app (e.g., Photoshop) # (check out the examples in inputs/masked_faces) python inference_inpainting.py --input_path [image folder]|[image path] ``` -------------------------------- ### Draw Bounding Boxes on Detected Faces Source: https://context7.com/sczhou/codeformer/llms.txt Visualize the detected faces by drawing bounding boxes around them during the restoration process. This helps in verifying face detection accuracy. ```bash python inference_codeformer.py -w 0.7 --draw_box --input_path ./inputs/whole_imgs ``` -------------------------------- ### Enhance background with Real-ESRGAN Source: https://context7.com/sczhou/codeformer/llms.txt Configure and use the RealESRGANer upsampler for background enhancement, including automatic half-precision detection. ```python import cv2 import torch from basicsr.archs.rrdbnet_arch import RRDBNet from basicsr.utils.realesrgan_utils import RealESRGANer # Check for half precision support use_half = False if torch.cuda.is_available(): no_half_gpu_list = ['1650', '1660'] if not any(gpu in torch.cuda.get_device_name(0) for gpu in no_half_gpu_list): use_half = True # Initialize RealESRGAN model model = RRDBNet( num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=2, ) upsampler = RealESRGANer( scale=2, model_path='https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/RealESRGAN_x2plus.pth', model=model, tile=400, # Tile size for processing large images tile_pad=40, # Padding for tiles pre_pad=0, half=use_half ) # Enhance image img = cv2.imread('input.jpg') enhanced_img, _ = upsampler.enhance(img, outscale=2) # 2x upscale cv2.imwrite('enhanced_bg.png', enhanced_img) ``` -------------------------------- ### Pre-calculate Latent Ground Truth Source: https://github.com/sczhou/codeformer/blob/master/docs/train.md Run this script after VQGAN training to pre-calculate the code sequence for the dataset, which speeds up later training stages. ```bash python scripts/generate_latent_gt.py ``` -------------------------------- ### Colorize Single Grayscale Face Image Source: https://context7.com/sczhou/codeformer/llms.txt Colorize a single pre-cropped and aligned grayscale face image. Ensure the input image is 512x512. ```bash python inference_colorization.py --input_path ./inputs/gray_faces/bw_portrait.png ``` -------------------------------- ### Video Enhancement with Custom Output Frame Rate Source: https://context7.com/sczhou/codeformer/llms.txt Process video files and set a custom output frame rate. This command sets the output frame rate to 30 FPS. ```bash python inference_codeformer.py -w 0.7 --save_video_fps 30 --input_path ./inputs/video.mp4 ``` -------------------------------- ### Use FaceRestoreHelper API Source: https://context7.com/sczhou/codeformer/llms.txt Programmatically detect, align, and restore faces using the FaceRestoreHelper class. ```python import cv2 import torch from torchvision.transforms.functional import normalize from basicsr.utils import img2tensor, tensor2img from basicsr.utils.download_util import load_file_from_url from basicsr.utils.registry import ARCH_REGISTRY from facelib.utils.face_restoration_helper import FaceRestoreHelper # Initialize device device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Load CodeFormer model net = ARCH_REGISTRY.get('CodeFormer')( dim_embd=512, codebook_size=1024, n_head=8, n_layers=9, connect_list=['32', '64', '128', '256'] ).to(device) ckpt_path = load_file_from_url( url='https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth', model_dir='weights/CodeFormer', progress=True ) checkpoint = torch.load(ckpt_path)['params_ema'] net.load_state_dict(checkpoint) net.eval() # Initialize face helper face_helper = FaceRestoreHelper( upscale_factor=2, face_size=512, crop_ratio=(1, 1), det_model='retinaface_resnet50', # or 'YOLOv5l', 'dlib' save_ext='png', use_parse=True, device=device ) # Process image img = cv2.imread('input.jpg', cv2.IMREAD_COLOR) face_helper.read_image(img) # Detect and align faces num_faces = face_helper.get_face_landmarks_5( only_center_face=False, resize=640, eye_dist_threshold=5 ) print(f'Detected {num_faces} faces') face_helper.align_warp_face() ``` -------------------------------- ### Train VQGAN Stage I Source: https://context7.com/sczhou/codeformer/llms.txt Train the VQGAN autoencoder to learn the discrete face codebook and optionally pre-calculate latent codes. ```bash python -m torch.distributed.launch --nproc_per_node=8 --master_port=4321 \ basicsr/train.py -opt options/VQGAN_512_ds32_nearest_stage1.yml --launcher pytorch ``` ```bash python scripts/generate_latent_gt.py \ -i datasets/ffhq/ffhq_512 \ -o ./experiments/pretrained_models/vqgan \ --codebook_size 1024 \ --ckpt_path ./experiments/pretrained_models/vqgan/net_g.pth ``` -------------------------------- ### Video Enhancement with Background and Face Upsampling Source: https://context7.com/sczhou/codeformer/llms.txt Enhance video quality by applying both background upsampling using Real-ESRGAN and face upsampling. The fidelity weight is set to 1.0. ```bash python inference_codeformer.py --bg_upsampler realesrgan --face_upsample -w 1.0 --input_path ./video.mp4 ``` -------------------------------- ### Colorize Faces Source: https://context7.com/sczhou/codeformer/llms.txt Perform face colorization using the inference script with optional output paths and suffixes. ```bash python inference_colorization.py --input_path ./inputs/gray_faces -o ./colorized_results ``` ```bash python inference_colorization.py --input_path ./inputs/gray_faces --suffix colorized ``` -------------------------------- ### Face Restoration with Different Face Detectors Source: https://context7.com/sczhou/codeformer/llms.txt Utilize different face detection models for restoration. Available options include retinaface_resnet50, retinaface_mobile0.25, YOLOv5l, YOLOv5n, and dlib. ```bash python inference_codeformer.py -w 0.7 --detection_model dlib --input_path ./inputs/whole_imgs ``` -------------------------------- ### Face Restoration with Custom Upscale Factor Source: https://context7.com/sczhou/codeformer/llms.txt Perform face restoration with a custom upscale factor. The default factor is 2, but this command sets it to 4. ```bash python inference_codeformer.py -w 0.5 -s 4 --input_path ./inputs/whole_imgs ``` -------------------------------- ### Face Restoration with Background Enhancement Source: https://context7.com/sczhou/codeformer/llms.txt Enhance face restoration by also upsampling the background using Real-ESRGAN. This command applies both face restoration and background enhancement. ```bash python inference_codeformer.py -w 0.7 --bg_upsampler realesrgan --input_path ./inputs/whole_imgs ``` -------------------------------- ### Restore faces using CodeFormer Source: https://context7.com/sczhou/codeformer/llms.txt Iterate through detected faces to apply restoration with a specified fidelity weight, then paste them back into the original image. ```python fidelity_weight = 0.5 # 0 = quality, 1 = fidelity for cropped_face in face_helper.cropped_faces: cropped_face_t = img2tensor(cropped_face / 255., bgr2rgb=True, float32=True) normalize(cropped_face_t, (0.5, 0.5, 0.5), (0.5, 0.5, 0.5), inplace=True) cropped_face_t = cropped_face_t.unsqueeze(0).to(device) with torch.no_grad(): output = net(cropped_face_t, w=fidelity_weight, adain=True)[0] restored_face = tensor2img(output, rgb2bgr=True, min_max=(-1, 1)) restored_face = restored_face.astype('uint8') face_helper.add_restored_face(restored_face, cropped_face) # Paste faces back to image face_helper.get_inverse_affine(None) restored_img = face_helper.paste_faces_to_input_image(upsample_img=None, draw_box=False) # Save result cv2.imwrite('output.png', restored_img) # Clean up for next image face_helper.clean_all() ``` -------------------------------- ### Utility functions for image processing Source: https://context7.com/sczhou/codeformer/llms.txt Convert between numpy images and PyTorch tensors, and save images with automatic directory creation. ```python import cv2 import numpy as np import torch from basicsr.utils import img2tensor, tensor2img, imwrite # img2tensor: Convert numpy image to PyTorch tensor # Input: numpy array (H, W, C) BGR uint8 [0, 255] # Output: tensor (C, H, W) RGB float32 [0, 1] img = cv2.imread('image.jpg') tensor = img2tensor(img / 255., bgr2rgb=True, float32=True) print(tensor.shape) # torch.Size([3, H, W]) # tensor2img: Convert PyTorch tensor to numpy image # Input: tensor (B, C, H, W) or (C, H, W) RGB # Output: numpy array (H, W, C) BGR uint8 [0, 255] output_tensor = torch.randn(1, 3, 512, 512) img_np = tensor2img(output_tensor, rgb2bgr=True, min_max=(0, 1)) print(img_np.shape, img_np.dtype) # (512, 512, 3) uint8 # For CodeFormer output (normalized to [-1, 1]) codeformer_output = torch.randn(1, 3, 512, 512) # [-1, 1] range img_np = tensor2img(codeformer_output, rgb2bgr=True, min_max=(-1, 1)) # imwrite: Save image with automatic directory creation imwrite(img_np, 'results/subdir/output.png') # Creates 'results/subdir/' if needed ``` -------------------------------- ### Train Code Sequence Prediction Module Source: https://github.com/sczhou/codeformer/blob/master/docs/train.md Command to train the Code Sequence Prediction Module (Stage II). Replace `gpu_num` with the actual number of GPUs. ```bash python -m torch.distributed.launch --nproc_per_node=gpu_num --master_port=4322 basicsr/train.py -opt options/CodeFormer_stage2.yml --launcher pytorch ``` -------------------------------- ### Colorize Grayscale Face Images Source: https://context7.com/sczhou/codeformer/llms.txt Colorize black and white or faded face photographs. Input images must be pre-cropped and aligned to 512x512. ```bash python inference_colorization.py --input_path ./inputs/gray_faces ``` -------------------------------- ### Restore Single Cropped Face Source: https://context7.com/sczhou/codeformer/llms.txt Process a single pre-cropped and aligned face image for restoration. Ensure the input image is 512x512 for optimal results. ```bash python inference_codeformer.py -w 0.5 --has_aligned --input_path ./inputs/cropped_faces/face.png ``` -------------------------------- ### Maximum Quality Face Restoration Source: https://context7.com/sczhou/codeformer/llms.txt Achieve maximum quality by enabling both background enhancement with Real-ESRGAN and face upsampling. This provides the highest fidelity output. ```bash python inference_codeformer.py -w 0.7 --bg_upsampler realesrgan --face_upsample --input_path ./inputs/whole_imgs ``` -------------------------------- ### Train Code Prediction Stage II Source: https://context7.com/sczhou/codeformer/llms.txt Train the transformer module to predict code sequences for face restoration. ```bash python -m torch.distributed.launch --nproc_per_node=8 --master_port=4322 \ basicsr/train.py -opt options/CodeFormer_stage2.yml --launcher pytorch ``` -------------------------------- ### Add Suffix to Restored Cropped Face Filenames Source: https://context7.com/sczhou/codeformer/llms.txt Add a custom suffix to the output filenames when restoring pre-cropped and aligned faces. This helps in organizing multiple processed images. ```bash python inference_codeformer.py -w 0.5 --has_aligned --suffix restored --input_path ./inputs/cropped_faces ``` -------------------------------- ### Inpaint Masked Faces Source: https://context7.com/sczhou/codeformer/llms.txt Restore masked or missing regions in face images. Input images must be 512x512 with white regions marking areas to inpaint. ```bash python inference_inpainting.py --input_path ./inputs/masked_faces ``` ```bash python inference_inpainting.py --input_path ./inputs/masked_faces/masked_face.png ``` ```bash python inference_inpainting.py --input_path ./inputs/masked_faces -o ./inpainted_results ``` -------------------------------- ### Restore Only Center Face in Group Photos Source: https://context7.com/sczhou/codeformer/llms.txt Process group photos and restore only the center-detected face. This is useful for isolating the main subject in group images. ```bash python inference_codeformer.py -w 0.5 --only_center_face --input_path ./inputs/whole_imgs ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.