-
Notifications
You must be signed in to change notification settings - Fork 302
Open
Description
Dear authors,
There's a normalization mismatch in the codebase:
-
Data preprocessing normalizes meshes to [0, 1] space
Hunyuan3D-2.1/hy3dshape/tools/watertight/watertight_and_sample.py
Lines 160 to 170 in 7cc51b6
def normalize_to_unit_box(V): """ Normalize the vertices V to fit inside a unit bounding box [0,1]^3. V: (n,3) numpy array of vertex positions. Returns: normalized V """ V_min = V.min(axis=0) V_max = V.max(axis=0) scale = (V_max - V_min).max() * 1.01 V_normalized = (V - V_min) / scale return V_normalized -
Latent generation queries points in [-1, 1] space
Hunyuan3D-2.1/hy3dshape/hy3dshape/models/autoencoders/volume_decoders.py
Lines 157 to 167 in 7cc51b6
# 1. generate query points if isinstance(bounds, float): bounds = [-bounds, -bounds, -bounds, bounds, bounds, bounds] bbox_min, bbox_max = np.array(bounds[0:3]), np.array(bounds[3:6]) xyz_samples, grid_size, length = generate_dense_grid_points( bbox_min=bbox_min, bbox_max=bbox_max, octree_resolution=octree_resolution, indexing="ij" )
and surface_loader normalizes meshes into [-1, 1]
Hunyuan3D-2.1/hy3dshape/hy3dshape/surface_loaders.py
Lines 23 to 44 in 7cc51b6
def normalize_mesh(mesh, scale=0.9999): """ Normalize the mesh to fit inside a centered cube with a specified scale. The mesh is translated so that its bounding box center is at the origin, then uniformly scaled so that the longest side of the bounding box fits within [-scale, scale]. Args: mesh (trimesh.Trimesh): Input mesh to normalize. scale (float, optional): Scaling factor to slightly shrink the mesh inside the unit cube. Default is 0.9999. Returns: trimesh.Trimesh: The normalized mesh with applied translation and scaling. """ bbox = mesh.bounds center = (bbox[1] + bbox[0]) / 2 scale_ = (bbox[1] - bbox[0]).max() mesh.apply_translation(-center) mesh.apply_scale(1 / scale_ * 2 * scale) return mesh
Which normalization settings were used during training? Should we use [-1, 1] for both vae and diffusion training to maintain consistency?
Thank you for your excellent work!
JCBreath
Metadata
Metadata
Assignees
Labels
No labels