<?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 Shreyz-max on Medium]]></title>
        <description><![CDATA[Stories by Shreyz-max on Medium]]></description>
        <link>https://medium.com/@shreyz-max?source=rss-f5ce79c46f83------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*R1noetqV5n-cPAq6e6lUhg.jpeg</url>
            <title>Stories by Shreyz-max on Medium</title>
            <link>https://medium.com/@shreyz-max?source=rss-f5ce79c46f83------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 09:04:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shreyz-max/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[Fine-Tuning GPT3 for free]]></title>
            <link>https://medium.com/analytics-vidhya/finetuning-gpt3-ba07a10fa9d3?source=rss-f5ce79c46f83------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba07a10fa9d3</guid>
            <category><![CDATA[nlp-training]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[fine-tuning]]></category>
            <category><![CDATA[gpt-3]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Shreyz-max]]></dc:creator>
            <pubDate>Sat, 23 Jul 2022 03:32:48 GMT</pubDate>
            <atom:updated>2022-07-23T09:22:22.017Z</atom:updated>
            <content:encoded><![CDATA[<p>Using GPT3 on your data for free</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*_o8Hmdy2bhXXMns-lVqBhg.jpeg" /><figcaption>DALLE’s version of training AI</figcaption></figure><blockquote><strong>What do you call French bread? Loaf. </strong>(made me chuckle don’t ask why)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*amUheO-xQeCPKl4TF7-OqQ.jpeg" /><figcaption>This is why I chuckled.</figcaption></figure><p><strong><em>This is one of the jokes generated by GPT3 after it was fine-tuned on some jokes from Reddit. For more AI-generated jokes scroll to the end of the article where I write some of my favourite jokes generated by GPT3.</em></strong></p><p>GPT3 is the new state-of-the-art language model. When it was released back in 2020, it was hyped a lot. It did live up to its hype. The beta version was available for very few people and organisations. Later, the playground access was available for almost everyone. However, even then fine-tuning was not available. Even though the model weights have yet not been open-sourced we can at least fine-tune it now based on our dataset. Some question OpenAI for its biasedness and for not open-sourcing the weights. However, this discussion is for some other time.</p><p><strong>OpenAI provides $18 worth of free credits</strong> when you create an account to get access to GPT3. We will use this feature to fine-tune any of the three models curie, babbage and ada. The largest model Davinci is still not available for fine-tuning. Some other limitations include that one can fine-tune up to 10 models per month and each dataset can be up to 2.5M tokens or 80–100MB in size.</p><p><strong>To start with fine-tuning we need first to create an account in OpenAI. You can do so using this </strong><a href="https://openai.com/api/"><strong>link</strong></a><strong>.</strong> Once you have created an account, the next step involves getting your API key. This is unique for each user. Now we will open our Jupyter Notebook.</p><p><strong><em>There are many ways to fine-tune GPT3 : (i) using OpenAI CLI, (ii) using the OpenAI package, and (iii) using requests.</em></strong></p><p>I will be using the OpenAI package because it is the easiest.</p><h3>FINE-TUNING USING OPENAI PACKAGE</h3><p>The main steps involved in fine-tuning are:</p><ol><li><strong>Preparing the fine-tuning dataset.</strong></li><li><strong>Fine-tuning the model.</strong></li><li><strong>Using the fine-tuned model for inference.</strong></li></ol><pre>!pip install openai</pre><p>Next, let us start making the required imports.</p><pre>import openai</pre><pre>import pandas as pd</pre><pre>import string</pre><pre>openai.api_key = &#39;YOUR API KEY&#39;</pre><p>Let us now read the dataset. I have used a random dataset that scraped some jokes off Reddit. You can use any dataset you like.</p><pre>df = pd.read_csv(&#39;jokes.csv&#39;)</pre><pre>df.head()</pre><p>Ideally, the dataset to fine-tune GPT3 should be a <strong>jsonl file</strong> that should look like this.</p><pre>{&quot;prompt&quot;: &quot;&lt;text&gt;&quot;, &quot;completion&quot;: &quot;&lt;text to be generated&gt;&quot;}<br>{&quot;prompt&quot;: &quot;&lt;text&gt;&quot;, &quot;completion&quot;: &quot;&lt;text to be generated&gt;&quot;}<br>{&quot;prompt&quot;: &quot;&lt;text&gt;&quot;, &quot;completion&quot;: &quot;&lt;text to be generated&gt;&quot;}</pre><blockquote>For text completion we shall provide it with some prompt text however for generation of text we will leave prompt blank. I have tried both ways and I realised that providing some text to the prompt gives better results compared to completion.</blockquote><h3><strong>1. PREPARING THE FINE-TUNING DATASET</strong></h3><p>However, OpenAI has a feature which converts <strong>CSV, TSV, XLSX, and JSON to JSONL files. I have preprocessed the dataset. Let us now convert it into jsonl format.</strong></p><pre>!yes | openai tools fine_tunes.prepare_data -f &#39;joke.csv&#39;</pre><p>yes denotes that all options in fine-tuning should be set to true. Once the jsonl file has been prepared our next step involves creating a file id from this file. We shall do so using this command.</p><pre>#write your file name instead of jokes_prepared.jsonl</pre><pre>with open(&quot;joke_prepared.jsonl&quot;) as f:</pre><pre>      response = openai.File.create(file=f, purpose=&#39;fine-tune&#39;)</pre><pre>print(response)</pre><p>A file id will be available to you.</p><h3>2. FINE-TUNING THE MODEL</h3><p>Now that our data is in the required format and the file id has been created, the next task is to create a fine-tuning model. This can be done using:</p><pre>response = openai.FineTune.create(training_file=&quot;YOUR FILE ID&quot;, model=&#39;ada&#39;)</pre><p>Change the model to <strong>babbage or curie if you want better results</strong>. By default, it runs 4 epochs to fine-tune a model. The fine-tuning will take some time depending on the size of the dataset and the model that you will be using. <strong>You can keep checking up on the fine-tuning process using the following command.</strong></p><pre>response = openai.FineTune.retrieve(id=&quot;YOUR FINE-TUNE ID&quot;)</pre><p>The creation of fine-tuning file will create an id. Use that for retrieving the status on the fine-tuning. Once the fine-tuning is over, you will see the status changes to processed from processing in the response.</p><h3><strong>3. USING THE FINE-TUNED MODEL FOR INFERENCE</strong></h3><p>Now that our model has been fine-tuned we can use it for inference. The response message will contain the id of the fine-tuned model. We will be using that id to call our model.</p><pre># ft_model should have your model id<br>ft_model = &quot;ada:ft-personal-2022-07-22-11-25-19&quot;</pre><pre>res = openai.Completion.create(model=ft_model, prompt=&quot;I hate ... &quot;, max_tokens=18, temperature=1)</pre><p>You can change <strong><em>max_tokens</em></strong><em> </em>to the size of the generated text you want. You can also experiment with the <strong><em>temperature</em></strong> parameter. It takes values from 0 to 2.</p><p>The whole code for fine-tuning is available here.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83ef39ba9f4d7865fe39d484c83e711a/href">https://medium.com/media/83ef39ba9f4d7865fe39d484c83e711a/href</a></iframe><p>Now, let me show you some other jokes generated by GPT3 that may not be on my list of all-time favourite jokes but are worth a look:</p><ol><li><strong>I hate … iphones !!!!!! Why do they have to have so many tones? </strong>(Wow super strong on punctuations)</li></ol><p><strong>2. What do you call 4 in the afternoon? Grease afternoon!</strong></p><p><strong>3. Knock Knock … -&gt; Who’s there? cow ooooooooooo “Cow who? Cow, who loves you” -&gt; “Cow has lost its voice” ooooooooooooo</strong></p><p><strong>4. How do you feed a friend with no mouth? you feed them a fork. </strong>(Flawed sense of logic by GPT3)</p><p><strong>5. Why are ants not allowed at the party? Because they all have stings.</strong></p><p>Although most of them do not make sense we already knew that since GPT3 is not that great when it comes to logic. Here are some other jokes to make you chuckle.</p><ol><li><em>Why are ants not allowed at the party? Because they all have stings.</em></li><li><em>Why is . -&gt; . an illegal operation? Because it is prohibited by the * cow * contract! (No clue what is illegal but cow contract makes sense)</em></li><li><em>Why are physicists so bitter? Because they can’t stand (P.S. I am sorry physicists but apparently all of you are Stephen Hawking).</em></li></ol><p>I hope you enjoyed the article. If so, do give it a clap and follow me for more interesting articles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba07a10fa9d3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/finetuning-gpt3-ba07a10fa9d3">Fine-Tuning GPT3 for free</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Video Captioning with Keras]]></title>
            <link>https://medium.com/analytics-vidhya/video-captioning-with-keras-511984a2cfff?source=rss-f5ce79c46f83------2</link>
            <guid isPermaLink="false">https://medium.com/p/511984a2cfff</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[translation]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Shreyz-max]]></dc:creator>
            <pubDate>Mon, 15 Mar 2021 12:17:25 GMT</pubDate>
            <atom:updated>2022-06-20T06:39:31.419Z</atom:updated>
            <content:encoded><![CDATA[<p>Generate captions that describe the events of a video automatically</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3WApk9iWeIWXuRNKs9tYKw.jpeg" /></figure><h3><strong>INTRODUCTION</strong></h3><p>The task of video captioning has become very popular in recent years. With all these platforms like YouTube, Twitch, and short videos like Instagram Reels, videos have become a very important means of communication in our daily life. According to Forbes, over 500 million people watch videos on Facebook every day. 72 hours of videos are uploaded to YouTube every minute. With videos gaining such high popularity AI products for videos have become an all-time necessity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*8f9rMeyNMqDlb9donwAqTg.gif" /><figcaption>A clip showing real-time prediction of video captioning</figcaption></figure><h3>PRIOR KNOWLEDGE</h3><p>Concepts of LSTM/RNN and basics of encoder-decoder architecture along with understanding Keras is required to understand this post.</p><h3>MOTIVATION</h3><p>I was looking for some unique projects to work on when I came across captioning. I started diving into this topic when I realized the lack of good resources on video captioning yet tons on image captioning. So, I decided to work on this and make it easier for people to implement video captioning.</p><h3>REAL-WORLD APPLICATIONS</h3><p>We must first understand how important this problem is in real-world scenarios.</p><ul><li><strong>Better search algorithms</strong>: If each video can be automatically described search algorithms will have finer more accurate results.</li><li><strong>Recommendation Systems</strong>: We could easily be able to cluster videos based on their similarity if the contents of the video can be automatically described.</li></ul><h3>DATA COLLECTION</h3><p>For the purpose of this study, I have used the <strong>MSVD</strong> data set by Microsoft. You can get the data set from <a href="https://www.dropbox.com/sh/whatkfg5mr4dr63/AACKCO3LwSsHK4_GOmHn4oyYa?dl=0">here</a>. This data set contains 1450 short YouTube clips that have been manually labeled for training and 100 videos for testing.</p><p>Each video has been assigned a unique ID and each ID has about 15–20 captions.</p><h3>UNDERSTANDING THE DATA SET</h3><p>On downloading the data set you will find the <strong>training_data</strong> and <strong>testing_data</strong> folders. Each of the folders contains a <strong>video</strong> sub folder that contains the videos that will be used for training as well as testing. These folders also contain <strong>feat</strong> sub folder which is short for features. The feat folders contain the features of the video. There are also <strong>training_label</strong> and <strong>testing_label</strong> json files. These json files contain the captions for each ID. We can read the json files as follows:</p><pre>train_path=&#39;training_data&#39;<br>TRAIN_LABEL_PATH = os.path.join(train_path, &#39;training_label.json&#39;)<br><em># mentioning the train test split</em><br>train_split = 0.85<br><em># loading the json file for training</em><br><strong>with</strong> open(TRAIN_LABEL_PATH) <strong>as</strong> data_file:    <br>    y_data = json.load(data_file)</pre><p>The json file looks as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*JNuNOI0Nhx8o0jzvsYrSRw.png" /><figcaption>Each video has multiple captions which mean the same thing</figcaption></figure><p>Thus for each video id there are many alternative captions.</p><h3>EXTRACTING FEATURES OF VIDEO</h3><p>Video Captioning is a two-part project. In the first part, the features of the video are extracted.</p><p>What is a video? One can say a video is a <strong>list of images</strong> right? So for a video in the data set each and every image called frame is extracted from the video.</p><p>The code for this can be seen here.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c221eedb9ce99c896ef494230a02f2c/href">https://medium.com/media/5c221eedb9ce99c896ef494230a02f2c/href</a></iframe><p>Since the length of videos is different, the number of frames extracted is also going to be different. So for the sake of simplicity, only 80 frames are taken from each video. Each of the 80 frames is passed through a pre-trained <strong>VGG16</strong> and 4096 features are extracted from each frame. These features are stacked to form an (80, 4096) shaped array. 80 is the number of frames and 4096 is the number of extracted features from each frame.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bd8048d92fc0ac8c33426afbf937e33b/href">https://medium.com/media/bd8048d92fc0ac8c33426afbf937e33b/href</a></iframe><p>Here you can see the model VGG16 is loaded. Each of the 80 frames from each video is passed into the model to extract features and saved as numpy arrays. Now these features have already been extracted for us in the data set, so we can simply move on to the next step.</p><h3>CLEANING AND PREPROCESSING CAPTIONS</h3><p>Now we will load all the captions and pair them with their video IDs. Here is what I have done. The train_list contains a pair of captions and its the video ID. The only text preprocessing I have done is add the &lt;bos&gt; and &lt;eos&gt; tokens before and after each caption respectively.</p><ul><li><strong>&lt;bos&gt;</strong> denotes the beginning of the sentence hence the model knows to start predicting from here and</li><li><strong>&lt;eos&gt;</strong> denotes the end of the statement, this is where the model knows to stop the prediction.</li></ul><p>This is how the train_list looks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*-D1HfBQgqJp667RhpN-fuQ.png" /><figcaption>Some of the training list items</figcaption></figure><p>The train_list is split into training and validation. The training_list contains <strong>85%</strong> of the data and the rest is present in the validation_list.</p><p><strong>The vocab_list contains only the captions from the training_list because we will only use the words in the training data to tokenize</strong>. After tokenizing we will pad the captions so that all the sentences are of the same length. In my project here I have padded all of them to be 10 words. You might have seen that <strong>I also am only using captions where the number of words is between 6 and 10</strong>. You might ask why I did this?</p><p>If you look at the caption with the maximum number of words in all of the dataset it has 39 words but for most captions, the number of words is between 6 and 10. If we do not filter out some of the captions we will have to pad them all to the maximum length of the captions, here in our case 39. Now if most sentences are of 10 words and we will have to pad them to double their length this would lead to a lot of padding. These highly padded sentences will be used for training which will lead to the model predicting mostly padded tokens.<strong> Since padding basically means adding white spaces so most of the sentences predicted by the model will just contain more blank spaces and fewer words leading to incomplete sentences.</strong></p><p><strong>Now I used only the top 1500 words as the vocabulary for the captions.</strong> Any of the captions you see generated has to be a part of the 1500 words. Even though the number of unique words is way more than 1500 why is it that we only use 1500 words for training?</p><p>If you think most of the words appear very few only 1, 2, or 3 times making the vocabulary prone to outliers. Hence to keep it safe we will only use the top 1500 most occurring words.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d630bdb1312ebb78795f7f21da36fd1e/href">https://medium.com/media/d630bdb1312ebb78795f7f21da36fd1e/href</a></iframe><h3>MODEL FOR TRAINING</h3><p>Mostly for problems related to text generation, the preferred model is an encoder-decoder architecture. Here in our problem statement since the text has to be generated we will also use this <strong>sequence-to-sequence</strong> architecture. To understand more about this architecture I would suggest checking out this <a href="https://towardsdatascience.com/understanding-encoder-decoder-sequence-to-sequence-model-679e04af4346"><strong>article</strong></a>.</p><p>One thing to know in this architecture is the <strong>final state of the encoder cell always acts as the initial state of the decoder cell</strong>. In our problem we will use the encoder to input the video features and the decoder will be fed the captions.</p><p>Now that we have established we will be using an encoder-decoder model let us look into how we shall use it.</p><p>What is a video again? We can call it a <strong>sequence of images</strong> right? For anything related to sequence we always prefer using RNNs or LSTMs. In our case, we will use an LSTM. To understand LSTMs refer to this <a href="http://colah.github.io/posts/2015-08-Understanding-LSTMs/">link</a>.</p><p>Now that we will use LSTM for the encoder let us look into the decoder. The decoder will generate captions. Captions are basically a sequence of words so we will use LSTMs in the decoder as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SvjfrQRH3OmHZ6752bWrnQ.jpeg" /><figcaption>Training model</figcaption></figure><p>Here in the picture, the features of the first frame are fed into the 1st LSTM cell of the encoder. This is followed by the features of the second frame and this goes on till the 80th frame. For this problem, we are interested only in the final state of the encoder so all the other outputs from the encoder are discarded. Now the final state of the encoder LSTM acts as the initial state for the decoder LSTM. Here in the first decoder LSTM &lt;bos&gt; acts as input to start the sentence. Each and every word of the caption from the training data is fed one by one until &lt;eos&gt;.</p><p>So for the example above, if the actual caption is <strong>woman is cooking something</strong> the decoder starts with &lt;bos&gt; in the first decoder LSTM. In the next cell, the next word from the actual caption <strong>woman</strong> is fed followed by <strong>is cooking something</strong>. This ends with &lt;eos&gt; token.</p><p>The <strong>time steps for the encoder</strong> is the number of LSTM cells we will use for the encoder which is equal to <strong>80</strong>. <strong>Encoder tokens</strong> are the number of features from the video which is <strong>4096</strong> in our case. <strong>Time steps for the decoder</strong> are the number of LSTM cells for the decoder which is <strong>10</strong> and the <strong>number of tokens</strong> is the length of vocabulary which is <strong>1500</strong>.</p><p>Let us look into the code for the model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3704ef46979f1b78123306ffe5a0e7dd/href">https://medium.com/media/3704ef46979f1b78123306ffe5a0e7dd/href</a></iframe><p>Let us look at the architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v5qLIIPFJ711gW-zrdProQ.png" /></figure><h3>LOADING THE DATASET</h3><p>Now that we know the model, loading data into it is also a very important part of the training.</p><p>The number of training data points is around 14k which will definitely <strong>cause RAM memory issues</strong>. To avoid such a problem I used a <strong>data generator</strong>. I used a batch size of <strong>320</strong>. Since there are two inputs for training. I convert it into a list and then feed the two together as encoder input which contains the features of the video as input and decoder input which are the captions that have been tokenized and padded converted to categorical features with 1500 labels as that is the length of vocabulary we will use or as I have mentioned as the number of decoder tokens. I use the <strong>yield statement</strong> to return the output. Yield statements are used to create generators. Here I have used a custom generator because we had two inputs. I have already loaded all the features in the form of a dictionary so that it takes less time to load the same arrays again and again.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e6eab58f61f94be637622c6404a2f83/href">https://medium.com/media/8e6eab58f61f94be637622c6404a2f83/href</a></iframe><h3>TRAINING</h3><p>I trained the model for 150 epochs. It took about 40 seconds to complete the training of one epoch. <strong>I used the colab free version for training on Tesla T4</strong>.</p><h3>MODEL FOR INFERENCE</h3><p>Unlike most neural networks the training and testing models are different for encoder-decoder. We do not save the whole model as is after training. <strong>We save the encoder model and the decoder part differently.</strong> Now let us look into the inference model.</p><p>First, we will use the encoder model. Features from all the 80 frames are passed into the model. This part of the model is the same as it was for training. The encoder model gives us the predictions. Here again, we are interested in the final output state so all the other outputs from the encoder will be discarded. The final state of the encoder is fed into the decoder as its initial state along with the &lt;bos&gt; token so that the decoder predicts the next word.</p><p>There are two ways to generate captions. <strong>I have implemented both but for faster results in a real-time prediction, I will use greedy search</strong>. To understand more about both <strong>greedy</strong> and <strong>beam</strong> search click <a href="https://machinelearningmastery.com/beam-search-decoder-natural-language-processing/"><strong>here</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hYGY2Qj5SFDM-oY6Sav5WQ.jpeg" /><figcaption>Inference model</figcaption></figure><p>Now if the model is trained properly as you can see above it should predict <strong>woman</strong> as the token. Remember, how in training the next input was always the next word in the captions. Since we have no captions here the next word is the output from the previous LSTM cell. The output <strong>woman</strong> is then fed into the next cell along with the state of the previous cell. This goes on to predict the next word <strong>is</strong>. This goes on until the model predicts &lt;eos&gt;. We will no longer need any more predictions because the sentence is complete.</p><h3>RESULTS</h3><p>Now I know everyone was waiting for this so let me show you some more results from the <strong>testing data</strong>. Now, mind you these results are using the greedy search algorithms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*r5J0bsz0OVE77ds-HcxaHA.gif" /><figcaption>a man is performing on a stage</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*XzKXLhihHiCyDcXR2lygkA.gif" /><figcaption>a man is mixing ingredients in a bowl</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*a22K0WrKFxoXvLoDe5yLsA.gif" /><figcaption>a cat is playing the piano</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*YazndScnNJcXR_EXZtKe9A.gif" /><figcaption>a man is spreading a tortilla</figcaption></figure><p>Now, it would be wrong to show only the appropriate results. Here are some of the not-so-correct results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*2TLWGM0qRiY9E-5TdkgrPw.gif" /><figcaption>a man is riding a bicycle</figcaption></figure><p>The model confuses a bike with a bicycle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*bA72GzaQXqtV_9P53P4aJA.gif" /><figcaption>a dog is making a dance</figcaption></figure><p>Somehow the model confuses the cat with a dog and instead of swinging the paws, the model thinks of it as making a dance. This caption grammatically does not make a lot of sense.</p><h3>CONCLUSION</h3><p>Thank you for reading this far. Please refer to my <a href="https://github.com/Shreyz-max/Video-Captioning"><strong>Github</strong></a> for more details.</p><p>Some more ways to make the training better is more shuffling of data. Adding videos from many different domains.</p><p><strong>Important Point</strong></p><p>We must understand that <strong>training data should be semantically similar to testing data</strong>. For example, if I train the model on videos of animals and test it on different activities it is bound to give bad results.</p><h3>FUTURE WORK</h3><ul><li>Instead of using the features given extracting more features on my own using models like I3D specifically designed for videos</li><li>Adding a UI to make this more attractive and deploying it to some platform.</li><li>Adding embedding layers and attention blocks to train for longer videos.</li></ul><h3>REFERENCES</h3><p><a href="https://github.com/CryoliteZ/Video2Text">https://github.com/CryoliteZ/Video2Text</a></p><p><a href="https://github.com/PacktPublishing/Intelligent-Projects-Using-Python/tree/master/Chapter05">https://github.com/PacktPublishing/Intelligent-Projects-Using-Python/tree/master/Chapter05</a></p><ul><li><a href="https://towardsdatascience.com/image-captioning-with-keras-teaching-computers-to-describe-pictures-c88a46a311b8">Image Captioning with Keras — “Teaching Computers to describe pictures”</a></li><li><a href="https://arxiv.org/abs/1505.00487">Sequence to Sequence -- Video to Text</a></li></ul><p>Want more AI content? <a href="https://www.linkedin.com/in/shreyz-max/">Follow me on LinkedIn</a> for daily updates.</p><h3>Thank you for reading. If you enjoyed this article, do give it some claps 👏 . Hope you have a great day ahead!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=511984a2cfff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/video-captioning-with-keras-511984a2cfff">Video Captioning with Keras</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>