Forum

Author Topic: Meshing (buildModel command) from Depth Maps ignores face_count  (Read 3500 times)

octopus

  • Newbie
  • *
  • Posts: 8
    • View Profile
Meshing (buildModel command) from Depth Maps ignores face_count
« on: February 08, 2019, 06:55:43 PM »
Hi.
I am testing a short Python script for the new meshing option that makes the model from Depth Maps
(without building Dense Cloud), and have a problem  with the face_count parameter, which seems to
be ignored as if no decimation happens.
For a project with 285 photos (Metashape 1.5.1), in my Python script, I align photos, and run the following
line with different values for quality and face_count.

    my_chunk.buildModel (face_count=mycount, source=Metashape.DepthMapsData, quality=myquality)

And for the following combinations, I always get a resulting mesh model that has the similar number of faces.

[mycount, myquality ----> number of faces in the mesh result]
1000000, Metashape.LowestQuality  ----> 91.9 million faces
LowFaceCount, Metashape.LowestQuality    ----> 92.1 million faces
MediumFaceCount, Metashape.LowestQuality  ----> 91.8 million faces
MediumFaceCount, Metashape.MediumQuality  ----> 91.9 million faces

The face_count value seems ignored, and also changing the quality does not affect the mesh size.
On top of that, processing with MediumQuality takes naturally more time than LowestQuality, but
the resulting mesh does not seem to be very different, at least visually.

I add that if I use Build Mesh UI command from the Workflow menu instead of using Python script,
I get a reasonable result like below.

1000000, Metashape.LowestQuality  ----> 999,945 faces
LowFaceCount, Metashape.LowestQuality    ----> 19,469 faces
MediumFaceCount, Metashape.LowestQuality  ----> 68,193 faces
MediumFaceCount, Metashape.MediumQuality  ----> 1,073,548 faces

I am wondering why this is happening. I would appreciate if anyone has an advise.
Thank you.

kaz

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Meshing (buildModel command) from Depth Maps ignores face_count
« Reply #1 on: April 17, 2019, 08:35:14 AM »
Hi,

I encountered the same result.
chunk.buildModel in script(~3min) is slower than GUI(1min9sec).
Also, face_count seems not to be used properly.
Computation time: LowFaceCount > MediumFaceCount > HighFaceCount.
I attached screenshots of GUI.
I will appreciate your help.

Additional information:
Ubuntu18.04
Metashape pro(trial)
GPU: GeForce1080Ti
10 images(3024x4032pixels)

Code: [Select]
>>> chunk.buildDepthMaps(quality=Metashape.MediumQuality, filter=Metashape.MildFiltering)
>>> chunk.buildDenseCloud()
>>> print(chunk.dense_cloud)
<DenseCloud '1612181 points'> <- The amount of points is similar as GUI(1623256).

>>> start_time = time.time()
>>> chunk.buildModel(surface=Metashape.Arbitrary, interpolation=Metashape.EnabledInterpolation, face_count=Metashape.FaceCount.LowFaceCount, source=Metashape.DenseCloudData)
BuildModel: source data = Dense cloud, surface type = Arbitrary, face count = Low, interpolation = Enabled, vertex colors = 1
Grid size: 1144 x 612 x 1308
Tree depth: 11
Tree set in 6.78561s (1612153 points)
Leaves/Nodes: 11130834/12720953
Laplacian constraints set in 5.88478s
Depth[0/11]: 1
Evaluated / Got / Solved in: 0 / 0.030369 / 0.0768158
Depth[1/11]: 8
Evaluated / Got / Solved in: 0 / 2.90871e-05 / 0.000530958
Depth[2/11]: 64
Evaluated / Got / Solved in: 0 / 0.000210762 / 0.00101233
Depth[3/11]: 512
Evaluated / Got / Solved in: 0 / 0.0013907 / 0.00366759
Depth[4/11]: 4096
Evaluated / Got / Solved in: 0 / 0.00387549 / 0.0124726
Depth[5/11]: 32768
Evaluated / Got / Solved in: 0 / 0.0701094 / 2.77984
Depth[6/11]: 26992
Evaluated / Got / Solved in: 0 / 0.0104582 / 0.0301316
Depth[7/11]: 93656
Evaluated / Got / Solved in: 0 / 0.111399 / 2.30109
Depth[8/11]: 342224
Evaluated / Got / Solved in: 0 / 0.484556 / 7.34254
Depth[9/11]: 1165992
Evaluated / Got / Solved in: 0 / 0.930498 / 14.05
Depth[10/11]: 3567904
Evaluated / Got / Solved in: 0 / 2.6048 / 42.6426
Depth[11/11]: 7486736
Evaluated / Got / Solved in: 0 / 4.94877 / 72.4493
Linear system solved in 151.357s
Got Iso-value in 0.990996s
Iso-Value -0.415341
3964200 faces extracted in 84.4937s
decimating mesh (3945237 -> 35825)
processing nodes...  done in 0.022816 sec
calculating colors...  done in 0.208744 sec
>>> print(int(time.time()-start_time), 'sec')
264 sec
>>> print(chunk.model)
<Model '35824 faces, 18567 vertices'>

