Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: Emanuele1234 on July 14, 2022, 02:46:12 PM

Title: Speed up metashape process - multiprocessing or other multicore/thread methods
Post by: Emanuele1234 on July 14, 2022, 02:46:12 PM
Dear everyone,

I have a little question about how Python and Metashape works.
I have a problem, because I have to speed up a script which extract coordinates for any selected point in Metashape, but it needs like 27 days to run across 1 milion points.
For this reason I was wondering if you know a way to multiprocess everything and speed up a little the process.
I have already splitted  my dataframe in several parts, to call it in different functions, and I tried with asyncio to see if the process was speeding up a little but nothing. So I was wandering if multiprocessing package was a good solution. Unfortunately until now it gives me always an error:

Traceback (most recent call last):
  File "C:/Users/eepi0002/PycharmProjects/train/Proiection_asyncio.py", line 207, in <module>
    tree_array1.start()
  File "C:\Users\eepi0002\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
  File "C:\Users\eepi0002\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\Users\eepi0002\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 326, in _Popen
    return Popen(process_obj)
  File "C:\Users\eepi0002\AppData\Local\Programs\Python\Python38\lib\multiprocessing\popen_spawn_win32.py", line 93, in __init__
    reduction.dump(process_obj, to_child)
  File "C:\Users\eepi0002\AppData\Local\Programs\Python\Python38\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle 'Metashape.Metashape.Camera' object

Do you have any Idea?
Thank you in advance.
Best regards.
Emanuele Papucci.
Title: Re: Speed up metashape process - multiprocessing or other multicore/thread methods
Post by: smiller on April 19, 2023, 09:55:22 AM
Did you figure out this issue and how to fix it?
Title: Re: Speed up metashape process - multiprocessing or other multicore/thread methods
Post by: tazzo on April 19, 2023, 11:31:27 AM
Maybe is better to export the mesh / point cloud and write a GPU accelerated software if you really need performance.