<jupyter_start><jupyter_text>We will start by downloading a sample mesh for the geometric texture that we would like to synthesize.<jupyter_code>import constants
from process_data import files_utils

target_path = f'{constants.DATA_ROOT}/cloud.zip'
files_utils.download_file_from_google_drive('1e9vpySX4WUic09JGk7-LV_h8V6H4Nb_I', target_path)
files_utils.decompress_data(target_path)<jupyter_output><empty_output><jupyter_text>Lets have a look on our *reference* texture.<jupyter_code>%matplotlib inline
from process_data import mesh_plotter
import matplotlib.pyplot as plt

mesh_plotter.plot_mesh(f'{constants.RAW_MESHES}/cloud')<jupyter_output><empty_output><jupyter_text>Now, we will create our training data. This will take ~1 hour.<jupyter_code>from custom_types import CUDA, CPU
from process_data.ground_truth_optimization import GroundTruthGenerator
import options

args = options.GtOptions(tag='demo', mesh_name='cloud', template_name='sphere', num_levels=6)
device =  CUDA(0)
gt_gen = GroundTruthGenerator(args, device)
gt_gen.generate_ground_truth_meshes()<jupyter_output>cloud_demo Level: 0: 100%|██████████| 3000/3000 [06:50<00:00,  7.81it/s, e_g=0.155, e_l=-1.09, gravity=0.623, dis_s2t=0.0377, dis_t2s=0.0379, n_s2t=-.0117, n_t2s=-.898]  
cloud_demo Level: 1: 100%|██████████| 3000/3000 [06:49<00:00,  7.48it/s, e_g=0.243, e_l=-1.08, gravity=0.412, dis_s2t=0.0472, dis_t2s=0.0483, n_s2t=0.00366, n_t2s=-.934] 
cloud_demo Level: 2: 100%|██████████| 3000/3000 [07:24<00:00,  6.41it/s, e_g=0.196, e_l=-1.08, gravity=0.322, dis_s2t=0.0584, dis_t2s=0.0586, n_s2t=0.001, n_t2s=-.971]   
cloud_demo Level: 3: 100%|██████████| 3000/3000 [08:04<00:00,  6.44it/s, e_g=0.187, e_l=-1.09, gravity=0.215, dis_s2t=0.0924, dis_t2s=0.0922, n_s2t=-.000803, n_t2s=-.988]
cloud_demo Level: 4: 100%|██████████| 3000/3000 [08:58<00:00,  5.77it/s, e_g=0.181, e_l=-1.09, gravity=0.119, dis_s2t=0.164, dis_t2s=0.164, n_s2t=-.000648, n_t2s=-.993]
cloud_demo Level: 5: 100%|██████████| 3000/3000 [09:49<00:00,  5.21it/s, e_g=0.179, e_l=-1.09, gravity=0.0639, dis_s2t=0.299, dis_t2s=0.298, n_s2t=[...]<jupyter_text>Our *ground truth* training sequence:<jupyter_code>gt_paths = [f'{constants.DATA_ROOT}/cloud/cloud_level{i:02d}.obj' for i in range(6)]
mesh_plotter.plot_mesh(*gt_paths)<jupyter_output><empty_output><jupyter_text>Finally we can train a *deep geometric texture synthesis* model. This will take ~2 hours.<jupyter_code>from training import Trainer

args = options.TrainOption(tag='demo', mesh_name='cloud', template_name='sphere', num_levels=6)
trainer = Trainer(args, device)
trainer.train()<jupyter_output>cloud_demo Level: 0:   0%|          | 0/2000 [00:00<?, ?it/s]<jupyter_text>Now we can use our model to synthesize the geometric texture on other meshes!<jupyter_code>from dgts_base import Mesh2Mesh
from process_data import mesh_utils

m2m = Mesh2Mesh(args, CPU)
mesh = mesh_utils.load_real_mesh('bunny', 0, True)
out = m2m(mesh, 2, 5, 0)
out.plot()
mesh = mesh_utils.load_real_mesh('duck', 0, True)
out = m2m(mesh, 2, 5, 0)
out.plot()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16319218241042346, 'fraction_numerical': 0.11921824104234528, 'mean_word_length': 6.814249363867685, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '150917', 'license': 'MIT', 'n_tokens_mistral': 1563, 'n_tokens_neox': 1326, 'n_words': 244, 'path': 'demo.ipynb', 'repo_name': 'amirhertz/dgst', 'size': '3070'}