From taking mugshots to creating virtual borders for rich countries, surveillance technology has come of age thanks to AI.