Mathematica study: Benedict Cumberbatch successfully parodies other actors, but can he fool a computer?

Original author: Rita Crook
  • Transfer
Translation of Rita Crook's post " Benedict Cumberbatch Can Charm Humans, but Can He Fool a Computer? "

Released this week, the highly anticipated, to rent a movie, " The Imitation Game " ( of The Imitation the Game ) tells the story of Alan Turing (100th anniversary of whose birth coincided with the 22 th day of the system of birth of Mathematica - for details, see the post by Stephen Wolfram. Happy Birthday, Alan Turing ). The central theme of the film is Turing machines. Interestingly, in 2007 Wolfram Research announced a prize for proving the versatility of a 2.3 Turing machine.

Of course, the promotion videoBenedict Cumberbatch, in which he imitates the voices and behavior of other famous actors, many liked. But I wanted to find out whether the Mathematica functionality from the Machine Learning area could recognize his voice, or whether he could “fool” the computer too.

Personally, I can’t help laughing at watching this video, but I want to look at these parodies with an open mind.

So, I asked myself: Does he really imitate the voices of other actors so well, or are we all, including myself, simply fascinated by his persona?

Maybe my mind is deceiving me? If we take the entire sample of the original voices, will the parodies really be indistinguishable from them?

In order to get an answer to this question, 10 years ago we would have to walk the streets and play sound bites from James Bond, Radiance, Batman and Cumberbatch emulating them, interviewing 300 people and then analyzing their opinions.

In today's world, you can use systems like Mathematica to answer these questions!

The Wolfram Language has a built-in functionality that allows you to create a classifier based on training samples of audio fragments, which ultimately allows us to find out whether Cumberbatch can “trick” a computer. So, I set myself the task of creating a fairly “decent” database of fragments of votes, in addition to this, I selected fragments corresponding to each of the Cumberbatch parodies and, finally, allowed me to do the rest for meMathematica .

We will build a path to each of the databases of voice fragments that will be used by Mathematica for analysis.

Classify sample voice snippets

Now we import all the original voices: the

Import real voices

Classifier was created using the Classify function , which was supplied with a training sample. To increase productivity, once created the classifier ( ClassifierFunction ) can then be loaded into the system instantly from the file cfActorWDX.wdx (in the commented part of the code, there is, in fact, a construct that creates the classifier):

Classifier was trained simply by providing the associated real voices to Classify

My database includes: samples of the original voice of Benedict, the voices of the actors that Benedict imitates and, finally, fragments of the parodies of Benedict. Sources for creating the training sample were taken from here: Alan Rickman , Christopher Walken , Jack Nicholson , John Malkovich , Michael Kane , Owen Wilson , Sean Connery , Tom Hiddleston , and Benedict Cumberbatch . I used a total of 560 fragments, but, of course, the more data is used, the more reliable the result. At the same time, the samples should be as “clean” as possible (without laughter, music, other people's conversations, etc.)

They must also have exactly the same length (3.00 s). In order to be sure that everyone has the same length, you can use this design in Wolfram Language:

Making sure snippets are all the same length

Some of the files were not single-channel, so this feature also needed to be removed in order to optimize our results even at the generation stage and exporting samples.

Excluding single-channel audio files

I thank Martin Hadley and Jon McLoon for their help in creating this code.

Drum roll ... time to talk about the results!

I guess now I’ll break everyone’s heart, and I definitely would not want to do this ... so I will “blame” Mathematica for everything, since Machine Learning actually allows you to determine whose voice sounds in a particular fragment, which means it allows you to recognize the imitation of the voice and determine who, in fact, spoke.

The results below show which of the actors and with what probability Mathematica gave “authorship” in each of the fragments of the “imitation” of Benedict to the voices of other actors:

Mathematica provides 97-100% confidence on the impressions tested

In most cases, the likelihood that any of the actors spoke besides Benedict Cumberbatch or Alan Rickman is negligible .


It may be worth noting that Rickman, Connery and Wilson all have a rather slow manner of speaking with a lot of pauses (which is quite noticeable in the fragments I used), which in general can somewhat confuse the algorithm.

Sad benedict cumberbatch

Now is the time to overcome this small shock without holding a “grudge” against Benedict. He still certainly remains very charming.

On the whole, I am delighted with his talent and look forward to watching his game in the film, which I spoke about at the very beginning of my short post.

Resources for learning Wolfram Language (Mathematica) in Russian:

Also popular now: