Forum

Author Topic: python CPU usage in Agisoft  (Read 4616 times)

spaceman108

  • Newbie
  • *
  • Posts: 4
    • View Profile
python CPU usage in Agisoft
« on: August 07, 2017, 07:36:24 PM »
Hello. I'm trying to make a 3D DEM matrix in the Agisoft console using this code:

   import PhotoScan

   chunk = PhotoScan.app.document.chunk #active chunk
   camera = chunk.cameras[11]
   calibration = camera.sensor.calibration

   import numpy as np
   import scipy.io as io

   xyz0 = np.zeros((1632,1200,3))

   for i in range(1632):
      for j in range(1200):
         point2D = PhotoScan.Vector([i, j]) # coordinates of the point on photo
         point3Di = chunk.dense_cloud.pickPoint(camera.center, camera.transform.mulp(calibration.unproject(point2D)))
         if point3Di is not None:
                point3Dg = chunk.crs.project(chunk.transform.matrix.mulp(point3Di))
                xyz0[i,j,0] = point3Dg[0]
                xyz0[i,j,1] = point3Dg[1]
                xyz0[i,j,2] = point3Dg[2]

   out={}
   out['xyz']=xyz0   

   io.savemat('xyz_out2',out)

For some reason, if I run this in a saved session, it runs very slowly and Agisoft only uses 0/1 CPUs. However, if I run this in a new/unsaved session after regenerating a Dense Cloud, it runs quickly while using 3 CPUs. Could anyone explain why Agisoft chose to use different numbers of CPU here?

Thank you.

(My system has 32 CPUs with 65 GB memory)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15688
    • View Profile
Re: python CPU usage in Agisoft
« Reply #1 on: August 07, 2017, 07:49:13 PM »
Hello spaceman108,

Can you please check, if the script works fast when the project is saved in PSZ format instead of PSX?

PSX project structure is keeping the data on disk and is accessing most project elements only when they are used. PSZ and unsaved projects are kept in the memory.
Best regards,
Alexey Pasumansky,
Agisoft LLC

spaceman108

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: python CPU usage in Agisoft
« Reply #2 on: August 07, 2017, 08:44:24 PM »
Thanks for the fast reply. The script indeeds runs fast in psz  :)