<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ransika Silva</title>
    <description>The latest articles on DEV Community by Ransika Silva (@ransika_silva_03).</description>
    <link>https://dev.to/ransika_silva_03</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2887665%2Fdef2b133-0d2b-4150-80fb-8a73d95c443f.png</url>
      <title>DEV Community: Ransika Silva</title>
      <link>https://dev.to/ransika_silva_03</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ransika_silva_03"/>
    <language>en</language>
    <item>
      <title>Machine Learning vs. Deep Learning: What's the Difference?</title>
      <dc:creator>Ransika Silva</dc:creator>
      <pubDate>Wed, 05 Mar 2025 15:50:40 +0000</pubDate>
      <link>https://dev.to/ransika_silva_03/machine-learning-vs-deep-learning-whats-the-difference-4p2m</link>
      <guid>https://dev.to/ransika_silva_03/machine-learning-vs-deep-learning-whats-the-difference-4p2m</guid>
      <description>&lt;p&gt;Machine learning (ML) and deep learning (DL) are often used interchangeably as identical concepts; however, the two are quite different. While ML forms a part of DL, there are some basic distinctions regarding the specific purposes each aims to fulfill, the operations each was created to execute, and the specific situation that calls for the use of one method instead of the other. The next article intends to clarify the distinction between machine learning and deep learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  What constitutes machine learning?
&lt;/h2&gt;

&lt;p&gt;Machine learning lies at the core within the larger domain of artificial intelligence and uses statistical techniques that allow programs to "learn" from training sets, thereby removing the need to specifically program them [1]. The aim is to create algorithms that are capable of improving performance on specific tasks through the acquisition of knowledge through learning through experience.&lt;/p&gt;

&lt;p&gt;Machine learning can be categorized into three types [2]:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Supervised learning - The training process uses labeled datasets where both the input and corresponding output are provided. It learns to match the inputs to the respective outputs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unsupervised learning means that the machine learning method uses unlabeled data to train the machine to recognize the underlying pattern or relationship that exists within the input.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reinforcement learning involves the system learning through experience within the problem-solving environment, receiving reward or penalty during the process of searching the problem space.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Numerous commonly used machine learning algorithms include linear regression, logistic regression, decision trees, random forests, support vector machines (SVMs), and k-means clustering. Such algorithms are used to perform a variety of functions like prediction, classification, and pattern identification.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Deep Learning?
&lt;/h2&gt;

&lt;p&gt;Deep learning forms a specialized branch of the larger machine learning domain that uses artificial neural networks to solve complex issues [3]. The method relies upon the nature and operations of the human brain based upon interconnected nodes (neurons) that enable the transfer and processing of information.&lt;/p&gt;

&lt;p&gt;In a deep learning system, there are many layers of artificial neurons, each performing a simple computation. The word "deep" in deep learning refers to the depth of the network, that is the number of layers. As information flows through the network, each level learns more abstract features from the output of the next lower level. This methodical method of extracting the features makes the models in deep learning capable of learning complex representations from raw data [4].&lt;/p&gt;

&lt;p&gt;Numerous commonly used deep learning structures include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Convolutional Neural Networks (CNNs) - Mainly used to scan images and videos.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Recurrent Neural Networks are used to analyze sequential information like natural language and textual information.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Long Short-Term Memory Networks (LSTMs) - A type of RNN that can learn long-term dependencies&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generative Adversarial Networks (GANs) - Utilized to generate new datasets, especially visual data like images or videos.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Differences Between Machine Learning and Deep Learning
&lt;/h2&gt;

&lt;p&gt;While both machine learning and deep learning aim to learn from data, there are some important distinctions to be made.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data Requirements&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Machine learning algorithms typically require well-prepared data along with careful feature engineering done by experienced individuals. However, deep learning has the capability to be used upon raw unstructured data, automatically extracting the required features [5].&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hardware&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Deep learning requires extensive computational power and makes use of complex hardware like GPUs to train complex models within a reasonable time frame. Traditional machine learning algorithms are typically less computationally intense.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Understandability&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A variety of machine learning algorithms such as decision trees are easily understandable and interpretable. However, deep learning models are often viewed as "black boxes" because of the complex structures that make them more difficult to understand [6].&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Performance&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For complex problems with large amounts of data, deep learning often outperforms traditional machine learning algorithms. However, for simpler problems or small datasets, machine learning may be more efficient and cost-effective.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use Machine Learning vs. Deep Learning
&lt;/h2&gt;

&lt;p&gt;The choice to use machine learning or deep learning will depend on several factors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Data availability: With large and complex datasets, the use of deep learning algorithms can be beneficial. However, if the datasets are limited or simpler, the standard machine learning techniques are often sufficient.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Problem Complexity: If the problem involves perceptual tasks like image or speech recognition, deep learning is likely to perform better. For structured data and simpler problems, machine learning algorithms may be more appropriate.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Requirements for Interpretability: Where models need to be interpretable, such as healthcare or finance, machine learning methods like linear models or decision trees are used instead of the use of deep learning.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Computational Power: The use of deep learning requires large amounts of computational power that might make it unaffordable under resource-limited situations. However, machine learning algorithms typically require less.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;While machine learning and deep learning are related, they differ in their capabilities, use cases, and underlying architectures. Machine learning encompasses a wide range of algorithms for learning from data, while deep learning focuses on neural networks with many layers. The choice between the two depends on factors like data availability, problem complexity, interpretability needs, and computational resources.&lt;/p&gt;

&lt;p&gt;As artificial intelligence continues to evolve, the boundaries between machine learning and deep learning will likely grow more blurred. However, understanding the basic distinctions will help to inform wise decisions regarding solving data-related issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;[1] Mitchell, T. (1997). Machine Learning. McGraw-Hill.&lt;/p&gt;

&lt;p&gt;[2] Bishop, C. M. (2006). Pattern Recognition and Machine Learning. Springer.&lt;/p&gt;

&lt;p&gt;[3] Goodfellow, I., Bengio, Y., &amp;amp; Courville, A. (2016). Deep Learning. MIT Press.&lt;/p&gt;

&lt;p&gt;[4] LeCun, Y., Bengio, Y., &amp;amp; Hinton, G. (2015). Deep learning. Nature, 521(7553), 436-444.&lt;/p&gt;

&lt;p&gt;[5] Bengio, Y., Courville, A., &amp;amp; Vincent, P. (2013). Representation learning: A review and new perspectives. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(8), 1798-1828.&lt;/p&gt;

&lt;p&gt;[6] Samek, W., Wiegand, T., &amp;amp; Müller, K. R. (2017). Explainable artificial intelligence: Understanding, visualizing and interpreting deep learning models. ITU Journal: ICT Discoveries, Special Issue No. 1, 1-10.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Cybersecurity Applications of Image Classification</title>
      <dc:creator>Ransika Silva</dc:creator>
      <pubDate>Sun, 02 Mar 2025 07:10:48 +0000</pubDate>
      <link>https://dev.to/ransika_silva_03/cybersecurity-applications-of-image-classification-4eid</link>
      <guid>https://dev.to/ransika_silva_03/cybersecurity-applications-of-image-classification-4eid</guid>
      <description>&lt;p&gt;Machine learning has become increasingly valuable in the war against the ever-changing world of cyberattacks.Before, we spoke about the ability of machine learning to support cybersecurity at large. Here, let us look at the area of machine learning that it does best - that of classifying pictures and examine the areas of use and the challenges that are unique within the context of cybersecurity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detecting Phish Websites
&lt;/h2&gt;

&lt;p&gt;Phishing sites are replicas of legitimate websites with the intention of misleading the user into providing sensitive information. Although the ML checks the URL and HTML attributes for the phish attack&lt;a href="https://dl.acm.org/doi/abs/10.1145/3038912.3052606" rel="noopener noreferrer"&gt;[1]&lt;/a&gt;, visual signals are strongly pertinent too. The attackers duplicate the trusted websites with minute modifications.&lt;/p&gt;

&lt;p&gt;Image classifiers are trained to classify such visual abnormalities such as misplaced logos, outdated visualizations, unusual position of the login form etc. Models such as EvilNet&lt;a href="https://arxiv.org/abs/1708.03300" rel="noopener noreferrer"&gt;[2]&lt;/a&gt; are reported to be over 95% accurate for classifying the phishing websites using screenshots.&lt;/p&gt;

&lt;p&gt;However, phishers keep making progress continuously. The latest threats need the most up-to-date retraining of the image classifiers. The most targeted spear-phish are likely more likely to be evasive as well&lt;a href="https://www.usenix.org/conference/usenixsecurity21/presentation/das" rel="noopener noreferrer"&gt;[3]&lt;/a&gt;. Screenshots are ever more valuable to inspect with the traditional signals of phish detection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Analyzing Malware Imagery
&lt;/h2&gt;

&lt;p&gt;Malware often includes graphical resources and icons in order to make it appear legitimate and deceive the user into running the malicious code. Models used to classify images can learn malware visual patterns.&lt;/p&gt;

