<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Crime Investigation using Image Data in the times of Big Data in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Crime-Investigation-using-Image-Data-in-the-times-of-Big-Data/m-p/667171#M8349</link>
    <description>&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Social media platforms such as Facebook, WhatsApp and WeChat are wonderful ways to communicate with people all over the world.&lt;BR /&gt;Unfortunately these platforms are also used by criminals which is the reason why crime fighters want to investigate the contents on these platforms.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;While these platforms have stored a lot of metadata which is more or less available (especially for government organizations), the most interesting content is of course the one that is created by the users. This content usually consists of unstructured data such as text, speech, videos and images. In this article I am focusing on the latter, images, but the approach itself can be used for all kinds of unstructured data.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;STRONG class="js ng"&gt;Our task: Enabling efficient ways of investigating image data&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Now, imagine being part of an investigation group of the police that is responsible to fight weapon crimes, right-wing or terroristic organizations.&lt;BR /&gt;You have scraped data from various channels, e.g. Twitter, Facebook, WeChat &amp;amp; Co. and now you’re sitting on a huge pile of images not knowing where to start looking.&lt;BR /&gt;Manually investigating these data sources is impossible, due to their size and variety.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cat.jpeg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46936iB7A581F829D28C2E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cat.jpeg" alt="cat.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Our goal is to provide an efficient way of filtering this data, allowing investigation officers to focus on the relevant images and their sources. This not only saves manual effort but also enables officials to better protect the law.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;STRONG class="js ng"&gt;The idea: Image classification to create additional metadata&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;The idea is simple. We will train an image classification model that is able to classify our images into various categories. So to speak, we generate additional metadata for our images.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;This classification is then combined with other data we already have such as source, date, location, etc.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Finally we want to create an intuitive dashboard that enables investigation officers to quickly identify potentially interesting content and skip through all the nice and funny images of cats. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;As soon as we have the trained model available, the workflow is the following:&lt;/P&gt;
&lt;OL class=""&gt;
&lt;LI id="99eb" class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd ti tj tk aw" data-selectable-paragraph=""&gt;Metadata coming from new Images is directly fed into the analysis environment such as SAS Viya.&lt;/LI&gt;
&lt;LI id="c5fb" class="mi jr cd js b jt tl mk jv tm mm mn tn mp mq to ms mt tp mv kd ti tj tk aw" data-selectable-paragraph=""&gt;Images are scored using our computer vision model&lt;/LI&gt;
&lt;LI id="f932" class="mi jr cd js b jt tl mk jv tm mm mn tn mp mq to ms mt tp mv kd ti tj tk aw" data-selectable-paragraph=""&gt;Classifications and Metadata are combined&lt;/LI&gt;
&lt;/OL&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;The combined data from step 3 is then fed into a visual report allowing crime investigators to perform in-depth analysis.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prcs.jpeg" style="width: 814px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46937i88A1F5D98B2A5174/image-size/large?v=v2&amp;amp;px=999" role="button" title="prcs.jpeg" alt="prcs.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;STRONG class="js ng"&gt;Getting our hands dirty: Training the image classification model&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;I am using the deep learning capabilities of SAS Viya to develop the image classification model. Of course you can develop the model using the SAS programming language but I am more comfortable using Python and Jupyter Notebooks. Luckily there are powerful Python-APIs that allow you to interact with your SAS environment. I am using the following APIs&lt;/P&gt;
&lt;OL class=""&gt;
&lt;LI id="e4f7" class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd ti tj tk aw" data-selectable-paragraph=""&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/sassoftware/python-swat" target="_blank" rel="noopener nofollow"&gt;SAS SWAT&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(communicate with SAS Viya)&lt;/LI&gt;
&lt;LI id="ff45" class="mi jr cd js b jt tl mk jv tm mm mn tn mp mq to ms mt tp mv kd ti tj tk aw" data-selectable-paragraph=""&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/sassoftware/python-dlpy" target="_blank" rel="noopener nofollow"&gt;SAS DLPy&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(special deep learning API for SAS)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;In&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/Mentos05/SAS_DeepLearning/blob/master/Detecting%20Weapons%20on%20Images/Detecting%20Weapons%20on%20Images.ipynb" target="_blank" rel="noopener nofollow"&gt;this Jupyter Notebook&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;you can see how I use transfer-learning to train a ResNet-50 image classification model that afterwards can detect different weapons. The model was pretrained on the ImageNet dataset which contains images from 1000 classes and can be downloaded&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/onnx/models/tree/master/vision/classification/resnet" target="_blank" rel="noopener nofollow"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;There is also a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/Mentos05/SAS_DeepLearning/blob/master/Detecting%20Hate%20Symbols%20on%20Images/Detecting%20Hate%20Symbols%20on%20Images.ipynb" target="_blank" rel="noopener nofollow"&gt;second example&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;where I apply the same process to images from hate symbols such as ISIS flags or swastikas.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;The data used for training comes from two different sources:&lt;/P&gt;
&lt;OL class=""&gt;
&lt;LI id="f41b" class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd ti tj tk aw" data-selectable-paragraph=""&gt;&lt;A class="cz ea nh ni nj nk" href="https://www.kaggle.com/mohamedmaher1997/weapons" target="_blank" rel="noopener nofollow"&gt;Kaggle Weapon Dataset&lt;/A&gt;&lt;/LI&gt;
&lt;LI id="d480" class="mi jr cd js b jt tl mk jv tm mm mn tn mp mq to ms mt tp mv kd ti tj tk aw" data-selectable-paragraph=""&gt;Hate symbols that I scraped from Google Image search by hand&lt;/LI&gt;
&lt;/OL&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Here is an example how my training data looks like for the weapon detection:&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="data.png" style="width: 576px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46938i7011D9A319EC423E/image-size/large?v=v2&amp;amp;px=999" role="button" title="data.png" alt="data.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;The Jupyter Notebook comes with a lot of comments that explain in-depth what I am doing. Therefore I am not going into the details here to keep the article as short as possible.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;After training the model, I evaluated its performance using a confusion matrix. As you can see the predictions are quite accurate with an accuracy of 99%. This seems a little bit too high for me and might be due to the training data being really nice to us. A lot of images have a nice white background which you cannot expect from real social media images. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="confmatr.png" style="width: 576px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46939i1006092E765B0A6B/image-size/large?v=v2&amp;amp;px=999" role="button" title="confmatr.png" alt="confmatr.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;STRONG class="js ng"&gt;Finished? No! A nice model is useless for our investigation officers.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;A lot of articles about Computer Vision end when the model was trained and successfully scored some new data. However if you want your efforts to be useful you also have to think about how to put your models into the bigger picture. While SAS has advanced technology for this, e.g. the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://www.sas.com/en_us/software/model-manager.html" target="_blank" rel="noopener nofollow"&gt;SAS Model Manager&lt;/A&gt;, I am not going into the details of production-ready applications here.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Instead, I’d like to demonstrate how a simple dashboard that uses our model’s predictions could look like. The dashboard was built with standard functionality of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://www.sas.com/en_us/software/visual-analytics.html" target="_blank" rel="noopener nofollow"&gt;SAS Visual Analytics&lt;/A&gt;.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FvP5_XfN0CKo%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DvP5_XfN0CKo&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FvP5_XfN0CKo%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="400" height="225" scrolling="no" title="[Computer Vision] Investigate Images from Social Media to detect Weapons" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;FONT size="2" color="#999999"&gt;Example 1:&amp;nbsp;&lt;SPAN&gt;Investigate Images of Weapons coming from Social Media&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FNvvqvmeFMtM%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DNvvqvmeFMtM&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FNvvqvmeFMtM%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="400" height="225" scrolling="no" title="[Computer Vision] Investigate Images from Social Media to detect Hate Symbols" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;FONT size="2" color="#999999"&gt;Example 2:&amp;nbsp;&lt;SPAN&gt;Detect Hate Symbols on Images coming from Social Media&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;The only interesting part is the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://go.documentation.sas.com/?docsetId=vaobj&amp;amp;docsetTarget=n1tlhkaafz8e77n1xxc6de9iuv59.htm&amp;amp;docsetVersion=8.5&amp;amp;locale=en" target="_blank" rel="noopener nofollow"&gt;“Data-Driven-Content Object”&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;that is responsible for displaying the selected images which you can see on the right side of the reports. This object dynamically receives the data selection from the other report elements. Behind the scenes it is using a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/Mentos05/SAS_DeepLearning/tree/master/Detecting%20Weapons%20on%20Images/Visual%20Analytics%20Image%20Gallery" target="_blank" rel="noopener nofollow"&gt;very simple JavaScript&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;code to retrieve and display the selected images.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;As you can see in the videos our model acts as a supplier of additional metadata. It allows us to use the filter in the top-left corner to select the image categories we are interested in.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;STRONG class="js ng"&gt;This use case does not only apply to crime investigation but is much more general.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Even though this article focused on identifying crime there are of course many other interesting use cases. Another idea could be that you want to identify your brand’s logo or products in social media posts. This way you could for example promote authentic user postings that highlight advantages of your products or you can try to give additional support if it is a customer complaining.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Do you have other use case ideas for this approach? I’d like to hear about them in the comments!&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG class="jg ld"&gt;Michael Gorkow&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;| Data Scientist @ SAS Germany &amp;amp; CV-Enthusiast&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/michael-gorkow-08353678/" target="_self" rel="nofollow noopener noreferrer"&gt;LinkedIn&lt;/A&gt;&amp;nbsp;|&amp;nbsp;&lt;A href="https://github.com/Mentos05/SAS_DeepLearning" target="_self" rel="nofollow noopener noreferrer"&gt;GitHub&lt;/A&gt;&amp;nbsp;|&amp;nbsp;&lt;A href="https://medium.com/@michaelgorkow" target="_self" rel="nofollow noopener noreferrer"&gt;Medium.com&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Jul 2020 13:09:47 GMT</pubDate>
    <dc:creator>mentos05</dc:creator>
    <dc:date>2020-07-06T13:09:47Z</dc:date>
    <item>
      <title>Crime Investigation using Image Data in the times of Big Data</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Crime-Investigation-using-Image-Data-in-the-times-of-Big-Data/m-p/667171#M8349</link>
      <description>&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Social media platforms such as Facebook, WhatsApp and WeChat are wonderful ways to communicate with people all over the world.&lt;BR /&gt;Unfortunately these platforms are also used by criminals which is the reason why crime fighters want to investigate the contents on these platforms.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;While these platforms have stored a lot of metadata which is more or less available (especially for government organizations), the most interesting content is of course the one that is created by the users. This content usually consists of unstructured data such as text, speech, videos and images. In this article I am focusing on the latter, images, but the approach itself can be used for all kinds of unstructured data.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;STRONG class="js ng"&gt;Our task: Enabling efficient ways of investigating image data&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Now, imagine being part of an investigation group of the police that is responsible to fight weapon crimes, right-wing or terroristic organizations.&lt;BR /&gt;You have scraped data from various channels, e.g. Twitter, Facebook, WeChat &amp;amp; Co. and now you’re sitting on a huge pile of images not knowing where to start looking.&lt;BR /&gt;Manually investigating these data sources is impossible, due to their size and variety.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cat.jpeg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46936iB7A581F829D28C2E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cat.jpeg" alt="cat.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Our goal is to provide an efficient way of filtering this data, allowing investigation officers to focus on the relevant images and their sources. This not only saves manual effort but also enables officials to better protect the law.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;STRONG class="js ng"&gt;The idea: Image classification to create additional metadata&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;The idea is simple. We will train an image classification model that is able to classify our images into various categories. So to speak, we generate additional metadata for our images.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;This classification is then combined with other data we already have such as source, date, location, etc.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Finally we want to create an intuitive dashboard that enables investigation officers to quickly identify potentially interesting content and skip through all the nice and funny images of cats. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;As soon as we have the trained model available, the workflow is the following:&lt;/P&gt;
&lt;OL class=""&gt;
&lt;LI id="99eb" class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd ti tj tk aw" data-selectable-paragraph=""&gt;Metadata coming from new Images is directly fed into the analysis environment such as SAS Viya.&lt;/LI&gt;
&lt;LI id="c5fb" class="mi jr cd js b jt tl mk jv tm mm mn tn mp mq to ms mt tp mv kd ti tj tk aw" data-selectable-paragraph=""&gt;Images are scored using our computer vision model&lt;/LI&gt;
&lt;LI id="f932" class="mi jr cd js b jt tl mk jv tm mm mn tn mp mq to ms mt tp mv kd ti tj tk aw" data-selectable-paragraph=""&gt;Classifications and Metadata are combined&lt;/LI&gt;
&lt;/OL&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;The combined data from step 3 is then fed into a visual report allowing crime investigators to perform in-depth analysis.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="prcs.jpeg" style="width: 814px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46937i88A1F5D98B2A5174/image-size/large?v=v2&amp;amp;px=999" role="button" title="prcs.jpeg" alt="prcs.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;STRONG class="js ng"&gt;Getting our hands dirty: Training the image classification model&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;I am using the deep learning capabilities of SAS Viya to develop the image classification model. Of course you can develop the model using the SAS programming language but I am more comfortable using Python and Jupyter Notebooks. Luckily there are powerful Python-APIs that allow you to interact with your SAS environment. I am using the following APIs&lt;/P&gt;
&lt;OL class=""&gt;
&lt;LI id="e4f7" class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd ti tj tk aw" data-selectable-paragraph=""&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/sassoftware/python-swat" target="_blank" rel="noopener nofollow"&gt;SAS SWAT&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(communicate with SAS Viya)&lt;/LI&gt;
&lt;LI id="ff45" class="mi jr cd js b jt tl mk jv tm mm mn tn mp mq to ms mt tp mv kd ti tj tk aw" data-selectable-paragraph=""&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/sassoftware/python-dlpy" target="_blank" rel="noopener nofollow"&gt;SAS DLPy&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(special deep learning API for SAS)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;In&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/Mentos05/SAS_DeepLearning/blob/master/Detecting%20Weapons%20on%20Images/Detecting%20Weapons%20on%20Images.ipynb" target="_blank" rel="noopener nofollow"&gt;this Jupyter Notebook&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;you can see how I use transfer-learning to train a ResNet-50 image classification model that afterwards can detect different weapons. The model was pretrained on the ImageNet dataset which contains images from 1000 classes and can be downloaded&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/onnx/models/tree/master/vision/classification/resnet" target="_blank" rel="noopener nofollow"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;There is also a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/Mentos05/SAS_DeepLearning/blob/master/Detecting%20Hate%20Symbols%20on%20Images/Detecting%20Hate%20Symbols%20on%20Images.ipynb" target="_blank" rel="noopener nofollow"&gt;second example&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;where I apply the same process to images from hate symbols such as ISIS flags or swastikas.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;The data used for training comes from two different sources:&lt;/P&gt;
&lt;OL class=""&gt;
&lt;LI id="f41b" class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd ti tj tk aw" data-selectable-paragraph=""&gt;&lt;A class="cz ea nh ni nj nk" href="https://www.kaggle.com/mohamedmaher1997/weapons" target="_blank" rel="noopener nofollow"&gt;Kaggle Weapon Dataset&lt;/A&gt;&lt;/LI&gt;
&lt;LI id="d480" class="mi jr cd js b jt tl mk jv tm mm mn tn mp mq to ms mt tp mv kd ti tj tk aw" data-selectable-paragraph=""&gt;Hate symbols that I scraped from Google Image search by hand&lt;/LI&gt;
&lt;/OL&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Here is an example how my training data looks like for the weapon detection:&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="data.png" style="width: 576px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46938i7011D9A319EC423E/image-size/large?v=v2&amp;amp;px=999" role="button" title="data.png" alt="data.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;The Jupyter Notebook comes with a lot of comments that explain in-depth what I am doing. Therefore I am not going into the details here to keep the article as short as possible.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;After training the model, I evaluated its performance using a confusion matrix. As you can see the predictions are quite accurate with an accuracy of 99%. This seems a little bit too high for me and might be due to the training data being really nice to us. A lot of images have a nice white background which you cannot expect from real social media images. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="confmatr.png" style="width: 576px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46939i1006092E765B0A6B/image-size/large?v=v2&amp;amp;px=999" role="button" title="confmatr.png" alt="confmatr.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;STRONG class="js ng"&gt;Finished? No! A nice model is useless for our investigation officers.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;A lot of articles about Computer Vision end when the model was trained and successfully scored some new data. However if you want your efforts to be useful you also have to think about how to put your models into the bigger picture. While SAS has advanced technology for this, e.g. the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://www.sas.com/en_us/software/model-manager.html" target="_blank" rel="noopener nofollow"&gt;SAS Model Manager&lt;/A&gt;, I am not going into the details of production-ready applications here.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Instead, I’d like to demonstrate how a simple dashboard that uses our model’s predictions could look like. The dashboard was built with standard functionality of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://www.sas.com/en_us/software/visual-analytics.html" target="_blank" rel="noopener nofollow"&gt;SAS Visual Analytics&lt;/A&gt;.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FvP5_XfN0CKo%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DvP5_XfN0CKo&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FvP5_XfN0CKo%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="400" height="225" scrolling="no" title="[Computer Vision] Investigate Images from Social Media to detect Weapons" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;FONT size="2" color="#999999"&gt;Example 1:&amp;nbsp;&lt;SPAN&gt;Investigate Images of Weapons coming from Social Media&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FNvvqvmeFMtM%3Ffeature%3Doembed&amp;amp;display_name=YouTube&amp;amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DNvvqvmeFMtM&amp;amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FNvvqvmeFMtM%2Fhqdefault.jpg&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube" width="400" height="225" scrolling="no" title="[Computer Vision] Investigate Images from Social Media to detect Hate Symbols" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;FONT size="2" color="#999999"&gt;Example 2:&amp;nbsp;&lt;SPAN&gt;Detect Hate Symbols on Images coming from Social Media&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;The only interesting part is the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://go.documentation.sas.com/?docsetId=vaobj&amp;amp;docsetTarget=n1tlhkaafz8e77n1xxc6de9iuv59.htm&amp;amp;docsetVersion=8.5&amp;amp;locale=en" target="_blank" rel="noopener nofollow"&gt;“Data-Driven-Content Object”&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;that is responsible for displaying the selected images which you can see on the right side of the reports. This object dynamically receives the data selection from the other report elements. Behind the scenes it is using a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="cz ea nh ni nj nk" href="https://github.com/Mentos05/SAS_DeepLearning/tree/master/Detecting%20Weapons%20on%20Images/Visual%20Analytics%20Image%20Gallery" target="_blank" rel="noopener nofollow"&gt;very simple JavaScript&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;code to retrieve and display the selected images.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;As you can see in the videos our model acts as a supplier of additional metadata. It allows us to use the filter in the top-left corner to select the image categories we are interested in.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&lt;STRONG class="js ng"&gt;This use case does not only apply to crime investigation but is much more general.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Even though this article focused on identifying crime there are of course many other interesting use cases. Another idea could be that you want to identify your brand’s logo or products in social media posts. This way you could for example promote authentic user postings that highlight advantages of your products or you can try to give additional support if it is a customer complaining.&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;Do you have other use case ideas for this approach? I’d like to hear about them in the comments!&lt;/P&gt;
&lt;P class="mi jr cd js b jt mj mk jv ml mm mn mo mp mq mr ms mt mu mv kd gu aw" data-selectable-paragraph=""&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG class="jg ld"&gt;Michael Gorkow&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;| Data Scientist @ SAS Germany &amp;amp; CV-Enthusiast&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/michael-gorkow-08353678/" target="_self" rel="nofollow noopener noreferrer"&gt;LinkedIn&lt;/A&gt;&amp;nbsp;|&amp;nbsp;&lt;A href="https://github.com/Mentos05/SAS_DeepLearning" target="_self" rel="nofollow noopener noreferrer"&gt;GitHub&lt;/A&gt;&amp;nbsp;|&amp;nbsp;&lt;A href="https://medium.com/@michaelgorkow" target="_self" rel="nofollow noopener noreferrer"&gt;Medium.com&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 13:09:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Crime-Investigation-using-Image-Data-in-the-times-of-Big-Data/m-p/667171#M8349</guid>
      <dc:creator>mentos05</dc:creator>
      <dc:date>2020-07-06T13:09:47Z</dc:date>
    </item>
  </channel>
</rss>

