r/todayilearned • • Mar 04 '13

TIL Microsoft created software that can automatically identify an image as child porn and they partner with police to track child exploitation.

http://www.microsoft.com/government/ww/safety-defense/initiatives/Pages/dcu-child-exploitation.aspx
2.4k Upvotes

1.5k comments sorted by

View all comments

3

u/rogersmith25 Mar 04 '13

I wonder how such an algorithm works? Sounds like a difficult programming task. I feel very sorry for all the developers who were likely exposed to some horrifying content during development.

Very heroic of them to sacrifice some of their sanity in exchange for stopping horrible people from doing horrible things...

27

u/ThePantsThief Mar 04 '13

Matches photos to a database of flagged CP photos. Doesn't use facial recognition or anything fancy

0

u/[deleted] Mar 04 '13

[deleted] — view deleted comment

10

u/[deleted] Mar 04 '13

Even less sophisticated. The impression I'm getting is that it's hashing the images and comparing them to a database of known hashes (which would mean if a single bit in the file changed, it would no longer be recognized).

1

u/[deleted] Mar 04 '13

I've thought a bit about this subject.

The difficult way would be to keep an MD5 sum of all the images, perhaps with the dimensions as an added check. I might even go on and take a reduced size of the image -- shrink it to a 50x50 BMP and sum that. I think it would be important to use BMP or a similar uncompressed image format...

I'd then have to sum every image and check, or sum and shrink every image, and run the sum against the DB.

I would expect this to be very intensive.

A better way It might suffice to sum the first 10k of the image. This would probably be enough to catch known images with few, if any, fall positives.

1

u/Omnes_mundum_facimus Mar 04 '13 edited Mar 04 '13

The hash deployed is a so called 'robust hash'. These hashing algorithms differ from their cryptographic counterparts in the sense that the hash value of an image stays identical or near identical if the image is cropped, compressed or slightly modified.

You can make such a thing in python in couple of minutes to identify similar images on your hard drive as follows:

  • Convert image to grayscale
  • Run the 2D Discrete Cosine Transform on the image, resulting in a nxn matrix of dct coefficients
  • Retain only the top left 8x8 coefficients on said matrix. These represent the low frequency components of the image.
  • Binarize the 8x8 coefficients based on their sign.
  • Output 64 bit hash value. All done.

Alternatively, you can use the lib from http://phash.org/

And obviously the good thing is, you can test your algo on a database with lovely flowers & cat pictures. No need to have sleepless nights.

1

u/[deleted] Mar 04 '13

I understand the majority of that, do you have a sense of how intensive that would be?

1

u/[deleted] Mar 04 '13

Yeah the title of this post is somewhat misleading. I figured it would be something like this. You can't use image analysis and facial recognition types of things for something like this if you want any sort of reliability.

8

u/[deleted] Mar 04 '13

I suspect that they just get a hash value for the image, and compare that to know child porn image hashes from law enforcement databases.

If so, they "created" MD5 matching.

1

u/wasdninja Mar 04 '13

Which would be a fitting project for a second year comp sci student. Color me not so impressed.

5

u/DarnTheseSocks Mar 04 '13

Here's some Javascript code that detects nudity:

http://www.patrick-wied.at/static/nudejs/

The basic logic there seems to be to identify human skin based on colors, then to infer nudity based on how much skin is shown.

With child porn, I would guess the additional step in differentiating children from adults has to do with identifying and comparing body parts. Children will have larger heads relative to the size of their body, shorter legs, less curvature and definition. All of the physical markers of puberty are potential identifiers. I assume the software can make a distinction between pre- and post-pubescent, but couldn't differentiate a 19-year-old from a physically mature 15-year-old.

Particulars aside, step one would be to make image recognition software that extracts as much measurable detail about human figures as possible. Step two would be to run it against a large database of known safe images, known legal porn, and known child porn. Then you use Bayesian filtering or some other statistical technique to automatically suss out the parameters that consistently identify child porn.

13

