# Real-Time Stream Processing in Social Networks with RAM\({}^{3}\)S
## 4 Use Cases
### Face Recognition  
Automatic face recognition was the use case first developed in RAM3S[9]. The goal of a face recognition system is to identify a person from a digital image. Usually, a face recognition system works by comparing features automatically extracted from the input image with those previously extracted from faces in the knowledge base. Applications for face recognition range from access control in security systems to human-computer interaction to identification of suspects to search for potential criminals and terrorists: A relevant example include the use of facial recognition technology by the police in Tampa Bay, Florida at Super Bowl XXXV in January 2001, although the effectiveness of such technology was extremely limited [13], while more recent uses are likely much less publicized due to the necessary secrecy involved. Our use case is a system for detecting the presence of known criminals from video streams coming from cameras scattered on the territory. This requires to perform four main steps in sequence: Frame splitting, face detection, face recognition, and result check. 1. Frame splitting consists of separating into frames the video coming from the camera(s), producing one (or more) sequence of images. 2. During face detection, each image of the sequences is analyzed to check whether it contains a face. 3. In case a face is discovered, the recognition phase compares it against a number of known faces, to retrieve the known face most similar to the discovered face. 4. In case the similarity between the discovered face and its most similar known face is sufficiently high, the face is considered as correctly recognized, otherwise it is regarded as an unknown face. For the purpose of suspect identification, whenever a discovered face is sufficiently similar to one of the faces in the knowledge base, an alarm is raised. Figure 4: The experimental environment of datalab, where all use cases were implemented. For face detection, we used the well-known Viola-Jones algorithm [14], while for face recognition a technique exploiting principal component analysis using eigenfaces was exploited [15]. For both alternatives we used implementations provided by the OpenIMAJ library([[http://openimaj.org/](http://openimaj.org/)]([http://openimaj.org/](http://openimaj.org/))). Figure 5 shows a few images taken from the RAM\({}^{\text{S}}\) prototype, where examples of correctly recognized faces and of unknown faces are shown. For each image, the system detects the position of the face and retrieves the most similar face in the knowledge base (\"Response Subject Name\" in each example). If the similarity between the input image and its closest knowledge base image is high enough, then the face is considered recognized (examples (a) and (b)), otherwise the person is considered unknown (examples (c) and (d)). Each example also reports the actual identity of each image (\"Real Subject Name\" field). The effectiveness of RAM\({}^{\text{3}}\)S in reducing the effort required to distribute an application originally conceived for a centralized scenario is confirmed by the number of lines of code required to implement the distributed face recognition system. Originally, every single implementation for Apache Spark, Apache Storm, and Apache Flink required about 170, 150, and 200 lines of code, respectively. By using RAM\({}^{\text{3}}\)S, we built the whole system with only 124 lines of Java code. The benefits of RAM\({}^{\text{3}}\)S are clear:  
**Simplicity:**: The user does not have to directly interface with the code of the three frameworks. **Generality:**: The user is able to choose at runtime which of the three big data platforms she wants to use. **Efficiency:**: The overall number of lines of code is reduced (124 vs. about 500). Using this scenario, we performed an additional experiment comparing the relative performance of Apache Storm and Apache Flink.