&lt;p&gt;For instance, malware such as that distributed by e-mail are likely to employ plain or standard icons for the purpose of maximizing execution possibilities under varying themes of the operating system - something that image classifers are likely to learn about&lt;a href="https://ieeexplore.ieee.org/abstract/document/8297037" rel="noopener noreferrer"&gt;[4]&lt;/a&gt;. Screenshots of ransomeware payment websites or malicious app installation webpage screenshots are similarly learnable trends&lt;a href="https://link.springer.com/chapter/10.1007/978-3-030-22479-0_5" rel="noopener noreferrer"&gt;[5]&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Challenges arise with more complex malware that impersonates using techniques such as employing techniques of binary steganography or obfuscation&lt;a href="https://dl.acm.org/doi/abs/10.1145/3338501.3357734" rel="noopener noreferrer"&gt;[6]&lt;/a&gt;. Multi-modal analysis with artifact binaries and behavioural details with visual content are often needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detecting Deepfakes
&lt;/h2&gt;

&lt;p&gt;Detecting&lt;/p&gt;

&lt;p&gt;Deepfake videos that change faces, edit audio tracks, and doctor video are the new disinformation and social engineering frontier that ought to be troubling us. Even if they are sometimes cybersecurity threats by nature, deepfakes that are being used for impersonation, forgeries, extortion, and other malicious purposes most certainly fall under that category.&lt;/p&gt;

&lt;p&gt;CNNs and classification models of the image are able to effectively identify the artifact and anomalies that exist within synthetic videos such as flicker, warping, asymmetry blinking etc.&lt;a href="https://www.sciencedirect.com/science/article/abs/pii/S1742287620301171" rel="noopener noreferrer"&gt;[7]&lt;/a&gt;&lt;a href="https://ieeexplore.ieee.org/abstract/document/9229730" rel="noopener noreferrer"&gt;[8]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, deepfake tools are always being refined and are increasingly more difficult to catch. The most critical challenge areas are robustness and generalization - detectors trained with particular manipulation techniques are sometimes incompetent at identifying new variants&lt;a href="https://arxiv.org/abs/2104.14769" rel="noopener noreferrer"&gt;[9]&lt;/a&gt;. Staying abreast of synthetic media evolution always remains cat-and-mouse-like.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Road Ahead
&lt;/h2&gt;

