April 2020
Intermediate to advanced
380 pages
9h 24m
English
In the following steps, we will process the loaded captions dataset, and convert it to forms suitable for performing training on it:
descriptions = {}for x in captions: imgid, cap = x.split('\t') imgid = imgid.split('.')[0] if imgid not in descriptions.keys(): descriptions[imgid] = [] descriptions[imgid].append(cap)
In the preceding lines of code, we broke down each line in the file into the parts of image ID and captions for each of those images. We created a dictionary out of it, where the image ID is the dictionary key and each key-value pair contains ...
Read now
Unlock full access