Orient-AI

Leyla Khasiyeva
1001Epochs Publications
5 min readSep 27, 2021

Carpet-weaving is one of the most ancient forms of art in many Eastern cultures. Numerous women from many different ethnicities, including Turkic, Central Asian, and Arabian, were engaged in this branch of art and have weaved unprecedented carpets, creating complex designs using traditional ornaments. There are countless carpets that have survived centuries and have reached till our day, preserving and demonstrating the aesthetic of the past. Looking at those carpets as the products of different cultures and traditions, we can notice a lot of similarities along with differences in design and techniques, which also portrays how much in common different cultures from different geographies have.

Photo by Juli Kosolapova on Unsplash

Together with our diverse team, we can unanimously agree that carpets have been preserved and valued well in our modern cultures. However, no matter how exposed we have been to the culture of carpet weaving through the modern and traditional media, very few of us actually take their time and appreciate the beauty and complexity of both the techniques and the design of these massive art pieces. As modern day creators, we decided to take on the challenge, and explore different geometric, floral, and other traditional patterns imprinted on the carpets of various cultures, looking at them from a machine learning perspective. Using a self-trained GANs model and transfer learning, we were able to generate a machine imagined patterns and carpets resembling the existing ones.

Generative Adversarial Networks, GANS, are a machine learning approach for creating new content. They are used to generate data that is similar to the original data. GANs are widely used in fashion, art, advertising, video game production, and science. In these fields, GANs are mostly used to create higher resolution content. For example, GANs can increase the quality of astronomical images. In our project, we used GANs to create original carpet designs. To do that we used the Stylegan2 model, which is a type of GANs that allows us to create higher resolution images.

Firstly, we used web scraping to gather carpet images from the web. To do that we used Selenium and Beautiful Soup libraries of python. As a result, we collected 1500 carpet images from different regions like Turkey, Central Asia, Azerbaijan, and Arab countries. Naturally, web scraped data were each in different sizes, and the GANs model that we used could only work with 1:1 images. Therefore, we resized the images to be 1:1 with 512x512 resolution with the following code:

!python resize_images.py — raw-dir ‘path’ — save-dir ‘path’ — ext jpg — target-size “(512,512)”

After the resizing process, our data was applicable to the model.

The next mission was training the model. GANs consist of two parts which are the generator and the discriminator. By training the model, we taught both the generator and the discriminator what a carpet is. The generator identified the patterns and learned from the data presented, and created new carpet images. Then the discriminator decided whether the newly generated image is a carpet or not. As we train the model more, both the generator and the discriminator improved in identifying carpets and their patterns, giving us better results. We used the following code to train the model and generate images:

! stylegan2_pytorch — data “path” — aug-prob 0.25 — results_dir “path” — models_dir “path”

! stylegan2_pytorch — generate — load-from 149 — results_dir “path”

Lastly, we performed interpolation on the generated images. What interpolation does is choosing two newly generated images and morphing them into each other using their latent codes. The generated file is a video of this shift. We used the following code to perform interpolation:

! stylegan2_pytorch — generate-interpolation — load-from 147 — interpolation-num-steps 100 — save-frames — results_dir “path”

We then began the design phase of the project. Our concept behind this phase was to present the beautiful carpet designs of our AI in a more three-dimensional approach, with movements and abstract illusions in the carpets. When our team faced the design stage, they drew inspiration from the very geometrical patterns perceived in many carpets, from numerous regions — like, Turkey, Azerbaijan, Central Asia, and Arab countries.

Cinema 4D was our go-to program for this creative process. We created several 3D models in the program and reflected our carpet images onto the models. As derived from our geometrical inspiration, we’ve landed on ways to exhibit our AI’s work in similar volumes — combinations of bricks, cubes, hexagons, tiles and pyramids. Also, we played with the carpet images and their mapping on the models to reveal a wider number of perspectives of the carpets. We paired pieces in the models with different types of motions provided in Cinema 4D, such as — collision deformers, linear scaling fields, morphing, delays, cloners, displacers scaling and colliders — to obtain interesting movements and illusions in the design, and also to emphasize on the 3 -dimensionality of the work.

Later in the design stage, we created animation videos and images rendered to our liking. You can see how we connected our initial idea of a geometrical pattern in the final model, and used it to exhibit a slightly different pattern, floral, in this case. We used a morphing technique in another example to exhibit two carpet designs, one after the other.

Such was our part of the design venture in Cinema 4D. The process was hectic, but enjoyable, and we are excited for the future outputs of our team.

--

--