>>> start_time = time.time()
>>> chunk.buildModel(surface=Metashape.Arbitrary, interpolation=Metashape.EnabledInterpolation, face_count=Metashape.FaceCount.MediumFaceCount, source=Metashape.DenseCloudData)
BuildModel: source data = Dense cloud, surface type = Arbitrary, face count = Medium, interpolation = Enabled, vertex colors = 1
Grid size: 1144 x 612 x 1308
Tree depth: 11
Tree set in 6.83281s (1612153 points)
Leaves/Nodes: 11130834/12720953
Laplacian constraints set in 5.73218s
Depth[0/11]: 1
Evaluated / Got / Solved in: 0 / 0.032742 / 0.04515
Depth[1/11]: 8
Evaluated / Got / Solved in: 0 / 2.19345e-05 / 0.000575066
Depth[2/11]: 64
Evaluated / Got / Solved in: 0 / 0.000210047 / 0.00163198
Depth[3/11]: 512
Evaluated / Got / Solved in: 0 / 0.00681806 / 0.00395107
Depth[4/11]: 4096
Evaluated / Got / Solved in: 0 / 0.0469992 / 0.871671
Depth[5/11]: 32768
Evaluated / Got / Solved in: 0 / 0.0666571 / 0.0435393
Depth[6/11]: 26992
Evaluated / Got / Solved in: 0 / 0.0109968 / 0.213359
Depth[7/11]: 93656
Evaluated / Got / Solved in: 0 / 0.0704165 / 1.3744
Depth[8/11]: 342224
Evaluated / Got / Solved in: 0 / 0.27553 / 2.68768
Depth[9/11]: 1165992
Evaluated / Got / Solved in: 0 / 0.856132 / 14.7494
Depth[10/11]: 3567904
Evaluated / Got / Solved in: 0 / 2.73343 / 35.9586
Depth[11/11]: 7486736
Evaluated / Got / Solved in: 0 / 5.14864 / 51.2006
Linear system solved in 116.842s
Got Iso-value in 0.906756s
Iso-Value -0.415338
3964204 faces extracted in 54.9056s
decimating mesh (3945247 -> 107476)
processing nodes...  done in 0.022639 sec
calculating colors...  done in 0.512526 sec
>>> print(int(time.time()-start_time), 'sec')
200 sec
>>> print(chunk.model)
<Model '107475 faces, 54669 vertices'>

>>> start_time = time.time()
>>> chunk.buildModel(surface=Metashape.Arbitrary, interpolation=Metashape.EnabledInterpolation, face_count=Metashape.FaceCount.HighFaceCount, source=Metashape.DenseCloudData)
BuildModel: source data = Dense cloud, surface type = Arbitrary, face count = High, interpolation = Enabled, vertex colors = 1
Grid size: 1144 x 612 x 1308
Tree depth: 11
Tree set in 6.72557s (1612153 points)
Leaves/Nodes: 11130834/12720953
Laplacian constraints set in 5.30451s
Depth[0/11]: 1
Evaluated / Got / Solved in: 0 / 0.0217791 / 0.025856
Depth[1/11]: 8
Evaluated / Got / Solved in: 0 / 2.12193e-05 / 0.000516891
Depth[2/11]: 64
Evaluated / Got / Solved in: 0 / 0.000212193 / 0.00101972
Depth[3/11]: 512
Evaluated / Got / Solved in: 0 / 0.000766039 / 0.00295591
Depth[4/11]: 4096
Evaluated / Got / Solved in: 0 / 0.00368476 / 0.033103
Depth[5/11]: 32768
Evaluated / Got / Solved in: 0 / 0.0562215 / 1.25815
Depth[6/11]: 26992
Evaluated / Got / Solved in: 0 / 0.0289958 / 0.079834
Depth[7/11]: 93656
Evaluated / Got / Solved in: 0 / 0.0720582 / 1.37767
Depth[8/11]: 342224
Evaluated / Got / Solved in: 0 / 0.213139 / 2.5729
Depth[9/11]: 1165992
Evaluated / Got / Solved in: 0 / 0.805761 / 9.47408
Depth[10/11]: 3567904
Evaluated / Got / Solved in: 0 / 2.12819 / 15.3353
Depth[11/11]: 7486736
Evaluated / Got / Solved in: 0 / 4.12108 / 29.3142
Linear system solved in 67.3245s
Got Iso-value in 0.932s
Iso-Value -0.41534
3964200 faces extracted in 45.246s
decimating mesh (3945254 -> 322430)
processing nodes...  done in 0.023334 sec
calculating colors...  done in 1.3526 sec
>>> print(int(time.time()-start_time), 'sec')
140 sec
>>> print(chunk.model)
<Model '322430 faces, 162390 vertices'>

>>> start_time = time.time()
>>> chunk.buildModel(surface=Metashape.Arbitrary, interpolation=Metashape.EnabledInterpolation, face_count=108204, source=Metashape.DenseCloudData)
BuildModel: source data = Dense cloud, surface type = Arbitrary, face count = 108204, interpolation = Enabled, vertex colors = 1
Grid size: 1144 x 612 x 1308
Tree depth: 11
Tree set in 6.79055s (1612153 points)
Leaves/Nodes: 11130834/12720953
Laplacian constraints set in 5.40077s
Depth[0/11]: 1
Evaluated / Got / Solved in: 0 / 0.0289469 / 0.147501
Depth[1/11]: 8
Evaluated / Got / Solved in: 0 / 0.0517442 / 0.656491
Depth[2/11]: 64
Evaluated / Got / Solved in: 0 / 0.000213146 / 0.00120711
Depth[3/11]: 512
Evaluated / Got / Solved in: 0 / 0.000746012 / 0.167142
Depth[4/11]: 4096
Evaluated / Got / Solved in: 0 / 0.0278745 / 0.0296922
Depth[5/11]: 32768
Evaluated / Got / Solved in: 0 / 0.0380363 / 0.177285
Depth[6/11]: 26992
Evaluated / Got / Solved in: 0 / 0.0731647 / 1.32664
Depth[7/11]: 93656
Evaluated / Got / Solved in: 0 / 0.179184 / 2.59301
Depth[8/11]: 342224
Evaluated / Got / Solved in: 0 / 0.271808 / 3.8783
Depth[9/11]: 1165992
Evaluated / Got / Solved in: 0 / 0.698951 / 6.66303
Depth[10/11]: 3567904
Evaluated / Got / Solved in: 0 / 2.34101 / 16.8316
Depth[11/11]: 7486736
Evaluated / Got / Solved in: 0 / 4.87187 / 67.0118
Linear system solved in 108.562s
Got Iso-value in 1.05083s
Iso-Value -0.41534
3964198 faces extracted in 86.3172s
decimating mesh (3945230 -> 108204)
processing nodes...  done in 0.022791 sec
calculating colors...  done in 0.540445 sec
>>> print(int(time.time()-start_time), 'sec')
223 sec
>>> print(chunk.model)
<Model '108204 faces, 55024 vertices'>

Thank you.
Kaz
« Last Edit: April 17, 2019, 11:39:19 AM by kaz »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Meshing (buildModel command) from Depth Maps ignores face_count
« Reply #2 on: April 23, 2019, 04:15:24 PM »
Hello Kaz,

Can you provide the processing log for the GUI run?

Also please specify, if in both cases (GUI and script run) the project hasn't been saved on the disk and no parallel processing operations have been started?
Best regards,
Alexey Pasumansky,
Agisoft LLC

kaz

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Meshing (buildModel command) from Depth Maps ignores face_count
« Reply #3 on: April 24, 2019, 09:24:47 AM »
Hello Alexey,

Thank you for your reply.

I found that the script run is slow because another program is running on my pc.
GUI run also becomes slower, but not so much on the same situation.
It's OK for me. I will make it run with another program stopped.

For your information, I'll show the result of my test below.
Matrix of Linear system solved time
Another program runningAnother program not running
GUI31.39.3
Script116.89.3

Below is the processing log for the GUI run(Face count: Medium).
I was not able to collect all the log because the log(detail) window disappears soon after finishing the run.