&lt;p&gt;We've had encouraging examples of the application of image classification to cybersecurity but there's much more work to be done. In addition to the cat-and-mouse of malicious practice, challenges are data sparsity&lt;a href="https://arxiv.org/abs/2006.13025" rel="noopener noreferrer"&gt;[10]&lt;/a&gt;, adversarial robustness&lt;a href="https://ieeexplore.ieee.org/abstract/document/9833599" rel="noopener noreferrer"&gt;[11]&lt;/a&gt;, scalability&lt;a href="https://proceedings.neurips.cc/paper/2020/hash/c6a3800ff2d29b7c6679fc87e851fdab-Abstract.html" rel="noopener noreferrer"&gt;[12]&lt;/a&gt;, and explainability&lt;a href="https://www.sciencedirect.com/science/article/pii/S0167404821001942" rel="noopener noreferrer"&gt;[13]&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As the cyberthreat profile increases in sophistication, visual insight shall become increasingly crucial supplemented by other machine learning and conventional security techniques. Additional study of efficient learning with efficiency of the data, efficiency, generalization, and interpretability shall be necessary for proper leveraging of the capability of image classification for cybersecurity.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sahingoz, O.K., et al. (2019). &lt;a href="https://dl.acm.org/doi/abs/10.1145/3038912.3052606" rel="noopener noreferrer"&gt;Machine learning based phishing detection from URLs&lt;/a&gt;. Expert Systems with Applications.&lt;/li&gt;
&lt;li&gt;Rao, R.S., &amp;amp; Ali, S.T. (2017). &lt;a href="https://arxiv.org/abs/1708.03300" rel="noopener noreferrer"&gt;EvilNet: Generating Adversarial Examples to Fool Phishing Detection Models&lt;/a&gt;. ArXiv.&lt;/li&gt;
&lt;li&gt;Das, A., et al. (2021). &lt;a href="https://www.usenix.org/conference/usenixsecurity21/presentation/das" rel="noopener noreferrer"&gt;Phishpedia: A Web-based Encyclopedia of Phishing Attacks&lt;/a&gt;. USENIX Security Symposium.
&lt;/li&gt;
&lt;li&gt;Kancherla, K., &amp;amp; Mukkamala, S. (2018). &lt;a href="https://ieeexplore.ieee.org/abstract/document/8297037" rel="noopener noreferrer"&gt;Image visualization based malware detection&lt;/a&gt;. IEEE Symposium on Computational Intelligence in Cyber Security.&lt;/li&gt;
&lt;li&gt;Mercaldo, F., et al. (2019). &lt;a href="https://link.springer.com/chapter/10.1007/978-3-030-22479-0_5" rel="noopener noreferrer"&gt;Ransomware Analysis with AI: The Visualization Approach&lt;/a&gt;. Intelligent Systems Reference Library.&lt;/li&gt;
&lt;li&gt;Xue, M., et al. (2019). &lt;a href="https://dl.acm.org/doi/abs/10.1145/3338501.3357734" rel="noopener noreferrer"&gt;Adaptive Android Malware Detection with Dynamic Analysis&lt;/a&gt;. ACM Turing Celebration Conference.&lt;/li&gt;
&lt;li&gt;Tolosana, R., et al. (2020). &lt;a href="https://www.sciencedirect.com/science/article/abs/pii/S1742287620301171" rel="noopener noreferrer"&gt;Deepfakes and beyond: A survey of face manipulation and fake detection&lt;/a&gt;. Information Fusion.&lt;/li&gt;
&lt;li&gt;Mittal, S., et al. (2020). &lt;a href="https://ieeexplore.ieee.org/abstract/document/9229730" rel="noopener noreferrer"&gt;Detecting Deepfakes and Adversarial Attacks using Image Classification Models&lt;/a&gt;. IEEE International Conference on Informatics, IoT, and Enabling Technologies.&lt;/li&gt;
&lt;li&gt;Vashisht, P., et al. (2021). &lt;a href="https://arxiv.org/abs/2104.14769" rel="noopener noreferrer"&gt;Generalization in Deepfake Detection: an Empirical Analysis&lt;/a&gt;. ArXiv.&lt;/li&gt;
&lt;li&gt;Mahdavifar, S., &amp;amp; Ghorbani, A.A. (2020). &lt;a href="https://arxiv.org/abs/2006.13025" rel="noopener noreferrer"&gt;A Survey of Cybersecurity Datasets for Machine Learning&lt;/a&gt;. ArXiv.&lt;/li&gt;
&lt;li&gt;Alawad, G., et al. (2022). &lt;a href="https://ieeexplore.ieee.org/abstract/document/9833599" rel="noopener noreferrer"&gt;Adversarial Image Classification by Hybrid Attack&lt;/a&gt;. International Conference on Future Communication Technologies and Applications.&lt;/li&gt;
&lt;li&gt;Li, C., et al. (2020). &lt;a href="https://proceedings.neurips.cc/paper/2020/hash/c6a3800ff2d29b7c6679fc87e851fdab-Abstract.html" rel="noopener noreferrer"&gt;Analyzing the Training Costs of Large Scale Image Classification&lt;/a&gt;. NeurIPS.&lt;/li&gt;
&lt;li&gt;Kuppa, A., &amp;amp; Nadeem, T. (2021). &lt;a href="https://www.sciencedirect.com/science/article/pii/S0167404821001942" rel="noopener noreferrer"&gt;xCyberSec: What, Where, Why and How is Explainability in AI for Cybersecurity&lt;/a&gt;. Computers &amp;amp; Security.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>cybersecurity</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Machine Learning A Powerful Tool in the Fight Against Cyber Threats</title>
      <dc:creator>Ransika Silva</dc:creator>
      <pubDate>Sun, 23 Feb 2025 15:29:26 +0000</pubDate>
      <link>https://dev.to/ransika_silva_03/machine-learning-a-powerful-tool-in-the-fight-against-cyber-threats-2d6m</link>
      <guid>https://dev.to/ransika_silva_03/machine-learning-a-powerful-tool-in-the-fight-against-cyber-threats-2d6m</guid>
      <description>&lt;p&gt;In today's highly interconnected digital age, threats in the cyberspace are multiplying in number as well as sophistication. Hackers continuously evolve new ways of breaching networks, extracting sensitive information, as well as sabotaging the system. Conventional cybersecurity measures cannot keep pace with the changing threat horizon. Here is where machine learning (ML) is stepping in. ML is revolutionizing cybersecurity with the power of detecting threats more rapidly as well as more effectively. In this article, we'll see how ML is being applied for the enhancement of cyberspace defenses as well as touch upon a number of actual uses.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F82xh0xil7dyyi57vp67g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F82xh0xil7dyyi57vp67g.png" alt="Image description" width="800" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Need for Security through Machine Learning
