Giter VIP home page Giter VIP logo

Comments (11)

DavidBoja avatar DavidBoja commented on May 27, 2024 1

@Daktha123
The second image code looks all right to me at first glance. You don't need the imports there but I guess they shouldn't hurt. I can't help you if I don't know what's actually wrong -- "program is not working" is not specific enough.

@NaToh5
You need to load the verts -- these are YOUR vertices that you should have. You can add them to the code as @Daktha123 did in the second image.

from smpl-anthropometry.

TharHtetAungg avatar TharHtetAungg commented on May 27, 2024 1

If I don't use "**verts = verts_tensor.float()*" I got this error " RuntimeError: expected scalar type Float but found Double ". That's why I use that code. Do you think that code might (verts = verts_tensor.float()) have a problem with the measurement process?

And also " measurer.visualize() " this is not working. Even I run measure.py the output only shows this

image

I need like this :

image

Updated : I already got the measurement visualization. I have to use local IDE to run the code , so that it will lead to browser to show the measurement visualization. Google Colab is not showing for the measurement visualization. Thank you for everything @DavidBoja

from smpl-anthropometry.

DavidBoja avatar DavidBoja commented on May 27, 2024

Hi,

Depending on the output of SHAPY and PYMAF you can do the following:

  1. If you have the SMPL shape betas and gender gender parameters as your SHAPY or PYMAF outputs:
smpl_path = "/SMPL-Anthropometry/data/SMPL" 
measurer = MeasureSMPL(smpl_path=smpl_path) 

measurer.from_smpl(gender=gender, shape=betas) 

measurement_names = MeasurementDefinitions.possible_measurements 
measurer.measure(measurement_names) 
measurer.label_measurements(STANDARD_LABELS) 
  1. If you have the SMPL body vertices verts of shape 6890x3 as your SHAPY or PYMAF outputs:
smpl_path = "/SMPL-Anthropometry/data/SMPL" 
measurer = MeasureSMPL(smpl_path=smpl_path) 

measurer.from_verts(verts=verts) 

measurement_names = MeasurementDefinitions.possible_measurements 
measurer.measure(measurement_names) 
measurer.label_measurements(STANDARD_LABELS) 

Then, the measurer.measurements and measurer.labeled_measurements are python dictionaries of your measurements.

from smpl-anthropometry.

TharHtetAungg avatar TharHtetAungg commented on May 27, 2024

Thank you for getting back to me.
So the file format for verts is .npz file format right?

By the way, Is there any other way that can measure from 3D obj file?

from smpl-anthropometry.

DavidBoja avatar DavidBoja commented on May 27, 2024

So the file format for verts is .npz file format right?

The SMPL package uses pytorch as its standard for vectors/matrices/tensors. Therefore, if you have a .npz file on your disk with the vertices, you can load them with numpy and then convert them into a torch tensor -- something like torch.from_numpy(loaded_numpy_vertices). As I mentioned however, the dimensions of the vertices needs to be (6890,3).

By the way, Is there any other way that can measure from 3D obj file?

Sure, load your .obj file with trimesh -- something like verts = trimesh.load(scan_path, process=False).vertices -- and then convert the verts into a torch tensor as noted above torch.from_numpy(fitted_smpl).

from smpl-anthropometry.

TharHtetAungg avatar TharHtetAungg commented on May 27, 2024

Thank you for your fast response.

I have a problem when I run measure.py, it keeps showing me about .pkl file is not exist. But I just want to use verts.
So I have to provide both PKL file from SMPL and my own data file?

I run the code on Google Colab. If you have google colab, please share it with me.

Error " Path /content/SMPL-Anthropometry/data/SMPL/smpl/SMPL_NEUTRAL.pkl does not exist!"

from smpl-anthropometry.

DavidBoja avatar DavidBoja commented on May 27, 2024

As the README says:

Next, you need to provide the SMPL body models SMPL_{GENDER}.pkl (MALE, FEMALE and NEUTRAL), and put them into the data/SMPL/smpl folder.

Even if you initialize your body model using from_verts, you still need to provide the SMPL body models because the code extracts the joint regressor from the SMPL body model in order to be able to find the joints from the provided vertices. The joints are needed to find some measurements.

This could in theory be avoided -- by rewriting the code and putting the joint regressor in this repository -- but I do not want to do that since I do not own licences to distribute their models. You can download their models from here.

from smpl-anthropometry.

TharHtetAungg avatar TharHtetAungg commented on May 27, 2024

I already check with my verts and it is match with your verts format. But I don't know how to put your code into measurement.py ? Becasue it keep showing me verts is not defined.

smpl_path = "/SMPL-Anthropometry/data/SMPL" 
measurer = MeasureSMPL(smpl_path=smpl_path) 

measurer.from_verts(verts=verts) 

measurement_names = MeasurementDefinitions.possible_measurements 
measurer.measure(measurement_names) 
measurer.label_measurements(STANDARD_LABELS) 

I put it in here but verts are not defined .

image

Could you also please tell me where should I put this in Measuremet.py " load your .obj file with trimesh -- something like verts = trimesh.load(scan_path, process=False).vertices -- and then convert the verts into a torch tensor as noted above torch.from_numpy(fitted_smpl)."

I update the internal code like this but the program is not working.
image

from smpl-anthropometry.

MilesTheProwler avatar MilesTheProwler commented on May 27, 2024

@Daktha123 Did you already solve that? I am still stuck at "measurer.from_verts(verts=verts)". I don't know how to add "verts" to the internal code.

from smpl-anthropometry.

TharHtetAungg avatar TharHtetAungg commented on May 27, 2024

I added these codes in measure.py . The program is working now and it load the verts perfectly. Could you please check it is correct ? Btw how can I show the measurement with 2D image like your show in the measurment_visulization.

scan_path = "/content/SMPL-Anthropometry/data/SMPL/smpl/John_0_smpl.obj" 
verts = trimesh.load(scan_path, process=False).vertices 
verts_tensor = torch.from_numpy(verts) 

verts = verts_tensor.float() 

from measure import MeasureSMPL
    from measurement_definitions import MeasurementDefinitions, STANDARD_LABELS

    smpl_path = "/content/SMPL-Anthropometry/data/SMPL"
    measurer = MeasureSMPL(smpl_path=smpl_path)

    measurer.from_verts(verts=verts_tensor)

from smpl-anthropometry.

DavidBoja avatar DavidBoja commented on May 27, 2024

@Daktha123
Yes, it looks good; you don't need the line verts = verts_tensor.float().

To get the visualizations you can use:

measurer.visualize()

This uses the plotly package and opens a visualization in the browser you can rotate.

from smpl-anthropometry.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.