lucidrains / meshgpt-pytorch

Implementation of MeshGPT, SOTA Mesh generation using Attention, in Pytorch
MIT License
700 stars 57 forks source link

Area calculation for each triangle is same (with value of 0.5) #83

Closed aakash-saboo closed 3 months ago

aakash-saboo commented 3 months ago

Hello! @lucidrains @MarcusLoppe I noticed that while calculating the areas of each of the triangle, the cross product is normalized to the value of 1. In order to get the actual areas, we need to remove the cross product normalization. I have commented the original code line and replaced it with the correct one in the following snippet.

image

lucidrains commented 3 months ago

@aakash-saboo oh shoot, thanks for catching this!

are normals unit vectors? i guess it should look something like

cross_product = torch.cross
normals = l2norm(cross_product)
area = cross_product.norm * 0.5
lucidrains commented 3 months ago

haha, i guess, judging by Marcus' results, the area never mattered that much

MarcusLoppe commented 3 months ago

haha, i guess, judging by Marcus' results, the area never mattered that much

Actually area is second most important feature while was hyper-tuning the feature dims was the area. The order of important was; coord, area, norm, angle Norm had a small effect and angle had a very little effect.

lucidrains commented 3 months ago

@MarcusLoppe yea, but i think it was ablated out because of this error being pointed out

lucidrains commented 3 months ago

let me throw in the fix

MarcusLoppe commented 3 months ago

let me throw in the fix

I retrained my autoencoder with 1 quantizer with this update and the which was kinda of stuck at 0.37 began moving downwards! Currently it's at 0.35 with 0.04 loss decease per epoch (before it was 0.001).