A.I. A.I. by an A.I.
For NaNoGenMo 2016 I had an idea to attempt to generate an novelisation of the film A.I. Artificial Intelligence using image captioning AI on stills from the movie.
The cover of the resulting paper copy of the novel. Method I ripped the DVD of “A.I. Artificial Intelligence”. Then extracted 5036 stills from the file (frame rate of 0.6 per second) with Avconv. Using https://github.com/karpathy/neuraltalk2 I ran two passes over the images, first with sample_max set to 1, which produces more accurate captions (and more repetition), then with sample_max set to 0, which is less accurate but more “imaginative”. The neural network has a tendency to fail and produce the string “UNK” as part of the caption, more so with sample_max 1. So I loop over each line in the accurate text, if it has an “UNK” or the first five characters are the same as the previous line then replace it with the sample_max 0 text. Any remaining UNKs I replace from a list of synonyms of “unknown”. Then I build sentences from those lines, possibly combining two with a conjunction or a semicolon. Then I make paragraphs from multiple sentences. Then chapters from a bunch of paragraphs. The chapter titles are the most common five letter or more word in the chapter that’s not previously been a chapter title. I put the output into a LaTeX template from here: https://www.overleaf.com/latex/templates/fiction-novel/pjdthvgdtsfy Then run pdflatex to produce the PDF. Result The PDF output
Read more