GUI run(another program running)
Code: [Select]
Generating mesh...
Grid size: 1144 x 613 x 1309
Tree depth: 11
Tree set in 6.67537s (1611190 points)
Leaves/Nodes: 11146185/12738497
Laplacian constraints set in 5.04359s
Depth[0/11]: 1
Evaluated / Got / Solved in: 0 / 4.1008e-05 / 0.000241041
Depth[1/11]: 8
Evaluated / Got / Solved in: 0 / 0.000136137 / 0.0162973
Depth[2/11]: 64
Evaluated / Got / Solved in: 0 / 0.000425577 / 0.0282946
Depth[3/11]: 512
Evaluated / Got / Solved in: 0 / 0.00115657 / 0.0504436
Depth[4/11]: 4096
Evaluated / Got / Solved in: 0 / 0.00609493 / 0.0967538
Depth[5/11]: 32768
Evaluated / Got / Solved in: 0 / 0.0243101 / 0.0615096
Depth[6/11]: 26944
Evaluated / Got / Solved in: 0 / 0.0161164 / 0.356061
Depth[7/11]: 93072
Evaluated / Got / Solved in: 0 / 0.0573497 / 0.768025
Depth[8/11]: 338032
Evaluated / Got / Solved in: 0 / 0.163049 / 1.33012
Depth[9/11]: 1157888
Evaluated / Got / Solved in: 0 / 0.528278 / 2.38507
Depth[10/11]: 3562072
Evaluated / Got / Solved in: 0 / 1.55798 / 6.93014
Depth[11/11]: 7523040
Evaluated / Got / Solved in: 0 / 3.37348 / 13.1661
Linear system solved in 31.2594s
Got Iso-value in 0.702507s
Iso-Value -0.416019
3961324 faces extracted in 10.3803s
decimating mesh (3942202 -> 107412)
Decimating mesh...

GUI run(another program not running)
Code: [Select]
Generating mesh...
Grid size: 1144 x 613 x 1309
Tree depth: 11
Tree set in 6.1436s (1611190 points)
Leaves/Nodes: 11146185/12738497
Laplacian constraints set in 4.03038s
Depth[0/11]: 1
Evaluated / Got / Solved in: 0 / 0.000176907 / 0.000392914
Depth[1/11]: 8
Evaluated / Got / Solved in: 0 / 6.10352e-05 / 0.0016048
Depth[2/11]: 64
Evaluated / Got / Solved in: 0 / 0.000286102 / 0.00171709
Depth[3/11]: 512
Evaluated / Got / Solved in: 0 / 0.000819206 / 0.00227094
Depth[4/11]: 4096
Evaluated / Got / Solved in: 0 / 0.00358462 / 0.00907898
Depth[5/11]: 32768
Evaluated / Got / Solved in: 0 / 0.0199714 / 0.0198932
Depth[6/11]: 26944
Evaluated / Got / Solved in: 0 / 0.00978589 / 0.0296671
Depth[7/11]: 93072
Evaluated / Got / Solved in: 0 / 0.0306067 / 0.0642502
Depth[8/11]: 338032
Evaluated / Got / Solved in: 0 / 0.102175 / 0.19167
Depth[9/11]: 1157888
Evaluated / Got / Solved in: 0 / 0.325409 / 0.541419
Depth[10/11]: 3562072
Evaluated / Got / Solved in: 0 / 1.00932 / 1.54285
Depth[11/11]: 7523040
Evaluated / Got / Solved in: 0 / 2.12149 / 3.04736
Linear system solved in 9.34541s
Got Iso-value in 0.520899s
Iso-Value -0.416018
3961324 faces extracted in 6.70316s
decimating mesh (3942207 -> 107412)
Decimating mesh...

Script run(another program running)
Code: [Select]
BuildModel: source data = Dense cloud, surface type = Arbitrary, face count = Medium, interpolation = Enabled, vertex colors = 1
Grid size: 1144 x 612 x 1308
Tree depth: 11
Tree set in 6.83281s (1612153 points)
Leaves/Nodes: 11130834/12720953
Laplacian constraints set in 5.73218s
Depth[0/11]: 1
Evaluated / Got / Solved in: 0 / 0.032742 / 0.04515
Depth[1/11]: 8
Evaluated / Got / Solved in: 0 / 2.19345e-05 / 0.000575066
Depth[2/11]: 64
Evaluated / Got / Solved in: 0 / 0.000210047 / 0.00163198
Depth[3/11]: 512
Evaluated / Got / Solved in: 0 / 0.00681806 / 0.00395107
Depth[4/11]: 4096
Evaluated / Got / Solved in: 0 / 0.0469992 / 0.871671
Depth[5/11]: 32768
Evaluated / Got / Solved in: 0 / 0.0666571 / 0.0435393
Depth[6/11]: 26992
Evaluated / Got / Solved in: 0 / 0.0109968 / 0.213359
Depth[7/11]: 93656
Evaluated / Got / Solved in: 0 / 0.0704165 / 1.3744
Depth[8/11]: 342224
Evaluated / Got / Solved in: 0 / 0.27553 / 2.68768
Depth[9/11]: 1165992
Evaluated / Got / Solved in: 0 / 0.856132 / 14.7494
Depth[10/11]: 3567904
Evaluated / Got / Solved in: 0 / 2.73343 / 35.9586
Depth[11/11]: 7486736
Evaluated / Got / Solved in: 0 / 5.14864 / 51.2006
Linear system solved in 116.842s
Got Iso-value in 0.906756s
Iso-Value -0.415338
3964204 faces extracted in 54.9056s
decimating mesh (3945247 -> 107476)
processing nodes...  done in 0.022639 sec
calculating colors...  done in 0.512526 sec

Script run(another program not running)
Code: [Select]
BuildModel: source data = Dense cloud, surface type = Arbitrary, face count = Medium, interpolation = Enabled, vertex colors = 1
Grid size: 1144 x 612 x 1308
Tree depth: 11
Tree set in 6.3877s (1611898 points)
Leaves/Nodes: 11134572/12725225
Laplacian constraints set in 4.05063s
Depth[0/11]: 1
Evaluated / Got / Solved in: 0 / 1.00136e-05 / 1.28746e-05
Depth[1/11]: 8
Evaluated / Got / Solved in: 0 / 1.07288e-05 / 0.000461817
Depth[2/11]: 64
Evaluated / Got / Solved in: 0 / 0.00019908 / 0.000951767
Depth[3/11]: 512
Evaluated / Got / Solved in: 0 / 0.000768661 / 0.00226951
Depth[4/11]: 4096
Evaluated / Got / Solved in: 0 / 0.00354934 / 0.00957847
Depth[5/11]: 32768
Evaluated / Got / Solved in: 0 / 0.021296 / 0.015485
Depth[6/11]: 26960
Evaluated / Got / Solved in: 0 / 0.0111756 / 0.0262113
Depth[7/11]: 93312
Evaluated / Got / Solved in: 0 / 0.0367174 / 0.0594845
Depth[8/11]: 341360
Evaluated / Got / Solved in: 0 / 0.107359 / 0.181702
Depth[9/11]: 1165720
Evaluated / Got / Solved in: 0 / 0.360741 / 0.537394
Depth[10/11]: 3570192
Evaluated / Got / Solved in: 0 / 1.04851 / 1.49357
Depth[11/11]: 7490232
Evaluated / Got / Solved in: 0 / 2.15832 / 2.89125
Linear system solved in 9.25624s
Got Iso-value in 0.512381s
Iso-Value -0.414914
3964762 faces extracted in 6.58261s
decimating mesh (3945846 -> 107459)
processing nodes...  done in 0.021207 sec
calculating colors...  done in 0.448042 sec

In both cases(GUI and script run), the project hasn't been saved on the disk.
The script is like below.
Code: [Select]
chunk = Metashape.Document().addChunk()
chunk.addPhotos(filenames)
chunk.matchPhotos(accuracy=Metashape.MediumAccuracy, generic_preselection=True, reference_preselection=False)
chunk.alignCameras()
chunk.buildDepthMaps(quality=Metashape.MediumQuality, filter=Metashape.MildFiltering)
chunk.buildDenseCloud()
chunk.buildModel(surface=Metashape.Arbitrary, interpolation=Metashape.EnabledInterpolation, face_count=Metashape.FaceCount.MediumFaceCount, source=Metashape.DenseCloudData)

Thanks,
Kaz
« Last Edit: April 24, 2019, 11:19:01 AM by kaz »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Meshing (buildModel command) from Depth Maps ignores face_count
« Reply #4 on: April 24, 2019, 12:58:23 PM »
Hello Kaz,

Does "another process" have the constant CPU load while it is running?
Best regards,
Alexey Pasumansky,
Agisoft LLC

kaz

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Meshing (buildModel command) from Depth Maps ignores face_count
« Reply #5 on: April 25, 2019, 07:54:51 AM »
Hello Alexey,

Yes, "another process" have the constant CPU load.
I attached screenshots of system monitor on GUI and script run.
On GUI run, total cpu load is 60%.
On script run, total cpu load is 100%.

Thanks,
Kaz