This tutorial introduces the script to perform style transfer for 3D models (original implementation, see also an article) in Agisoft Metashape Professional on Linux and Windows platforms.
Contents of this article:
Please note that this script is suitable only for Metashape 1.6. The script is available on the following link: https://github.com/agisoft-llc/metashape-scripts/blob/1.6/src/model_style_transfer.py
You need a decent NVidia GPU (TensorFlow is VRAM-hungry) and either Windows 7 or Windows 10 or Ubuntu 16.04 (the instructions are expected to work on other Linux distributives, but they weren't tested).
Lower texture detalization leads to lower VRAM consumption. On GTX 1080 Ti with 11 Gb VRAM, it is possible to process 2048x2048 and even 4096x4096 textures in less than an hour.
The style transfer implementation uses the machine learning library TensorFlow, which requires CUDA and cuDNN. Following instructions will guide you on CUDA, cuDNN, and Python packages installation.
Instructions for Windows 7 and 10Download to This script will add the button with style transfer feature. Alternatively you can add the button manually each time with -> .
Instructions for Ubuntu 16.04Download (you will need to register for NVidia developer program, then choose -> ) Execute in terminal: Execute in terminal: If you encounter you will need to use this workaround and to try again: If you encounter you will need to use this workaround (because of the bug in Python bundled with PhotoScan 1.4): Execute in terminal: This script will add the button with style transfer feature. Alternatively you can add the button manually each time with -> .
How to use the script
1. Launch Metashape Pro.
2. Open the project with the textured model (the algorithm is VRAM-hungry, so the smaller the texture - the better. 2048x2048 is recommended for 8Gb VRAM).
3. Click on Custom menu (in top menu, near Help) > Model style transfer.
4. Specify style image (URL or path to a local file).
5. Click Run (please note that processing can be canceled only with Metashape shutdown).
6. Wait. It can take half an hour on GTX 1080ti for the 2048x2048 texture. Metashape interface will be frozen, but the progress bar will be updated:
7. Check the new model.
8. Save the project and restart the program (this is required because TensorFlow used all VRAM)
If you want to speed up the process you can use 1024x1024 texture and process with:
- steps number=400;
- texture size=1024;
- rendering size=1024.
Discuss the new style transfer script and share your results on our forum!
Monarch butterfly with Munch style transfer by Agisoft on Sketchfab
Super Human with fire style transfer by Agisoft on Sketchfab