
Re-illuminate people in video to match target lighting from a 360 HDRI environment map.
Follow the steps below to download and run the NVIDIA NIM inference microservice for this model on your infrastructure of choice.
NVIDIA Video Relighting NIM uses gRPC APIs for inferencing requests.
An NGC API Key is required to pull the container image and download models from NGC. Pass the value of the API Key to the docker run command in the next section as the NGC_API_KEY environment variable as indicated.
If you are not familiar with how to create the NGC_API_KEY environment variable, the simplest way is to export it in your terminal:
export NGC_API_KEY=<PASTE_API_KEY_HERE>
Run one of the following commands to make the key available at startup:
# If using bash
echo "export NGC_API_KEY=<value>" >> ~/.bashrc
# If using zsh
echo "export NGC_API_KEY=<value>" >> ~/.zshrc
Other, more secure options include saving the value in a file, so that you can retrieve with cat $NGC_API_KEY_FILE, or using a password manager.
To pull the NIM container image from NGC, first authenticate with the NVIDIA Container Registry with the following command:
echo "$NGC_API_KEY" | docker login nvcr.io --username '$oauthtoken' --password-stdin
Optionally, set the manifest profile that matches your GPU architecture. If omitted, the NIM automatically selects the correct profile based on the detected hardware.
| GPU Architecture (compute capability) | GPUs | Manifest Profile ID |
|---|---|---|
| Blackwell (cc 12.0) | B40, GB20, RTX5090, RTX5080 | 9697136675f0a8998e3b2c5370aba86fc484c05ba64fcb5c068adf72d3282edb |
| Ada (cc 8.9) | L4, L40, RTX4090 | eb4d86fede4a539a0b1170645e7cddcab1efec9b6ac7dd6091fc73ca4d2a832d |
| Ampere (cc 8.6) | GA102, GA104, A40, A10 | 836049b226b20a087b007fbeb6fd7dd4b9e649a2e344cf9632da98e4833ad786 |
| Turing (cc 7.5) | T4 | 00eba71f1b818164eb4849937de044821184bd7d86e806ba6bebd634259990e6 |
export NIM_MANIFEST_PROFILE=<enter_valid_manifest_profile_id>
The following command launches the Video Relighting NIM container with the gRPC service. Find reference to runtime parameters for the container here.
docker run -it --rm --name=relighting-nim \
--runtime=nvidia \
--gpus all \
--shm-size=8GB \
-e NGC_API_KEY=$NGC_API_KEY \
-e NIM_MANIFEST_PROFILE=$NIM_MANIFEST_PROFILE \
-e NIM_MAX_CONCURRENCY_PER_GPU=1 \
-e NIM_HTTP_API_PORT=8000 \
-e NIM_GRPC_API_PORT=8001 \
-p 8000:8000 \
-p 8001:8001 \
-p 9002:9002 \
nvcr.io/nim/nvidia/ai4m-relighting-nim:1.1.0
Please note, the flag --gpus all is used to assign all available GPUs to the docker container.
To assign specific GPUs to the docker container (in case of multiple GPUs available in your machine) use --gpus '"device=0,1,2..."'
If the command runs successfully, you will get an output ending similar to the following:
Triton server is ready
[INFO MAXINE BASE LOGGER ... base_service.py:_serve_threading:295 PID:...] Using Insecure Server Credentials
[INFO MAXINE BASE LOGGER ... base_service.py:_serve_threading:300 PID:...] Listening to 0.0.0.0:8001
By default the Video Relighting gRPC service is hosted on port 8001. You will use this port for inferencing requests. The port is configurable via the NIM_GRPC_API_PORT environment variable.
Install grpcurl from github.com/fullstorydev/grpcurl/releases and perform a health check:
wget https://raw.githubusercontent.com/grpc/grpc/master/src/proto/grpc/health/v1/health.proto
grpcurl --plaintext --proto health.proto localhost:8001 grpc.health.v1.Health/Check
If the service is ready, you get a response similar to:
{ "status": "SERVING" }
You will need a system with git and Python 3.10+ installed.
Download the Video Relighting Python client code by cloning the NVIDIA Maxine NIM Clients Repository:
git clone https://github.com/NVIDIA-Maxine/nim-clients.git
cd nim-clients/relighting
Install the dependencies for the Python client:
pip install -r requirements.txt
Go to the scripts directory:
cd scripts
Run the command to send a gRPC request:
python3 relighting.py --target <server_ip:port> --video-input <input_file_path> --output <output_file_path>
Example command with sample input:
python3 relighting.py --target 127.0.0.1:8001 --video-input ../assets/sample_video.mp4 --output output.mp4
For more details on getting started with this NIM including configuring parameters, visit the NVIDIA Video Relighting NIM Docs.