Views
No views yet
!pip --quiet install imageio[ffmpeg] PyMCubes trimesh rembg[gpu,cli] kiui1import torch
2from transformers import AutoModel, AutoProcessor
3
4# load the model and processor
5model = AutoModel.from_pretrained("jadechoghari/vfusion3d", trust_remote_code=True)
6processor = AutoProcessor.from_pretrained("jadechoghari/vfusion3d")
7
8# download and preprocess the image
9import requests
10from PIL import Image
11from io import BytesIO
12
13image_url = 'https://sm.ign.com/ign_nordic/cover/a/avatar-gen/avatar-generations_prsz.jpg'
14response = requests.get(image_url)
15image = Image.open(BytesIO(response.content))
16
17# preprocess the image and get the source camera
18image, source_camera = processor(image)
19
20
21# generate planes (default output)
22output_planes = model(image, source_camera)
23print("Planes shape:", output_planes.shape)
24
25# generate a 3D mesh
26output_planes, mesh_path = model(image, source_camera, export_mesh=True)
27print("Planes shape:", output_planes.shape)
28print("Mesh saved at:", mesh_path)
29
30# Generate a video
31output_planes, video_path = model(image, source_camera, export_video=True)
32print("Planes shape:", output_planes.shape)
33print("Video saved at:", video_path)
34export_mesh=True, and you'll get a .obj file ready to roll. You can also customize the mesh resolution by adjusting the mesh_size parameter.export_video=True, and you'll receive a beautifully rendered video from multiple angles. You can tweak render_size and fps to get the video just right.


@article{han2024vfusion3d,
title={VFusion3D: Learning Scalable 3D Generative Models from Video Diffusion Models},
author={Junlin Han and Filippos Kokkinos and Philip Torr},
journal={European Conference on Computer Vision (ECCV)},
year={2024}
}