Textile industry in Slovenia
The textile industry in Slovenia and wider region was one of the main industry branches which employed thousands of workers. The roots of this successful development are in industrial revolution of the late 19th century, when new factories started to spring up in many cities in Slovenia which was at the time part of old Austro-Hungarian Empire.
After the second world war the new regime started investing even more heavily into the textile industry and Slovenia had one of the most booming growths for several decades. The problem was, with the passing of time, the factories, the machines and working processes were getting more and more obsolete. Modernisation was not the priority and the lack of modern technologies was covered with additional workforce.
This all worked fine in the block-divided world before the fall od the Berlin Wall. Yugoslavia was a socialistic country with 5-year plan-based economy. The market was closed, protectionistic and suited for low added value textiles produced in factories all around the country.
Of course everything came crashing down after tumultuous events of the early 90’s. Independence, the collapse of Yugoslavia and it’s common market has hit the Slovenian textile industry hard. One of the strongest economic branches in former country was completely unprepared for the changing realities. Many big and important factories folded leaving many workers unemployed and textile schools empty. Becoming the member of EU coupled with globalisation made things even worse for textile industry and right now there have remained only a fistful of textile factories in Slovenia.
Tekstina – a success story with a new business model
One of those is a factory called Tekstina. It’s located in a small town called Ajdovščina in the western part od our country. The factory itself has a long and proud history. It was established way back in 1828 and has been growing and expanding it’s business ever since. It weathered the great depression, both world wars, nationalisation and denationalization and it’s still doing great, producing textiles for mainly men’s shirts. But of course, producing just these textiles wouldn’t be enough since production in developing countries is far cheaper.
The one thing which elevates Tekstina above all is the creation of their own shirt designs. The Tekstina designed shirt textiles are sold all over the world. All the important textile trademarks are the clients of Tekstina factory and many also print their own designs at Tekstina. The quality and being in front of the competition is the creed of the Tekstina factory.
In order to stay on the top, the management of Tekstina is trying to employ new technologies and advanced approaches to design and production. Introducing the machine learning and artificial intelligence was a very vital step into optimization of the current business process.
Understanting the business
Usually, when starting with any kind of machine learning project, we try to learn as much about the business and employed processes as possible. The Tekstina project was no exception. First we’ve looked into the design project since one of the requirements for the latter part of the project was also the autonomous shirt pattern design.
The Tekstina designers use a number of mood boards in order for a proper inspiration. Mood board can consist of different pictures, materials, motives and usually follow a trend which defines each collection. The mood board and later inspirational boards are really a very effective initial tool for start with the creative process. The designer will first create the primary design in a special application. After that, several colour variants are produced, so each design has a few variations – it’s interesting for example that brown colour is never a good sell in Australia, but it’s a good bet in Germany. If needed, the shirt pattern is then tiled, so we can get a correct shirt pattern representation. After the pattern is then chosen in the selection process for the collection, the final catalogue is created and is handed to the sales representatives.
The business problem
As in every textile business, Tekstina designers create two collections per year – Spring/Summer and Autumn/Winter Collection.
The design department will create more than 400 design proposals for each collection. Out of those 400, only 150 are then selected for further manufacturing and international sales. The process of selecting these 150 shirt patterns is totally subjective – the management, sales personnel and fashion experts take a look at all proposals and then vote for their selection of proposals. The best rated designs are then chosen for the collection.
Of course, there are many hits and also many misses. Since Tekstina produces mostly textiles for men, most of sold designs are in blue colour – these are the designs which do not really need machine learning for helping with the decision making – the goal would be to decrease the number of misses. In view of this problem, we were asked three questions at our initial meeting:
- Can AI help us with the selection process?
- Can we predict the sales of the patterns?
- Can we use the AI for creating new patters?
Every machine learning model, regardless how “intelligent” it is, will need one and the most basic thing – quality data which will ensure that we get good and usable results in our working process. And the Tekstina data was a huge challenge indeed! Well, at least part of it …
There were two major groups of data – the financial data from the past which is stored in the ERP and is not really problematic itself, AND the images of designs. Now those images are actually the heart of our project and at the beginning, the were A MESS!!!
First we had to map every image with the financial data in the ERP. Now, Tekstina has a very unique convention for naming those designs, but we discovered huge inconsistencies in the file system and there was no way for us to automatically pair the designs with the data from the ERP. So it took us a lot of time to painstakingly go through more than 3000 design pattern tips and search for the exact pictures in the ERP and pair them up.
The third group of data was soft information from the sales personnel. This knowledge is not written anywhere, but if we want to design a reliable sales prediction model, we need to capture as many of this information as possible. We conducted several interviews with the main sales staff and these user stories really gave us additional insight into the business and together we designed the business rules for sharpening the prediction parameters of the model.
Preparing the Data
Usually when we’re preparing the analytical dataset, we join the data into one huge not-normalized data table. This table can consist of hundreds of attributes and additional derived variables for better results at the end. With structured data, joining and merging data does not hide any secrets from a competent data scientist, but predicting if a certain design pattern will be sold well or not is something completely different.
In order to get the usable data for successful modelling we had to transform the pictures (design patterns) into numerical data. The method to achieve that is vectorisation – we had to transform the picture into a vector representation. Such vector representation of the image consists of hundreds of attributes which describe image features and we can compare the images by comparing these attributes.
The algorithm to transform the image into vector representation is almost always a neural network. We chose the Convolutional Neural Network (CNN) which are frequently used in the image and video recognition. The name “convolutional neural network” indicates that the network employs a mathematical operation called convolution. Convolution is a specialized kind of linear operation. Convolutional networks are simply neural networks that use convolution in place of general matrix multiplication in at least one of their layers.
Creating and training a neural network from scratch is a long and demanding process. If we want the neural network to recognize images, we usually need more than million images for satisfactory results. Our projects had only little more than 3000 images available, so we had to find another solution.
Luckily there are many free already pre-trained neural networks available. After a short search and testing we decided to use the ResNet-18 pretrained network which is very popular at image recognition. Before we fed the image patterns for vector representation, we had to resize the shirt pattern images, so all of them were the same size. Every neural network is trained for certain image dimensions and because of that we had to resize the images to the same size, but we sill needed to maintain the shirt pattern at exactly the size it’s printed on the shirt.
The second pre-process is called normalization which is a process that changes the range of pixel intensity values, so all the images are equally represented in the neural network.
After this pre-process, images are fed into the neural network, where features are detected and the final result is the aforementioned vector representation.
After that, we combine the vector representations with the historical sales data and in another (this time our own) neural network we compare the attributes of our bestselling designs with the shirt pattern design for which we want to know if it’s going to be sold on the market or not. And that is the exact result of the model – we decided it’d be the classification problem at the end – “YES” if the probability of successful sale is above the threshold or “NO” if the probability is below it.
The problem of showing the results
With a successfully implemented model, which after testing on the data from previous collections, gave us satisfactory results, we had to switch our attention to the deployment. In real life, you can make the model as good as possible, but it’s not going to be usable if you’re not able to properly show and interpret the model results.
In order to satisfy our customer, we’ve made a special web portal where users can check the sales data of the previous shirt designs from past collections or they can check how the designs of the newest collection are scored. The designs are ranked from the best to the worst and this is an orientation for decision makers when they are selecting the new design patterns for the collection.
Of course this simple ranking system is not suitable for experts who need additional information while deciding which designs to include into the collection and which are going to be rejected. Our customers wanted to compare all design patterns form the database.
The result of this demand is a graph which resembles more to something from the Hubble telescope – every dot represents a single design and these designs are distributed according to similarity. Every dot is coloured due to the sales numbers – from red hot best seller to the cold blue reject.
If our design lies in the vicinity of many other red dots, this itself is a good sign for the future sales – after all, even though we are bombarded daily by new trends, people, especially men, buying clothes, are creatures of habits and they keep buying clothes (shirts) with similar features.
Autonomous design process
The autonomous design is the second major request from Tekstina. Since we’re having plenty of historic graphic designs, the logical conclusion was to use style transfer method. It uses two pictures – first is used for content or a template and the second serves as the style. The neural network extracts the features from different layers of neural network and this same network creates new image by detecting common features from both images on every level. The final result is a new design which combines the feature from both images.
Our portal suggests five variants, from light transfer to the most radical one. The proposed new designs are mostly unusable, but since we can permutate 3000 available designs, there is a fairly good possibility to get at least several very good AI generated designs.
Of course creating new designs by hand is only for demonstration purposes. In order to make this process work, we had to write a special background service, which works 24/7 on new designs. The service randomly uploads one pattern design for a template and another one for the style. The AI model creates five proposals and every proposal is graded by our model for sales prediction. If the score is above the threshold, the design goes into the daily queue. If it’s scored below the threshold, it’s rejected.
At the end od the day, the service compares the scores from all the new designs and picks the daily winner. These daily winners are again lined up at the end of the month and the design with the best grade will the go into the selection process. If we consider, that it takes about half a year to prepare one collection, the selection process will include six artificially designed shirt pattern designs. If those designs come with a better score than some of the traditionally created shirt design patterns, there is a good possibility we are going to wear AI designed shirts in a very near future.