<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hila Ren on Medium]]></title>
        <description><![CDATA[Stories by Hila Ren on Medium]]></description>
        <link>https://medium.com/@rn.rwfx?source=rss-1173e1a804f3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pd3rcJI4rvWV6EeaOJrRaQ.png</url>
            <title>Stories by Hila Ren on Medium</title>
            <link>https://medium.com/@rn.rwfx?source=rss-1173e1a804f3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 23:44:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rn.rwfx/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Can fastai vision model be used to predict the popularity of your Instagram posts?]]></title>
            <link>https://medium.com/unpackai/can-fastai-vision-model-be-used-to-predict-the-popularity-of-your-instagram-posts-d439853a6a9a?source=rss-1173e1a804f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/d439853a6a9a</guid>
            <category><![CDATA[instagram]]></category>
            <category><![CDATA[fastai]]></category>
            <category><![CDATA[unpackai]]></category>
            <category><![CDATA[engagement]]></category>
            <dc:creator><![CDATA[Hila Ren]]></dc:creator>
            <pubDate>Thu, 05 Aug 2021 07:41:23 GMT</pubDate>
            <atom:updated>2021-08-05T07:41:23.722Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*s27iu34cxwTRrl1FJl9GLQ.jpeg" /></figure><h3>Motivation</h3><p>Over the past decade, social media has become a most important marketing strategy, no matter you own a small local shop or a big international company, it offers great opportunities for business growth, branding awareness, and customer relationship building.</p><p>I’ve been working in the online ads industry for a few years. Working as a consultant, I help thousands of marketers to analyze the campaigns’ performance, the creatives’ popularity, and so forth. Based on my experience, generating the most attractive creatives has always been the biggest challenge for most marketers, generally, it takes at least a week for marketers to tell the performance of a newly launched post until a clear insight is available.</p><p>In this situation, a predictive tool that can predict the post engagement rates before it’s being launched would be budget-saving and efficient.</p><p>During unpack AI Bootcamp 101, I’ve learned fastai vision model which seems could be an appropriate approach to solve the issue above.</p><p>In this article, I chose Sezane posts from Instagram to validate my machine learning model. I will show you:</p><ol><li>The approach I attempted to predict the popularity of an Instagram image using fastai Vision Model;</li><li>Results of the model, actually I failed.</li><li>Conclusions and learnings.</li></ol><h3>Popularity Prediction Model</h3><p><strong>Step1: Building the dataset.</strong></p><p>The biggest challenge associated with this project is data collecting. Instagram provides 2 APIs for data exporting:</p><blockquote><a href="https://developers.facebook.com/docs/instagram-basic-display-api">Instagram Basic Display API</a> allows users of your app to get basic profile information, photos, and videos in their Instagram accounts.</blockquote><blockquote><a href="https://developers.facebook.com/docs/instagram-api/">Instagram Graph API</a> allows Instagram Professionals — Businesses and Creators — to use the app to manage their presence on Instagram.</blockquote><p>Apparently, none of the above is available to the public domain, thus couldn’t be used for this project, I also tried some other approaches to crawl the data while failed.</p><p>Eventually, I decided to download photos along with the <strong>number of Likes</strong> and the <strong>number of Comments</strong> manually. It took me around 7 hours totally to collect around 500 images from the <a href="https://www.instagram.com/sezane/">Sezane</a> account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*H13Gk8yzZbVgp8tdfyHrxQ.png" /><figcaption>Screenshot from Sezane Instagram</figcaption></figure><p><strong>Step2: Analyzing and cleaning the dataset</strong></p><p>Cleaning the dataset is also a challenging step.</p><p>With Instagram ads, the advertisers can advertise a specific image or video which can drive more engagement accordingly. By checking the number of Likes and Comments of hundreds of images under the Sezane account, I found that the ratio of Likes-Comments for non-advertised images is likely between 0.5% and 2%, also the number of Likes more than 16,000 are likely to be an advertised post.</p><p>Below is calculated with the original, uncleaned dataset, we can see a high standard deviation from the table, the mean is 10,594 (take numberLikes as an example) while 60% of the images have less than the mean number. Apparently, the issue was caused by advertised images, the following graph also confirms the values shown on the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*KOyCwqq9hoz5FUVSGkk2FA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*vjpiJiM2nzlu0Md5sa0J9g.png" /></figure><p>I did the following actions to remove the advertised images:</p><ol><li>Only keep the images with a Comment-Like ratio between 0.5% and 2%.</li><li>Remove the images with the number of Likes over 16,000.</li></ol><p>After filtering, the standard deviation went down as below.</p><ol><li>numberLikes: 6085 → 2897;</li><li>numberComments: 98 → 44;</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*x3BvhRTsW1YUJq6DohTnRg.png" /></figure><p><strong>Dataset and Segmentations</strong>: (Total = NumberLikes+NumberComments)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*9nE-rSnZjn0r63J5DzuFIg.png" /></figure><p>The dataset was roughly segmented into 3 classes:</p><ol><li>Low Engagement (107 images): Total &lt; 7,000</li><li>Neutral (142 images) : 7,000 &lt; Total &lt; 11,000</li><li>High Engagement (95 images) : Total &gt; 11,000</li></ol><p><em>Note: Total = numberLikes + numberComments</em></p><p><strong>Step 3: Learning Model and Accuracy</strong></p><p>I’m using <strong>fastai</strong> vision model to create this model, the model, for now, doesn’t work as the accuracy is only around 40%, I will keep training the model by adding more data and using different data augmentation and keep updating the code in <a href="https://github.com/Hilaren/Instagram-posts-popularity-prediction">Github</a>. Also, you could play it using this <a href="https://insprediction.herokuapp.com/">build-in web App</a>.</p><ol><li>Conclusion on data augmentation: Data augmentation should be used.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*8QREacPZbRfQO9IQxxRung.png" /><figcaption>resnet18, augmentation(N)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*AzDzKHUnzvMcsgfp0LYFug.png" /><figcaption>resnet18, augmentation(Y)</figcaption></figure><p>2. Conclusion on architectures: resnet 34 works the best.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*AzDzKHUnzvMcsgfp0LYFug.png" /><figcaption>resnet18, augmentation(Y)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*EcOG2Z5sXHDRJeZqCrSdhQ.png" /><figcaption>resnet34, augmentation(Y)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*NaLRVptcn7kAjna4crzN9w.png" /><figcaption>resnet50, augmentation(Y)</figcaption></figure><p>3. Increase epochs with resnet34: overfitting when epochs more than 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*7HygVbTA7iFwlDiB6uzazA.png" /></figure><p><strong>Step4: Final Result with the test dataset</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*om_jfNPrqRDjfTe_WEe17g.png" /></figure><p>This <a href="https://www.instagram.com/p/CKI8XcaMFeQ/">image</a> above has 15,100 Likes and 263 Comments, based on the baseline I set up, it should be <strong><em>High Engagement</em></strong>, while the model predicted it as Neutral which is incorrect. I tested the model with around 20 images and just got around 50% accuracy which is aligned with the accuracy rate showed in the previous part.</p><h3>Conclusions and Learnings</h3><p>From the results shown above, I would say fastai vision model could probably be used to predict the popularity of Instagram posts if the following items being taken into consideration when building the model.</p><ol><li><strong><em>More images should be added. </em></strong>100 images for each class is way little for training such a complicated model. At least 3,000 images for each class were suggested by a seasoned AI practitioner.</li><li><strong><em>More factors should be considered when segmenting the classes. </em></strong>The classes, namely the engagement levels(High/Neutral/Low) I defined was just simply using the number of Likes/Comments which is apparently not enough. The posts’ performance on social media could be impacted by a lot of various factors, such as <strong>posting time, labels attached, advertised or not, and so forth</strong>. From a sample taken from the top_losses below, we could see that Sezane posted the same image (1st and 4th) twice while got totally different results, the first one had a neutral performance versus the fourth one had a high engagement. These 2 images confused the model, so I removed them. This is just a simple case. I believe there’s more.</li></ol><p>№1: 9402 Likes + 184 Comments = 9,586</p><p>№4: 15,300 Likes + 274 Comments = 15,574</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*xjtb1b4PsNygKbANZ0tBJg.png" /></figure><p>3.<strong><em> Rethink on the grouping</em></strong>. I roughly defined the sum of the number of Likes and Comments below 7,000 as <strong>Low Engaged</strong> and the ones with over 11,000 as <strong>High Engaged</strong>, apparently this grouping method is too rough and not accurate.</p><p>4. <strong><em>Try fastai tabular model.</em></strong></p><p>Predicting the popularity of a social media post is tough, but it’s interesting, isn’t it?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d439853a6a9a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/unpackai/can-fastai-vision-model-be-used-to-predict-the-popularity-of-your-instagram-posts-d439853a6a9a">Can fastai vision model be used to predict the popularity of your Instagram posts?</a> was originally published in <a href="https://medium.com/unpackai">unpack</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>