-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce computation time of Tilers when adding textures #42
Comments
This PR reduces the computation time of textured 3DTiles by querying the images only once per tile. We used to query the images for each surface. |
Python standard module cProfile allows to profile Python code. In codeImport modules: import cProfile
import pstats Profile the code between cp = cProfile.Profile()
cp.enable() # Start profiling
# code here
cp.disable() # Stop profiling
p = pstats.Stats(cp)
p.sort_stats('tottime').print_stats() # Sort stats by time and print them In command linecProfile can be run in the shell with: python -m cProfile script.py Results with CityTilerCommand (cProfile used directly in code): citygml-tiler --db_config_path py3dtilers/CityTiler/CityTilerDBConfig.yml --type water --with_texture > log.txt 10 first lines of stats:
When adding textures to 3DTiles, most of time is taken by Pillow encoding/decoding |
According to this Pillow's issue, changing the compression level when saving images allows to reduce computation time. atlasImg.save(Texture.folder + '/tiles/ATLAS_' + str(tile_number) + '.png', compress_level=3)
|
Is it a lossy or a lossless compression ? Maybe it could be a parameter offered by py3dtiles with a default value ? |
Pillow uses the lossless data compression library zlib to compress images |
Pillow image compression will be handled with the compression issue. Closing |
Adding textures to the 3DTiles with CityTiler multiply the computation by x50.
The text was updated successfully, but these errors were encountered: