Recommending fashion-based products based on Instagram public data!
As you all know , Instagram have already marked 1 billion active users following YouTube and Facebook. Teenagers have slowly moved into a picture-media platform like Snapchat and Instagram. Making use of these platforms, people and businesses all around the world can predict a lot of trends in and around the world.
Fashion is always a complex business industry and implementing data science and analysis on this industry is always a challenging task. Almost all companies like Amazon , Flipkart and Myntra have been working on this for a long time wherein ‘Recommendations’ is one key concept that every industry is trying to get personalised view for users. There are a lot of things happening beyond recommendations but we would focus on how public data from online social media is helping the fashion industry.
Fashion industry will usually have a lot of data about the user and products but they will still combat against them because of missing and poor data-set. This could be because of number of reasons like , ‘users details and number is more but the history of them is too low to predict anything’ or ‘users might get different range or type of product unrelated to each other, making suggestions harder / irrelevant’ or ‘users get random products as an effect of campaign or offers’. Keeping this stake ,the key to solve all problems and challenges pertaining to this is ‘Fashion’ itself. The product ‘Styles’ and ‘Season’ are the key factors which changes very frequently and it becomes very important to identify what ‘Trend’ is going on and what period of time it is. Both of them keeps changing in a cycle of 6 months and they are rapidly evolving from a year to another.
Social media is the base for finding both season and trends. Hashtag powers a great insight to how the world is changing and how fashion is evolving around the world. Instagram being a picture-platform it enables us to grab visual insight directly having a view on the product and the kind of clothes people and famous celebrities wear.
Scraping Instagram:
Yes as most of you have thought about. Boom ! Web Scraping it is. But wait the interesting part is about what do you do with the data which is more interesting . Let me first give a basic insight on scrapping . Yes! We have our two hands — Selenium and Beautiful Soup which made web scraping like making a sandwich.
The whole of the scraping is done through selenium. Selenium creates robust, browser-based regression automation suites and tests. It can be used to grab a particular section of a java-script or perform a tag directly.
Initially we will give the instagram link .( It can be link of a hashtag search or a profile. Eg: https://www.instagram.com/explore/tags/fashion/ this is a page searching ‘fashion’ hashtag )
So the code goes to his page, auto scrolls down and gets all the links of the pictures and stores it.
We then get the ‘shortcodes’ of every picture and iterate through the links to get the likers of every post or you can download the images (using requests and downloading from the link). The basic code to start scraping using selenium is here. It is very simple to understand. Have a look.
Another such library which is really great is “Instaloader” which is able to download images and videos + captions. It could even update on new posts of the users and fetch only that data.
Link: https://github.com/instaloader/instaloader
Git link for scrapping basics: https://github.com/Vickyilango/ScrappingInstagram
TRACE THE TRENDS OUT!
Auto-catalogue is the key. Auto-catalogue is something i build which will get you the color, pattern, collar, sleeve and occasion details given a product. It is an ML package which is trained on a really large number of dynamic fashion products using neural networks.
Simple working steps of Auto-catalogue package:
- First we will get an image through the scrapping process.
- We will get a mask of the image by which we will get only the person eliminating the background.
- Now we will segment the person getting hands, face, type of upper cloth (shirt/ T-shirt/ blazer/tops ), trousers/pants, shoes, hats and belts.
- Now i have a trained model which will predict each of it and gets the features out of any image.
- Now you have all the features of every image and you have dates ,time and details from scrapping the contents as well.
I would write a separate article explaining in detail about it in the upcoming article. But the above mentioned is the key idea. Now you have a powerful data-set of users — to — patterns data frame.
I am giving the link to code here. You can download it and explore it right away if you want to start it or you can wait for the next article describing the flow and process of Auto-catalogue.
Now with these data, you can play with the data finding the trend by predicting what type of clothes were worn and you can take season ( defining by date- based on your country ) and get the details of what product types you should recommend or promote based on time and season .This would really help in recommending the correct product type and the new trend that every user needs. We had used it in a unique way for recommendations by using Auto-encoders, which I will be publishing soon. This article is to emphasise the key factor ‘Trends’ which is to be considered in recommendation program.
Hope you grasped the key idea. It would be really great if you can give credits when you reuse the codes. And let us use the codes for positive purpose only.
Regards,
Vigneshwar Ilango