how do i insert multiple images in one generation with this model?
- User
how do i insert multiple images in one generation with this model?
- Assistant
To generate 3D assets using multiple images as input with the TRELLIS model, you can use the method
run_multi_imageprovided by theTrellisImageTo3DPipelineclass. This method allows you to condition the pipeline on multiple images and produce a single 3D output that integrates information from all the input images.Example Code for Multi-Image Generation
Here's how you can use the
run_multi_imagemethod to provide multiple images:pythonimport os from PIL import Image from trellis.pipelines import TrellisImageTo3DPipeline from trellis.utils import render_utils import imageio import numpy as np # Load the pipeline pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large") pipeline.cuda() # Load multiple images images = [ Image.open("path_to_image_1.png"), Image.open("path_to_image_2.png"), Image.open("path_to_image_3.png"), ] # Run the pipeline with multiple images outputs = pipeline.run_multi_image( images=images, seed=1, # Optional parameters for fine-tuning sparse_structure_sampler_params={ "steps": 12, # Number of sampling steps for sparse structure "cfg_strength": 7.5, # Classifier-free guidance strength }, slat_sampler_params={ "steps": 12, # Number of sampling steps for structured latent "cfg_strength": 3, # Classifier-free guidance strength for slat }, preprocess_image=True, # Preprocess the images (default is True) mode='stochastic', # Sampling mode: 'stochastic' or 'multidiffusion' ) # Render and save the results video_gs = render_utils.render_video(outputs['gaussian'][0])['color'] video_mesh = render_utils.render_video(outputs['mesh'][0])['normal'] video = [np.concatenate([frame_gs, frame_mesh], axis=1) for frame_gs, frame_mesh in zip(video_gs, video_mesh)] imageio.mimsave("multi_image_output.mp4", video, fps=30)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.