📜 ⬆️ ⬇️

How to choose a dress using the main component method

So, who does not mind if the program, the machine, the neural network picked up his clothes?

Any set of images can be analyzed using the principal component method . This method is already quite successfully used in face recognition. We will try to use it on the example of women's dresses.

image

')
Baseline: 807 photos of dresses from Amazon. All images have the same size, but the postures of the models are different (although they, as a rule, have a similar arrangement in the frame). Ideally, the main components should be determined directly by the style of the dress. In our case, many of them will be associated with the pose of the model. Despite this, much more can be done with the data set.

imageimage

The dress itself is the first major component that determines the greatest difference. In general, the differences between light and dark dresses are tracked.

imageimage

The second component compares short and long dresses.

imageimage

Reddish and bluish shades.

imageimage

Models with short hair and sleeveless dresses and long hair with long sleeves.

imageimage

Models with legs together and apart, and so on.

Using components to recreate an image


Having a set of similar components it is possible to reduce the image, for example, from 60,000 data points (pixel values) to just a few points.

Let's try to recreate this dress from the components.

image

The following images are recreated dress, respectively, from one, two, four, nine, ten, fifteen, thirty, forty and seventy components.

imageimageimage
imageimageimage
imageimageimage

As you can see, the more components are used, the more accurate and detailed is the recreated dress.

The data required to obtain the image of the dress of 10 components now look as follows: [-17541.81, -12749.33, -3766.29, 2005.28, 4193.08, 6832.55, -6704.90, -2135 , 51, 1112.27, 7627.80].

So, if you need to store a million photos, you can save a lot of disk space by storing only the values ​​of the components instead of the values ​​of all the pixels for each dress.

The method works even for dresses that are not included in the training sample:

imageimage

imageimage

Although the result is not so good in the case of combinations that have not been encountered in training:

imageimage

Also, it will not be possible to recreate accessories that were not in the training set (note that the glasses and the handbag have disappeared):

imageimage

And although there were only dresses in the training set, there is enough data to recreate various types of clothing, such as suits and overalls:

imageimage

imageimage

Using components to predict


I also manually grouped photos of dresses for those that I liked (287) and did not like (520 photos).

Now, using the logistic regression in relation to the data components can predict whether I like the dress or not.

Having sorted out the dresses according to the received estimate, we can see the most beautiful and the ugliest dresses from the whole sample.

The most beautiful dresses:

imageimageimage

And the ugliest ones:

imageimageimage

Pretty accurate. After that, you can come up with something that tracks new dresses posted on Amazon and sends me a catalog of suitable dresses for me.

It is interesting to look at cases of incorrect definition. Below are three “the ugliest beautiful dresses” that I defined as “in my style”, but the program decided that I would not like them at all:

imageimageimage

Perhaps this is a specific shade of blue.

But "the most beautiful ugly dresses", which I attributed to nondescript, and the program predicted the opposite:

imageimageimage

Well, they are not so bad. I basically like them, but I think they would look better if you change them a bit (make them less tight, remove the too-colorful pattern, choose a brighter shade).

Creating new dresses


When creating images, it is not necessary to limit yourself to already known combinations of components of dresses. You can simply use random values ​​for each component and see what happens!

imageimageimage
imageimageimage
imageimageimage
imageimageimage

This is a brand new dress, invented by the program! With a large amount and good quality data, this may be a promising tool for creating new styles of dresses! The code can be downloaded here .

So, cars already draw pictures, write music and define our style, what's next?

Abstract


  1. Any set of images can be analyzed using the principal component method .
  2. Initial sample: 807 photos of dresses from Amazon.
  3. The dress is the main component, other components: the length and shade of the dress, the length of the sleeve and the hair of the model, the pose of the model and others.
  4. Components can be used to reduce the size of the stored photos, predict and even come up with new styles.

Source: https://habr.com/ru/post/265089/


All Articles