Forum

Author Topic: Bad allocation error when initializing chunk  (Read 3683 times)

aditya_arch

  • Newbie
  • *
  • Posts: 4
    • View Profile
Bad allocation error when initializing chunk
« on: June 03, 2020, 07:55:13 PM »
Hi I'm getting a "bad allocation" error right at the moment I'm adding pictures to the chunk, system memory does not seem to be an issue:

Agisoft Metashape Professional Version: 1.6.1 build 10009 (64 bit)
Platform: Windows
CPU: AMD Ryzen 9 3900X 12-Core Processor
CPU family: 23 model: 113 signature: 870F10h
RAM: 63.9 GB
200
AddPhotos: layout = MultiplaneLayout
Traceback (most recent call last):
  File "03_BuildOrthoMosaic.py", line 42, in <module>
    chunk.addPhotos(filenames=imagesAll, filegroups=fileGroup, layout=Metashape.MultiplaneLayout)
MemoryError: bad allocation

The filenames and filegroups variables have been initialized according to the new specifications:

-->
        imagesAll=list(zip(images_b1,images_b2,images_b3,images_b4,images_b5))  # Assemble all images
        imagesAll=[list(x) for x in imagesAll]                                  # 'Listify
        imagesAll=[x for sublist in imagesAll for x in sublist]                 # Flatten
        fileGroup=[[x+1]*5 for x in range(len(images_b1))]                      # Create file index
        fileGroup=[x for sublist in fileGroup for x in sublist]                 # Flatten
        print(len(imagesAll))
        chunk.addPhotos(filenames=imagesAll, filegroups=fileGroup, layout=Metashape.MultiplaneLayout)




Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14890
    • View Profile
Re: Bad allocation error when initializing chunk
« Reply #1 on: June 06, 2020, 02:42:53 AM »
Hello aditya_arch,

Are you observing this problem with any number of images per band? Could you please also check that the same happens in the version 1.6.2 or 1.6.3 pre-release?
Best regards,
Alexey Pasumansky,
Agisoft LLC

aditya_arch

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Bad allocation error when initializing chunk
« Reply #2 on: June 08, 2020, 08:01:18 PM »
Updated to v1.6.3 and reduced bands to three (3). Same error.

(base) "C:\Program Files\Agisoft\Metashape Pro\Metashape.exe" -r "03_BuildOrthoMosaic.py"
Agisoft Metashape Professional Version: 1.6.3 build 10711 (64 bit)
Platform: Windows
CPU: AMD Ryzen 9 3900X 12-Core Processor
CPU family: 23 model: 113 signature: 870F10h
RAM: 63.9 GB
120
AddPhotos: layout = MultiplaneLayout
Traceback (most recent call last):
  File "03_BuildOrthoMosaic.py", line 47, in <module>
    chunk.addPhotos(filenames=imagesAll, filegroups=fileGroup, layout=Metashape.MultiplaneLayout)
MemoryError: bad allocation

Can you please look into this, it's holding up a bunch of stuff. Thanks much!

aditya_arch

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Bad allocation error when initializing chunk
« Reply #3 on: June 09, 2020, 08:36:18 PM »
Ran the memory diagnostic tool as suggested by other in the forum. No issues.

aditya_arch

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Bad allocation error when initializing chunk
« Reply #4 on: June 15, 2020, 07:26:30 PM »
Hi Alexey, the problem persists after reducing the bands, installing the new version, and increasing the page size. Could you please look into this?
Thanks much!

Moritzc

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Bad allocation error when initializing chunk
« Reply #5 on: April 28, 2021, 06:24:54 PM »
Dear aditya_arch, dear Alexey,

I am experiencing the same problem. Has there been some solution to the issue?

Thanks a lot for your help!

Cheers,
Moritz

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14890
    • View Profile
Re: Bad allocation error when initializing chunk
« Reply #6 on: April 28, 2021, 08:08:19 PM »
If the problem is reproducible in version 1.7.2, please provide the code used to generate the multiplane layout and the Python output with the error.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Moritzc

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Bad allocation error when initializing chunk
« Reply #7 on: April 30, 2021, 10:30:28 AM »
Dear Alexey,

thanks a lot for your fast reply. Yes, I am working with 1.7.2. I was able to add the photos as described, I probably made some mistake when creating the input for the filenames and/or filegroups. Further, I found chunk.addPhotos() also to work without the filegroups and layout arguments. I am working with images from the DJI P4 Multispectral UAV.

Have a nice weekend,
Moritz

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14890
    • View Profile
Re: Bad allocation error when initializing chunk
« Reply #8 on: May 04, 2021, 02:47:41 PM »
Hello Moritz,

For multispectral DJI imagery it will be sufficient to provide the list of paths and use Metashape.MultiplaneLayout option, as the multicamera systems will be formed automatically based on the image meta data.
Best regards,
Alexey Pasumansky,
Agisoft LLC