Also posted here:
https://github.com/agisoft-llc/metashape-scripts/issues/119Hi there,
I'm working on generating a very large tiled model composed of thousands of images. To manage this, I'm following the logic used in the
split_in_chunks_dialog.py
script, with an additional step to divide the tiled model generation as well. This is necessary because attempting to build a tiled model from a single, large merged model consistently results in a "bad allocation" error due to insufficient memory.
To handle this, I’m building one tiled model per chunk. I use the operand_chunk to merge previously built valid tiled models into the current one.
This approach generally works, but occasionally I encounter the error:
"Can't uncompress tile", and the older tiled models fail to merge into the current one, even though they were built successfully. It doesn't appear to be a performance issue, and I'm unsure what’s causing the failure.
Below is the relevant portion of the code that's failing:
if operand_chunk.tiled_model: # If the previous chunk has a tiled model to merge
new_chunk.buildTiledModel(
tile_size=256,
pixel_size=GSD,
source_data=Metashape.DataSource.ModelData,
face_count=20000,
transfer_texture=True,
ghosting_filter=False,
merge=True,
operand_chunk=operand_chunk.key,
progress=progress_print)
else: # This is the first tiled model to be created
new_chunk.buildTiledModel(
tile_size=256,
pixel_size=GSD,
source_data=Metashape.DataSource.ModelData,
face_count=20000,
transfer_texture=True,
ghosting_filter=False,
progress=progress_print)
if new_chunk.tiled_model: # Check if the tiled model was created successfully
valid_index = index # Update the valid index to the latest chunk with a tiled model
operand_chunk = doc.chunks[valid_index] # Update the operand_chunk
Note: GSD is calculated earlier and is approximately 0.03.
Do you have any insights into what might be causing the "Can't uncompress tile" error? I am sure it get's the right
operand_chunk.key
.
a partial log showing the error for reference is attached.
Environment:
- Metashape Python SDK: 2.2.0
- CPU: Intel® Core™ i9-14900
- GPU: NVIDIA GeForce RTX 4070 (not overclocked)
- RAM: 32 GB
- OS: Windows 11 (23H2)
Thanks in advance for your help!