Original size 1140x1600

Training a generative neural network in the style of Gothic stained glass

PROTECT STATUS: not protected
Longread translated automatically

Project Idea

The project focuses on training the Stable Diffusion neural network model in the style of medieval Gothic stained glass windows, characteristic of 12th–13th century French cathedrals. The most prominent examples of this art are preserved in Notre-Dame Cathedral. The distinctive features of this style include minimalism, a limited color palette dominated by cobalt blue, and clear, high-contrast graphic quality.

big
Original size 1024x680

Fragment 121, Rose, Notre Dame Cathedral

big
Original size 3195x678

Notre Dame de Paris

Stained glass windows are composed of numerous individual glass fragments assembled into a unified biblical narrative or parable. To train the model, a database was prepared consisting not of complete stained glass panels, but of small, circular fragments from them, which will allow for more detailed and accurate image generation.

big
Original size 2111x1024

Fragments of stained glass

Original size 2111x1024

Fragments of stained glass panels

Model training process

Approximately 150 stained glass fragments were selected to train the generative neural network, and then cropped to a 1:1 ratio.

Original size 2089x1028
Original size 2436x361

Google Colab Code Snippet

Original size 2438x400

Google Colab code snippet

Original size 2435x625

Google Colab Code Snippet

The first stage included: checking the GPU, installing dependencies, creating a local directory, and uploading images to Google Colab.

Original size 2435x678

Google Colab Code Snippet

Original size 2436x916

Google Colab Code Snippet

Then, the BLIP model generated image descriptions, to which a prefix was added to stylize them like a medieval stained-glass window. This combined textual data served as the foundation for training the subsequent model.

Original size 2434x622

Google Colab Code Snippet

Original size 2432x618

Google Colab Code Snippet

Following this, the model training process was initiated using the LoRA method, which took approximately two hours with the specified settings.

Original size 2423x247

Google Colab Code Snippet

Original size 2437x847

Google Colab code snippet

Original size 2433x560

Google Colab Code Snippet

Upon completion of the training, the model is saved, uploaded to the Hugging Face Hub platform, and becomes available for use. From there, you can begin creating images.

Image Series

Based on the initial generation tests, I have noticed that the neural network effectively captures the form and overall style, but the image quality deteriorates significantly due to the excessive mosaic fragments and chips rendered by the generation.

Original size 3195x1024

In the next generation, the checkpoint strength was decreased to -250, which helped produce cleaner images.

Original size 2111x1024
Original size 2111x1024
Training a generative neural network in the style of Gothic stained glass
Project created at 10.04.2025
We use cookies to improve the operation of the HSE website and to enhance its usability. More detailed information on the use of cookies can be fou...
Show more