nywang16 / Pixel2Mesh

Pixel2Mesh: Generating 3D Mesh Models from Single RGB Images. In ECCV2018.
http://openaccess.thecvf.com/content_ECCV_2018/papers/Nanyang_Wang_Pixel2Mesh_Generating_3D_ECCV_2018_paper.pdf
Apache License 2.0
1.64k stars 293 forks source link

About the train .dat file #67

Open Lordores opened 4 years ago

Lordores commented 4 years ago

I can't read .dat file I downloaded,either with encode ‘UTF-8’ or ‘gbk’.

Here I use generate_data.py generate .xyz file,but how can I get .dat file? Just change .xyz formet to .dat ???

walsvid commented 4 years ago

I think the problem may be related to wrong encoding format. Please load .dat files using pickle.

If you are using python3 to read .dat file, you can add encoding args when load pickle files.

f = pickle.load(open("xxx.dat", 'rb') , encoding="bytes") 

As for generate .dat file please check our recently updated code https://github.com/nywang16/Pixel2Mesh/blob/master/GenerateData/4_make_auxiliary_dat_file.ipynb for more details.

I will temporarily close this issue. If you require any further information, feel free to repoen it.

Lordores commented 4 years ago

Hello, I want to ask some questions about 4_make_auxiliary_dat_file.ipynb

I can get .xyz files from generate_data.py or 3_camera_transform.py with .obj file and its multi-view image.

How to use these .xyz files in 4_make_auxiliary_dat_file.ipynb ? And I also confuse about generate_data.py and 1_sample_points.txt,2_generate_normal.py,3_camera_transform.py , which is really used?

walsvid commented 4 years ago

All those files are used during data preparation, the number indicate the order of steps.

We first (1) sample the points, then (2) calculate the normal, then (3) perform a coordinate transformation on the point cloud with the normal, and then (4) generate auxiliary data. Finally, generate a dat file using generate_data.py.

Lordores commented 4 years ago

But I find generate_data.py do # 1 sampling # 2 tranform to camera view #### project for sure and only save a .xyz file for each view; So the xyz file is the dat file you said inFinally, generate a dat file using generate_data.py.?

And the work in generate_data.py is same like first (1) sample the points, then (2) calculate the normal, then (3) perform a coordinate transformation on the point cloud with the normal

(4) generate auxiliary data is just for ellipsoid or each model in ShapeNet data?

walsvid commented 4 years ago
<1> Yes, `.dat` files dump using pickle from `.xyz` files generated by `generate_data.py`. You can read in the `.dat` file and using pickle to load it, you will find that it is just a binary wrapper for `xyz` and corresponding image. <2> `generate auxiliary data` is just for ellipsoid.
KnightOfTheMoonlight commented 4 years ago

@walsvid About the original data from shapenetcore.v1, are they all resized to be put in a unit cube, which are of size (-0.5,0.5)^3? And why would you choose ellipsoid with a size of (0.2,0.2,0.4) radius?

And you use your rendering_metacamera.txt annotations to transform 3d object to camera coordinates?

Michaelwjh commented 1 year ago

But I find generate_data.py do # 1 sampling # 2 tranform to camera view #### project for sure and only save a .xyz file for each view; So the xyz file is the dat file you said inFinally, generate a dat file using generate_data.py.?

And the work in generate_data.py is same like first (1) sample the points, then (2) calculate the normal, then (3) perform a coordinate transformation on the point cloud with the normal

(4) generate auxiliary data is just for ellipsoid or each model in ShapeNet data? Do you know the difference between the generate_data.py and ( 1_sample_points.txt, 2_generate_normal.py, 3_camera_transform.py ), both of them can generate .xyz file, but their sizes are different