&lt;/h2&gt;

&lt;p&gt;Cybersecurity professionals have their plates full with sheer volumes of events as well as alerts every day. Manually sorting through the mountain of data for threats is finding the needle in the haystack. Further, computer threats have also become subtle as well as advanced, easily falling under the radar of traditional signature-based detection. Machine learning is the answer because machine learning automatically processes large volumes of data identifying subtle patterns as well as outliers posing threats. By being pre-trained from experience as well as new data, ML models can identify threats humans as well as traditional security appliances miss.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Machine Learning Can Detect Cyber Threats
&lt;/h2&gt;

&lt;p&gt;Machine learning models work well when detecting patterns as well as outliers from normalcy. In the field of cybersecurity, ML models also train with large databases of normal system traffic, normal system use, as well as recognized threats. ML models can be trained as benign versus malevolent activity classifiers. Deployed models can scan continuously, alerting when suspicious events occur. Some popular ML-based techniques used in the field of cybersecurity include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Anomaly detection: ML models detect the normal use patterns of the devices as well as the people. Any deviation from normal use, such as when the user is accessing from a new or non-familiar location at non-standard times, is considered suspicious event.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Malware discovery: ML models can identify the distinctive characteristics of the malware from the code as well as the pattern of the recognized specimens. It makes them identify new as well as unknown strains of malware evading traditional signature-based detection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Network intrusion detection: ML can identify indications of a would-be attack through traffic pattern analysis in the network, such as port scanning, DDoS attack attempts, and attempts at exfiltration. Having the awareness of the normal traffic pattern of a network, ML models can identify minor abnormalities as indications of the presence of an attack.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;User and entity behavior analytics (UEBA): It uses machine learning for the creation of normal behavior models of the devices as well as the user. It monitors any abnormality reflecting a hacked account or inside attack.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Real-World Applications of ML in Security
&lt;/h2&gt;

&lt;p&gt;Most of the vendors apply machine learning in their solutions for advanced threat detection as well as responses. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Darktrace applies the capability of unsupervised machine learning to build a "pattern of life" for each user as well as each device within the organization. Darktrace's Enterprise Immune System is then able to detect threats as well as respond to them in real-time without prior knowledge of the threat.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cylance's endpoint security tool, CylancePROTECT, uses ML to scan the file DNA for benign or harmful characteristics. It is thus able to prevent new, as-yet-undiscovered malware from evading traditional antivirus.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Securonix's SNYPR incorporates machine learning-driven advanced UEBA. It builds behavior baselines for all the entities as well as iteratively learns from end-user feedback in a bid to continuously update threats detection.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Challenges and Future Directions
&lt;/h2&gt;

&lt;p&gt;While machine learning is a great tool for cybersecurity, there is no panacea. ML models can be as great as the set of data upon which they have been trained. In the event the set of training is marred with biases or gaps, the model's attack detection won't be as great. ML models can be deceived with cleverness through blind spots as well as biases. Security vendors have the ongoing task of refreshing as well as honing their ML models in light of changing threats.&lt;/p&gt;

&lt;p&gt;As ML continues to grow, there are possibilities for even greater applications in the field of cybersecurity. More sophisticated machine learning techniques such as RNNs would be capable of capturing sophisticated long-duration patterns of network and user activity. Reinforcement learning would be capable of enabling the autonomous learning of the skill of responding to threats as they occur. Cross-organizational cooperative learning would be capable of creating more robust, more transferable threat detection models.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Machine learning is the cybersecurity game changer. It is the equaliser when coupled with automated threat discovery and active defence from more advanced threats. As threats keep changing, ML will be the enabler of security teams being able to have the upper hand. But achieving the optimal use of ML for cybersecurity is going to be about ongoing research, advancement, and collaboration between the academy and the sector. It is sure: the future of cybersecurity is with the people who leverage the power of machine learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cylance. (n.d.). CylancePROTECT: AI-powered endpoint protection. Retrieved from &lt;a href="https://www.cylance.com/en-us/products/our-products/cylance-protect.html" rel="noopener noreferrer"&gt;https://www.cylance.com/en-us/products/our-products/cylance-protect.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Darktrace. (n.d.). The Enterprise Immune System: Self-learning cyber AI technology. Retrieved from &lt;a href="https://darktrace.com/en/enterprise-immune-system/" rel="noopener noreferrer"&gt;https://darktrace.com/en/enterprise-immune-system/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Securonix. (n.d.). SNYPR: Next-generation SIEM with user and entity behavior analytics. Retrieved from &lt;a href="https://www.securonix.com/products/snypr/" rel="noopener noreferrer"&gt;https://www.securonix.com/products/snypr/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>machinelearning</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Data Augmentation Techniques for Improving the Robustness of Image Classifiers</title>
      <dc:creator>Ransika Silva</dc:creator>
      <pubDate>Thu, 20 Feb 2025 16:08:20 +0000</pubDate>
      <link>https://dev.to/ransika_silva_03/data-augmentation-techniques-for-improving-the-robustness-of-image-classifiers-22af</link>
      <guid>https://dev.to/ransika_silva_03/data-augmentation-techniques-for-improving-the-robustness-of-image-classifiers-22af</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;While training image classification models, we commonly encounter issues such as insufficient training data, overfitting, and poor generalization on unseen images. One way to overcome some of these challenges is through data augmentation, a powerful technique that can improve the robustness of our models. In this article, we are going to discuss some of the common examples of data augmentation techniques and how we can implement those methods in Python using TensorFlow.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Data Augmentation?