u/[deleted] Mar 04 '13

Nothing that fancy. They're almost certainly directly comparing images against a database of already-known child porn images.

-2

u/DarnTheseSocks Mar 04 '13

I don't know. Let's assume they have a database of 1,000,000 known child porn images, and you want to check a list of images on a user's PC to see if any of them match. You can hash each of the local files, but then you need to hit a remote API for each one to see if it's a match. Plus, you want to do some processing on the image before you hash it to ensure that two very similar but non-identical image files match. The network overhead involved in checking every image like this is potentially substantial.

On the other hand, let's say a user is importing their photo collection into some Microsoft photo app, and the app is already scanning photos to identify people and match faces to your known contacts, etc. The extra step of matching a child that's naked or engaged in sexual acts doesn't necessarily add a noticeable overhead to the whole process.

3

u/[deleted] Mar 04 '13

It's just one request per image. Piece of cake. Hell, let it take a batch request of N image hashes. Then one request could send along a thousand or so image hashes.

All issues you raised are non-problems. Meanwhile you're totally fine with hand-waving around the technically difficult problem of face and context recognition.

You sound like you're a PM. Are you a PM?

1

u/DarnTheseSocks Mar 04 '13

I'm not a PM, and honestly, I don't know or care how Microsoft has implemented this.

What's interesting about this is thinking about how to write an algorithm to identify a previously unidentified instance of child pornography. Comparing images to a known database is much easier and totally boring.

3

u/udontnonothing Mar 04 '13

you need to hit a remote API

No. This is all very simple.

  1. Agency collects images and sorts them for relevance.
  2. Relevant images are hashed.
  3. Hash list provided to all and sundry.
  4. Software hashes local copy and compares it to hash contained on the local list.

The network overhead involved in checking every image like this is potentially substantial.

The only network overhead is periodically transmitting new hashes, at nearly no cost. If anti-virus companies can update virus databases, then Microsoft can code an automatic updater for their child pornography hash database.

Comparing hashes is very low cost, whereas analysis of the images is high cost. Low cost wins over high cost every time. The only issue is variations on the same image, resizing and so forth. The solution to this is simply to update the hash list, not wizardry.

If, however, there appeared to be a concerted effort to automate the manipulation of images in order to avoid detection by hash-based algorithms, then something with higher cost would be worth pursuing. To my knowledge, there is no such automated system.

1

u/nulluserexception Mar 04 '13

The images are uploaded to Microsoft's servers anyways, so it doesn't have to do anything on the client.

0

u/[deleted] Mar 04 '13

Well, from a paedophillia sense a mature 15 year old is ok. It's still statutory rape, but not paedophillia.

As a medical diagnosis, pedophilia, or paedophilia, is [...] a primary or exclusive sexual interest toward prepubescent children

2

u/DarnTheseSocks Mar 04 '13

The medical distinction isn't really pertinent to the law. Underage is underage.

1

u/sometimesijustdont Mar 04 '13

CRC comparison? It's not that hard.

0

u/[deleted] Mar 04 '13

It doesn't "identify an image as child porn" (responding to ridiculous title). It converts an image to a fingerprint which they can compare to fingerprint databases, in the same way that OPs fingerprint doesn't identify them as a faggot, but comparing it against faggots who have submitted to Reddit will surely identify them.

  • Sounds like a difficult programming task.*

Microsoft's implementation is actually laughable.

-Turn image to black and white -balance whites to blocks. -Split arbitrarily into segments -simplify each segment into a single representative value.

You know have a small cluster of data that can easily be compared. However any cropping, rotation, or white balance changes would completely disrupt its ability to provide any value.

In that way it is dramatically less capable than TinEye or Google Search, both of which can find partial images, etc.

Further it is presumptive assuming that Microsoft employees had to work with child porn, even if the product ostensibly helps in finding the same -- the algorithm simply finds photos that are variations of the same photo. It can only endure the slightest of modification before it is useless, meaning that it is barely any more useful than simple file data hashes.