benjiebob / WLDO

Code for paper ECCV 2020 paper: Who Left the Dogs Out? 3D Animal Reconstruction with Expectation Maximization in the Loop.
MIT License
48 stars 7 forks source link

3D keyjoints coordinate obatain #6

Open Brian417-cup opened 2 years ago

Brian417-cup commented 2 years ago

Hey, I want to know how I can change your code and let them merely obtain 3D coordinates of keyjoints from dogs.

benjiebob commented 2 years ago

Hi Brian, thanks for your question. The 3D coordinates for a set of joints are accessible on this line: https://github.com/benjiebob/WLDO/blob/master/wldo_regressor/model.py#L97

These are filtered from the full set returned by SMAL which you can see here: https://github.com/benjiebob/WLDO/blob/master/global_utils/smal_model/smal_torch.py#L188

Brian417-cup commented 2 years ago

Ok, thanks for your excellent answer! Now, I have obtained the 3D coordinates for a set of joints and visualized them with the code demonstrated in the below picture. However, I wonder whether the three-dimensional coordinates here are those in world space. At the same time, I notice that there are three parameters here about "preds['camera']", I want to know exactly the meaning of these three parameters. I think maybe the meanings of these camera parameters can let me better understand the process of projecting 3D coordinates to 2D key points in the picture. 3d visualization

mzc421 commented 2 years ago

1、All the key points I get are zero? Why? 2、I didn't understand how to get a 3D graph. I converted the data in joint3d into a 3D graph. Viewing on meshlab is just a point, not a graph. I'm a novice

benjiebob commented 2 years ago

@Brian417-cup - you can check how to project the 3D points into the image here.

The network predicts (x, y) translations in the camera frame and depth z. They are applied to the SMAL model like this

The network also obtains the camera focal length as: f = 2700 + 2700 q where q is predicted by the network. It's defined here and applied to the projection function here.

Our paper follows the same parameterization here as 3D-Safari.

benjiebob commented 2 years ago

@mzc421 - I might need a few extra details to help you debug this.

  1. Please can you try and run the WLDO code on our data (e.g. StanfordExtra). Then check the value of labelled_joints_3d when it is set on this line. This should definitely be non-zero.

  2. Are you trying to view the full animal mesh in Meshlab or just the joints? If you want the mesh, you could use a library like Trimesh to load the vertices and faces (triangles). You can then export, for example as a ply, and load this in MeshLab. For a worked example of exporting SMAL to PLY with Trimesh you can check the SMALify repository.

mzc421 commented 2 years ago

View the complete animal grid in Meshlab

benjiebob commented 2 years ago

image

Are you hoping to see an output such as the blue model as shown in this image? If so, then I think you want to export the mesh to a ply file. My instructions in 2. can help you do that.

mzc421 commented 2 years ago

ok,thanks

mzc421 commented 2 years ago

The previous problems have been solved. I wonder if the model has saved the animal hair information (texture information) to make it look not single but colorful.Like the picture below: image