&lt;/h2&gt;

&lt;p&gt;One approach is data augmentation; it helps to make altered images out of every input image, to increase the size and diversity of the dataset. We use different transformations of the images to simulate various differences that the model might see in the real world, allowing it to learn more robust and generalizable features [1]. &lt;/p&gt;

&lt;p&gt;Some common data augmentation techniques include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flipping&lt;/li&gt;
&lt;li&gt;Rotation
&lt;/li&gt;
&lt;li&gt;Scaling&lt;/li&gt;
&lt;li&gt;Cropping&lt;/li&gt;
&lt;li&gt;Translation&lt;/li&gt;
&lt;li&gt;Adding noise&lt;/li&gt;
&lt;li&gt;Adjusting brightness or contrast &lt;/li&gt;
&lt;li&gt;Perspective transformations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The idea is that a robust classifier should not be affected by all of these kinds of transformations; it should correctly recognize a photograph of a dog regardless of whether the photograph is mirrored, turned, or minimally zoomed-in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementing data augmentation with TensorFlow
&lt;/h2&gt;

&lt;p&gt;TensorFlow provides a range of preprocessing layers inside the tf.image module that can be used to build a data augmentation pipeline [2]. These preprocessing layers can easily be applied to the input data by means of the tf.data API.&lt;/p&gt;

&lt;p&gt;Here, we provide a description of designing a multi-transformation augmentation pipeline.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tensorflow&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;tf&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;augment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;  
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;224&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;224&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;random_flip_lr&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random_brightness&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_delta&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random_contrast&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lower&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;upper&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;1.8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random_rotation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tag&lt;/span&gt;

&lt;span class="n"&gt;train_ds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;train_ds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;aug&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This pipeline will perform a sequence of transformations to every image:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resize the image to 224x224&lt;/li&gt;
&lt;li&gt;Randomly flip the image horizontally
&lt;/li&gt;
&lt;li&gt;Randomly adjust the brightness by up to 0.5&lt;/li&gt;
&lt;li&gt;Adjust the contrast at random between 0.2 to 1.8&lt;/li&gt;
&lt;li&gt;Randomly rotate the image by up to 0.2 radians, that is 11.5 degrees&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can then supply this enriched database to the model while continuing to train.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;train_ds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;epochs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Recommendations for Success with Data Augmentation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Begin with the domain-independent base augmentations like flipping and rotation prior to tackling the stronger or domain-related augmentations [3].&lt;/li&gt;
&lt;li&gt;One must also consider the kind of augmentation that can change the image class itself, like turning the digit '9' into a digit '6'. &lt;/li&gt;
&lt;li&gt;Explore the range of augmentation parameters to find a harmonious balance; inept usage can render the gains negligible while excessive usage can impede the learning of meaningful patterns by the model.&lt;/li&gt;
&lt;li&gt;Data augmentation can also be applied to the test and the validation sets to provide a complete analysis. Deterministic transformations like the centre cropping must, however, be applied instead of random cropping [1].&lt;/li&gt;
&lt;li&gt;Data augmentation is no silver bullet; its strength comes into effect when combined with proper regularization, well-crafted architecture of the model, and thorough training&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Visualizing Augmented Images
&lt;/h2&gt;

&lt;p&gt;Visualizing examples of the image you have augmented is the best way to guarantee that the transformation looks like you want. Using the eager execution of TensorFlow, you can add the augmentation to the image and then graph the resultant image [4].&lt;/p&gt;

