| import os
|
|
|
| os.environ['SPCONV_ALGO'] = 'native'
|
|
|
|
|
|
|
| import numpy as np
|
| import imageio
|
| from PIL import Image
|
| from trellis.pipelines import TrellisImageTo3DPipeline
|
| from trellis.utils import render_utils
|
|
|
|
|
| pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
|
| pipeline.cuda()
|
|
|
|
|
| images = [
|
| Image.open("assets/example_multi_image/character_1.png"),
|
| Image.open("assets/example_multi_image/character_2.png"),
|
| Image.open("assets/example_multi_image/character_3.png"),
|
| ]
|
|
|
|
|
| outputs = pipeline.run_multi_image(
|
| images,
|
| seed=1,
|
|
|
| sparse_structure_sampler_params={
|
| "steps": 12,
|
| "cfg_strength": 7.5,
|
| },
|
| slat_sampler_params={
|
| "steps": 12,
|
| "cfg_strength": 3,
|
| },
|
| )
|
|
|
|
|
|
|
|
|
|
|
| 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("sample_multi.mp4", video, fps=30)
|
|
|