Project Guidelines_ AIML
Project Guidelines_ AIML
00:17:47 this will save a ton of time for you now with open
as again the same os dot path dot join everything as read
binary so that is the format we are going to read as file
now again features equals pickle dot load of f so this will
reload all the features from the pickle file so this is the
syntax for storing data in the pickle and again reloading
from the file now that's done we will use this after this
completes next we have to load the captions so here load
the captions data now again with open as
00:18:58 again os dot path dot join here instead of
features dot pixel we will say captions dot text and
instead of working directory we will use the base directory
and we have to set the read option and as f now next of f
i'll tell you why i am using next so let's close this list so
open this caption so here in this text file we do have
image comma caption we don't need this first line that's
why i'm using next year so it will skip those line and we
can proceed further i will now i will say caption doc
00:24:08 see this file you can now download it and reuse it
again so it will be easier if you want you can run this and
reload it again i'll just leave it as it is now run the captions
so we will have the captions doc let's also double check so
captions doc so this is the text data we are having we are
splitting it by n okay this is a big one i think i can delete it
so i am splitting it by n so we will be getting line by line
and after that here where we left off convert caption list
to string so that will be
00:39:10 and yeah let's do that first we will split the train
and test data i will get the image ids image id sqls list of
mapping dot keys so this will have the image ids and after
that we need to have a split ratio so split equals into len
of image ids i am going to get only uh 90 as training data
so 0.90 let's see the split so 7218 will be used for training
and the remaining will be used for testing now i'll say
train equals image ids of colon split and test equals image
id start of split colon so this is the train test split run this
00:45:44 going and after that again start girl going space
into so this is how the sequence flow works first initially
we will be having only the starting sequence so using this
text sequence and the corresponding image sequence we
are going to predict the next word so that is the goal and
after that we will concatenate uh both input and output
have it as a next input sequence so this is the next input
sequence and again we are going to predict the next word
going and again we are going to concatenate everything
so girl going and
00:47:41 that is the start and after that we will get the
next sequence of i that is this word that is the next word
let's say if we have is one means the girl will be the
sequence of i so that is the output and the process keeps
on going until the end of the sequence so this is the in and
out sequence now we have to pad the input sequence
because we need to have a common length so pad input
sequence equals input sequence equals pair sequence off
in a list pass the input sequence comma max length
equals
01:04:20 means you can say model dot save i will say best
model best model dot h5 okay using this you can save the
model i can command this save the model so that's done
now we can come back again after the training completes
we need to create some few more functions for predicting
the captions from the test image and we will also plot the
image and the corresponding actual caption and the
predicted caption so it will be helpful for us so welcome
back guys so we have completed uh our training with the
15 epochs as you
01:17:14 deal with the text data so this will have like a
thing engram scores so first print the leu of one colon
percentage f percentage for this i think we have to import
the module corpus blew off actual comma predicted
comma weights equals one zero zero zero so this is for
one and uh similarly we have to do it for like two words so
the weights will be 0.5 and here also 0.5 so that's done it
will print the results before that we have to import it so
let's go to the top our rim or we can import it here itself
01:26:33 it's just having end and dentin i think due to this
only we are having this uh blue score issue maybe uh it's
not having that uh let's also try out a different one to
check whether it's the case um let's go for caption i'll take
this as a id or the whole image okay and paste it here and
this yes i think it's having some issues and the girl is in
the rainbow dress and it's having the end and it's
repeating the same thing again and again let's uh tweak
this thing a little bit in the generator caption
01:32:10 keys and all let's run this another time okay yeah
it's uh giving the same results but it's actually uh a better
uh compared to the actual uh results so based on the
actual and predicted we are getting this blue score so
that's good maybe what you guys can do is run the
training for more than 50 epochs in this training here and
check the results whether you are getting higher blue
score compare to what we have here so if you got here
scores means please leave it in the comments so it will be
very helpful for others