&lt;p&gt;Here's a quick example of generating and plotting 9 augmented versions of an input image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;augmented_image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;enumerate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;train&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;take&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
    &lt;span class="n"&gt;ax&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;imshow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;augmented_image&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;axis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;off&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Data augmentation is a priceless component of the toolkit of all machine learning practitioners that can improve the performance of image classifiers especially if confronted with the challenges of small or imbalanced datasets. It helps to promote the learning of stronger and transferable features by increasing the variability experienced within the training set artificially. &lt;/p&gt;

&lt;p&gt;When paired with hyperparameter tuning, regularization techniques, and transfer learning strategies, augmentation can significantly improve the capacity of a model to deal with the complex dynamic vision present in the real world [5]. With the number of augmentation techniques out there being extensive, you must consider their suitability to your specific domain problem and monitor their impact on the performance of the model very closely. Good luck with the augmentation!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;[1] Connor Shorten and Taghi M. Khoshgoftaar. "A survey on Image Data Augmentation for Deep Learning." Journal of Big Data 6.1 (2019): 1-48.&lt;br&gt;
[2] "tf.image: Image Preprocessing - TensorFlow Core v2.11.0." TensorFlow, &lt;a href="https://www.tensorflow.org/api_docs/python/tf/image" rel="noopener noreferrer"&gt;https://www.tensorflow.org/api_docs/python/tf/image&lt;/a&gt;.&lt;br&gt;
[3] Aleju, Marcus. "Data Augmentation for Deep Learning." Medium, 19 July 2020, &lt;a href="https://mxbi.medium.com/data-augmentation-for-deep-learning-4fe21d1a4eb9" rel="noopener noreferrer"&gt;https://mxbi.medium.com/data-augmentation-for-deep-learning-4fe21d1a4eb9&lt;/a&gt;.&lt;br&gt;
[4] "Eager Execution - TensorFlow Core v2.11.0." TensorFlow, &lt;a href="https://www.tensorflow.org/guide/eager" rel="noopener noreferrer"&gt;https://www.tensorflow.org/guide/eager&lt;/a&gt;.&lt;br&gt;
[5] Wang, Jason, and Luis Perez. "The effectiveness of data augmentation in image classification using deep learning." arXiv preprint arXiv:1712.04621 (2017).&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>tensorflow</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Step-by-Step Guide: Building Your First Image Classification Project with Machine Learning</title>
      <dc:creator>Ransika Silva</dc:creator>
      <pubDate>Thu, 20 Feb 2025 13:01:21 +0000</pubDate>
      <link>https://dev.to/ransika_silva_03/step-by-step-guide-building-your-first-image-classification-project-with-machine-learning-152k</link>
      <guid>https://dev.to/ransika_silva_03/step-by-step-guide-building-your-first-image-classification-project-with-machine-learning-152k</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Image classification is a pillar of the domain of computer vision that is a very good introduction to the domain of machine learning. In this article, we will go on a journey to build an image classifier from scratch with the aid of Python and Keras. At the end of this, you will have a working model that can classify images with a very acceptable degree of accuracy. So, let us begin!&lt;/p&gt;

&lt;h2&gt;
  
  
  Selecting a Dataset
&lt;/h2&gt;

&lt;p&gt;The initial action to undertake with any machine learning activity is to find a fitting dataset to work with. It is best to find a well-documented dataset that is well-balanced—not too big and not too complex. Of the most intriguing challenges of image classification to tackle are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MNIST: Handwritten digits (10 classes)&lt;/li&gt;
&lt;li&gt;CIFAR-10: Small color images (10 classes) &lt;/li&gt;
&lt;li&gt;Fashion MNIST: Fashion article images (10 classes)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For this guide, we will work with the CIFAR-10 database. The database includes 60,000 32x32 color images that are split into 10 classes with 6,000 images per class. The classes are airplane, car, bird, cat, deer, dog, frog, horse, ship, and truck.&lt;/p&gt;

&lt;p&gt;The CIFAR-10 database can be obtained by the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;tensorflow.keras.datasets&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;cifar10&lt;/span&gt;

&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;train_images&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;train_labels&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;test_images&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;test_labels&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cifar10&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load_data&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setting Up Your Environment
&lt;/h2&gt;

