Recently my employer Adblock Plus was having an annual Summer Team Week. Being a mostly distributed company it is a great opportunity to…
414 Words /||\ Reading Time: 1 Minute, 52 Seconds
2018-07-10 19:39 +0000
Recently my employer Adblock Plus was having an annual Summer Team Week. Being a mostly distributed company it is a great opportunity to socialize and meet people you work with, but never get to see in real life.
As it often happens in these cases after some amount of social activities I overheard someone jokingly suggesting that us being a company which has this goal of “putting you in charge of a fair and profitable Web”, we can just block the face of Donald Trump using some machine learning techniques. Because someone might want to do that :) Challenge accepted, I thought.
After a quick brainstorm I have resorted to loading a separate copy of an image from the background script, which shouldn’t be a big deal, as in most cases the images are cached anyway. With that change the extension started working. However since face recognition using a neural network is pretty resource intensive on some web pages the face recognition took way too long. So I enforced an artificial limit on the size of an image that extension would run inference on — dimensions larger than 150px. Thinking is that anything smaller than that doesn’t really matter much anyway.
Next, I had to compare the extracted face features to features of the face of Donald Trump. For that I have bundled an official portrait within the extension and just extracted the features from it when the extension initializes. This means that in theory any face can be targeted, just replace the `icons/detailed/Donald_Trump_official_portrait.jpg` with your reference image. And since the `carrot` image is also easily replaceable the extension can be taken to a lot of different directions. For example I have heard president Xi of China especially enjoys being compared to Winnie the Pooh ;)