Forum

Author Topic: headless scripting has longer processing time compared with GUI  (Read 2032 times)

jgillan

  • Newbie
  • *
  • Posts: 12
    • View Profile
headless scripting has longer processing time compared with GUI
« on: September 13, 2019, 02:03:05 AM »
Hi All,
I developed a python script (in headless mode) to process all my imagery. The idea being that I could run many projects back-to-back without having to manually start a new one each time the previous finished. It is successful, but the time it takes to generate the dense point clouds is much, much longer using the python script compared with opening the GUI and pressing the buttons. Why is this happening? Is there a way around this problem?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: headless scripting has longer processing time compared with GUI
« Reply #1 on: September 13, 2019, 03:01:50 PM »
Hello jgillian,

At which steps you are observing the biggest difference in the processing time?

Are the same processing parameters used in both approaches, including the fine level task subdivision?
Best regards,
Alexey Pasumansky,
Agisoft LLC

jgillan

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: headless scripting has longer processing time compared with GUI
« Reply #2 on: September 13, 2019, 06:10:49 PM »
Thank you for the response Alexey,

The time difference between GUI and headless python is in the depth filtering step. For example, for a chunk with 474 images, the GUI took about 7 hours to generate the dense cloud, while the headless python took about 18 hours.

Yes, I believe the processing parameters are all the same.  High density, mild filtering.

Here is the python code:
##Build dense point cloud
chunk.buildDepthMaps(quality=Metashape.HighQuality, filter=Metashape.MildFiltering)
chunk.buildDenseCloud()

I notice in the 'Preferences' menu in the GUI, I have 'fine-level task subdivision' checked. Is this something I need to specify in the python code?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: headless scripting has longer processing time compared with GUI
« Reply #3 on: September 14, 2019, 03:19:12 PM »
Hello jgillan,

By default processing methods in Python are not using fine-level task subdivision. To enable it you should run the processing via Tasks class, for example:

Code: [Select]
task = Metashape.Tasks.BuildDenseCloud()
task.network_distribute = True
task.apply(chunk)
Best regards,
Alexey Pasumansky,
Agisoft LLC

jgillan

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: headless scripting has longer processing time compared with GUI
« Reply #4 on: September 17, 2019, 04:11:39 AM »
Thank you Alexey, that code worked nicely.