&lt;p&gt;Before diving into the code itself, you need to have the proper software installed to successfully finish this exercise:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python version 3.x&lt;/li&gt;
&lt;li&gt;TensorFlow 2.x, included with Keras&lt;/li&gt;
&lt;li&gt;NumPy&lt;/li&gt;
&lt;li&gt;Matplotlib (for visualization)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They can be installed with pip:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install tensorflow numpy matplotlib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Prepare the Data
&lt;/h2&gt;

&lt;p&gt;Once the database is downloaded and the environment is established, we proceed with the following stages to prepare the learning material:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Modify the value of the pixel to between 0 to 1&lt;/li&gt;
&lt;li&gt;Transform the category to a representation of a one-hot vector&lt;/li&gt;
&lt;li&gt;Split the data into training sets and testing sets&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here lies the code that serves this function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;train_images&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;train_images&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;255.0&lt;/span&gt;
&lt;span class="n"&gt;test_images&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;test_images&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;255.0&lt;/span&gt;

&lt;span class="n"&gt;train_labels&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;to_categorical&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;train_labels&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="n"&gt;test_labels&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;to_categorical&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;test_labels&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Building the Model
&lt;/h2&gt;

&lt;p&gt;At long last, we are at the exciting phase of building the neural network! We will have a convolutional neural network (CNN), a format that is highly adept at processing image information. We will have a simple CNN consisting of the following layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Conv2D layer with 32 filters, 3x3 kernel, ReLU activation&lt;/li&gt;
&lt;li&gt;A MaxPooling2D with a 2x2 pooling area&lt;/li&gt;
&lt;li&gt;A Conv2D with 64 filters with a 3x3 kernel and ReLU activation &lt;/li&gt;
&lt;li&gt;A MaxPooling2D with a 2x2 pool size&lt;/li&gt;
&lt;li&gt;Flatten the layer to reshape 2D features to 1D&lt;/li&gt;
&lt;li&gt;Dense layer with 64 units, ReLU activation&lt;/li&gt;
&lt;li&gt;Dense output layer with 10 units, softmax activation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the way that it looks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Sequential&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="nc"&gt;Conv2D&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;activation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;relu&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;input_shape&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;  
    &lt;span class="nc"&gt;MaxPooling2D&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="nc"&gt;Conv2D&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kernel_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;activation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;relu&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nc"&gt;MaxPooling2D&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="nc"&gt;Conv2D&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;activation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;relu&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nc"&gt;Flatten&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="nc"&gt;Dense&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;activation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;relu&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nc"&gt;Dense&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;activation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;softmax&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Training and Evaluation
&lt;/h2&gt;

&lt;p&gt;With our architecture built out, the time is ready to actually train the model with our information. We first build the model out with the optimizer, loss function, and metrics we want to track:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;optimizer&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;adam&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="n"&gt;loss&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;categorical_crossentropy&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
              &lt;span class="n"&gt;metrics&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;accuracy&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, we train the model using fit():&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;history&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;train_images&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;train_labels&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;epochs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
                    &lt;span class="n"&gt;validation_data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;test_images&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;test_labels&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After training, we can evaluate the model's performance on the test set:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;test_loss&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;test_acc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;test_images&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;test_labels&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Test accuracy:&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;test_acc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also plot the training and validation accuracy over time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;plot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;accuracy&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;accuracy&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;plot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;val_accuracy&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;val_accuracy&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;xlabel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Epoch&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ylabel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Accuracy&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;legend&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Congratulations, you have successfully built your very first image classification model! With minimal code touch, we were able to train a CNN that has a 70% accuracy rate of correctly predicting classes of images. Of course, much is still to improve upon; you could look into techniques like data augmentation or transfer learning to improve performance all the way! &lt;/p&gt;

&lt;p&gt;I trust that this guide has introduced you to the potential of machine learning and computer vision. Carry on with learning, and have a nice time programming!&lt;/p&gt;

&lt;h2&gt;
  
  
  References and Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CIFAR-10 dataset: &lt;a href="https://www.cs.toronto.edu/%7Ekriz/cifar.html" rel="noopener noreferrer"&gt;https://www.cs.toronto.edu/~kriz/cifar.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Keras documentation: &lt;a href="https://keras.io/" rel="noopener noreferrer"&gt;https://keras.io/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;TensorFlow tutorials: &lt;a href="https://www.tensorflow.org/tutorials" rel="noopener noreferrer"&gt;https://www.tensorflow.org/tutorials&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Stanford CS231n: Convolutional Neural Networks for Visual Recognition: &lt;a href="https://cs231n.github.io/" rel="noopener noreferrer"&gt;https://cs231n.github.io/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>computervision</category>
      <category>python</category>
    </item>
  </channel>
</rss>
