# Real-Time Stream Processing in Social Networks with RAM\({}^{3}\)S
## 4 Use Cases
### Printed Text Recognition in Videos  
This use case is presented in the context of Example 2. In particular, we extended RAM3S to automatically extract printed text within video streams. The objective was twofold:  
1. Identifying \"critical\" videos by analyzing and automatically interpreting the streams of a significant data sample.
2. Defining new useful services in the context of monitoring proselytizing phenomena by terrorist groups. Figure 9 shows the implemented steps for automatically extracting printed text from videos:  
1. The first summarization step aims to eliminate all superfluous frames, maintaining only those relevant to the purpose of the final application, thus only key frames in which true information is present are retained. This was obtained with a frame-to-frame analysis, eliminating frames that are too similar to each other. The summarization process exploits the functionalities of the SHIATSU video retrieval tools [19], based on HSV color histograms [20] and the edge change ratio (ECR) [21].
2. When the summary has been obtained, the image analysis phase takes place by considering the selected key frames only. Each image is first filtered to segment text and logos/symbols from the background, then OCR is performed by using the Tesseract library, while logos are extracted using the OpenIMAJ library.
3. Once the text detection phase is over, extracted text and logos are compared with those included in the knowledge base, so as to recognize the ones that have been considered critical.  
Figure 8: Sustainable input rate for Storm and Flink.  
The implementation of this use case in RAM\({}^{3}\)S, which required about 150 lines of code, allowed us to compare the performance of the three underlying big data platforms in analyzing videos. In particular, in order to provide the system with a stable input stream, the summarization step was performed offline (note that this is the less CPU-demanding step among those required in this use case) and only relevant key frames were fed to the RabbitMQ queue. Key frames were extracted from a dataset of about 100 YouTube videos dealing with terrorism and proselytism. The sustainable input rate (computed as in Section 4.3) for Spark, Storm, and Flink is shown in Figure 9(a), while Figure 9(b) shows the speedup, computed as \(S_{n}=IR_{n}/IR_{1}\), where \(IR_{n}\) is the measured sustainable input rate on \(n=1,2,\ldots\) cluster nodes.  
The graphs again confirm results obtained in [9]: Spark performance is the worst among all platforms, while Storm is slightly faster than Flink. Results for Storm and Flink also exhibit a bottleneck when reaching the input rate of 100 images/second: This is again due to the network speed which saturates around 64 Mbit/s (the average size of images in our dataset is 80 KB). As to the speedup achievable when increasing the number of machines, all platforms display a quasi-ideal speedup when the number of nodes is limited (compare with the ideal gray line in Figure 9(b)). When increasing the cluster size, the system scalability begins to diverge from linearity: The system that first presents such behavior is Storm, due to the network bottleneck.  
Figure 9: Printed text recognition in videos use case: Video summarization (**a**); noise filter application (**b**); text recognition (**c**).