<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Faruk SARI on Medium]]></title>
        <description><![CDATA[Stories by Faruk SARI on Medium]]></description>
        <link>https://medium.com/@faruk.sari?source=rss-68204645eb5d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pgIGuiXSbcHst881d7h_0Q.png</url>
            <title>Stories by Faruk SARI on Medium</title>
            <link>https://medium.com/@faruk.sari?source=rss-68204645eb5d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 07:31:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@faruk.sari/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Automated Data Augmentation: A Beginner’s Guide to Smarter Model Training]]></title>
            <link>https://medium.com/@faruk.sari/automated-data-augmentation-a-beginners-guide-to-smarter-model-training-56c46682bb67?source=rss-68204645eb5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/56c46682bb67</guid>
            <dc:creator><![CDATA[Faruk SARI]]></dc:creator>
            <pubDate>Wed, 16 Sep 2026 16:23:44 GMT</pubDate>
            <atom:updated>2026-09-16T16:23:44.133Z</atom:updated>
            <content:encoded><![CDATA[<p>How to let machine learning choose the best image transformations for your dataset — step by step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*M_lIcHO7ZKIbgna0QH4oGw.jpeg" /><figcaption>A diagram showing an original image of a cat transformed into multiple augmented versions — rotated, zoomed, brightened, and flipped — with arrows pointing to a neural network.</figcaption></figure><h3>Introduction</h3><p>If you’ve ever trained a deep learning model, you’ve probably heard the phrase “you need more data.” But collecting and labeling thousands (or millions) of images is expensive and time-consuming. That’s where data augmentation comes in.</p><p>Data augmentation is a technique that artificially expands your training dataset by applying realistic transformations to existing images — rotations, flips, zooms, brightness changes, and more. This helps your model generalize better and reduces over-fitting.</p><p>But here’s the catch: choosing <em>which</em> augmentations to apply, and <em>how much</em> to apply them, is usually a manual, trial-and-error process. Automated data augmentation solves this problem by using machine learning to <em>learn</em> the best augmentation policies for your specific dataset.</p><p>In this blog post, I’ll walk you through automated data augmentation step by step. No prior experience needed — just curiosity.</p><h3>What Is Data Augmentation?</h3><p>Before diving into automation, let’s make sure we’re on the same page.</p><p>Imagine you’re teaching a child to recognize dogs. You show them pictures of dogs from the front, the side, in bright sunlight, in dim light, running, and sitting. The more varied the examples, the better they recognize dogs in real life.</p><p>Data augmentation does the same thing for neural networks. Instead of showing the model the same image over and over, you show it slightly modified versions. Common transformations include:</p><ul><li>Geometric: rotation, translation, zoom, flip, shear</li><li>Color: brightness, contrast, saturation, hue</li><li>Noise: Gaussian noise, blur</li><li>Occlusion: random erasing, cutout</li></ul><p>These transformations are “realistic” — they don’t change the label of the image. A rotated cat is still a cat. A slightly brighter cat is still a cat.</p><p>In TensorFlow, you can apply these transformations on-the-fly using Keras pre-processing layers:</p><pre>import tensorflow as tf<br><br>data_augmentation = tf.keras.Sequential([<br>    tf.keras.layers.RandomFlip(&quot;horizontal&quot;),<br>    tf.keras.layers.RandomRotation(0.1),<br>    tf.keras.layers.RandomZoom(0.1),<br>    tf.keras.layers.RandomBrightness(0.1),<br>])</pre><p>This pipeline applies a random combination of transformations to each image during training.</p><h3>Why Automate Data Augmentation?</h3><p>Manual augmentation has two big problems:</p><ol><li>You have to guess. Which transformations work best for your dataset? How strong should they be? A rotation of 10° or 45°? Brightness of 0.1 or 0.3? Finding the right combination can take weeks of experimentation.</li><li>It’s dataset-specific. A policy that works great for handwritten digits (MNIST) might fail for satellite imagery or medical X-rays.</li></ol><p>Automated data augmentation solves both problems by learning the optimal augmentation policy directly from your data. Instead of guessing, you let an algorithm search for the best combination of operations, probabilities, and magnitudes.</p><h3>The Two Main Approaches to Automation</h3><p>There are two broad categories of automated augmentation:</p><h3>1. Reinforcement Learning–Based Search (AutoAugment)</h3><p>AutoAugment, developed by Google researchers, treats augmentation policy search as a reinforcement learning problem.</p><p>How it works:</p><ul><li>Define a search space of possible augmentation policies. Each policy is a sequence of operations (e.g., rotate, shear, translate) with associated probabilities and magnitudes.</li><li>A controller (a recurrent neural network) samples a policy.</li><li>Train a child model with that policy and measure validation accuracy.</li><li>Use the accuracy as a reward signal to update the controller.</li><li>Repeat until the controller converges on the best policy.</li></ul><p>The result is a learned policy — a set of sub-policies that can be transferred to similar datasets. For example, a policy learned on ImageNet achieved state-of-the-art accuracy on Stanford Cars without fine-tuning.</p><h3>2. Parameter-Free / Random Search (RandAugment)</h3><p>RandAugment simplifies the idea dramatically. Instead of learning a policy through reinforcement learning, it uses a fixed set of augmentations and randomly samples operations with a uniform probability. You only need to tune two hyperparameters: the number of operations (N) and the magnitude (M).</p><p>This makes RandAugment much cheaper computationally while still achieving competitive results. It’s a great starting point if you want automated augmentation without the complexity of policy search.</p><h3>Step-by-Step: Implementing Automated Augmentation</h3><p>Let’s walk through a practical implementation using TensorFlow.</p><h3>Step 1: Install Dependencies</h3><pre>pip install --user tensorflow-datasets==4.9.2</pre><h3>Step 2: Load and Pre-process Your Data</h3><p>python</p><pre>import tensorflow as tf<br>import tensorflow_datasets as tfds<br><br># Load a dataset (e.g., CIFAR-10)<br>(ds_train, ds_test), ds_info = tfds.load(<br>    &#39;cifar10&#39;,<br>    split=[&#39;train&#39;, &#39;test&#39;],<br>    shuffle_files=True,<br>    as_supervised=True,<br>    with_info=True,<br>)<br><br>def normalize_img(image, label):<br>    return tf.cast(image, tf.float32) / 255.0, label<br><br>ds_train = ds_train.map(normalize_img, num_parallel_calls=tf.data.AUTOTUNE)<br>ds_train = ds_train.cache().shuffle(1000).batch(64).prefetch(tf.data.AUTOTUNE)</pre><h3>Step 3: Build a Basic Augmentation Pipeline</h3><p>python</p><pre>data_augmentation = tf.keras.Sequential([<br>    tf.keras.layers.RandomFlip(&quot;horizontal&quot;),<br>    tf.keras.layers.RandomRotation(0.1),<br>    tf.keras.layers.RandomZoom(0.1),<br>])<br><br># Apply augmentation inside the training loop<br>ds_train = ds_train.map(<br>    lambda x, y: (data_augmentation(x, training=True), y),<br>    num_parallel_calls=tf.data.AUTOTUNE<br>)</pre><h3>Step 4: Use RandAugment for Automated Policy</h3><p>TensorFlow provides a built-in RandAugment class in tfm.vision.augment. Here&#39;s how to use it:</p><p>python</p><pre>from official.vision.ops import augment<br><br># Create a RandAugment layer<br>rand_augment = augment.RandAugment(num_layers=2, magnitude=10)<br><br># Apply it to your dataset<br>ds_train = ds_train.map(<br>    lambda x, y: (rand_augment.distort(x), y),<br>    num_parallel_calls=tf.data.AUTOTUNE<br>)</pre><p>The num_layers parameter controls how many augmentations are applied sequentially (typically 2–3), and magnitude controls the strength (typically 5–15).</p><h3>Step 5: Train Your Model</h3><p>python</p><pre>model = tf.keras.Sequential([<br>    tf.keras.layers.Conv2D(32, 3, activation=&#39;relu&#39;, input_shape=(32, 32, 3)),<br>    tf.keras.layers.MaxPooling2D(),<br>    tf.keras.layers.Conv2D(64, 3, activation=&#39;relu&#39;),<br>    tf.keras.layers.MaxPooling2D(),<br>    tf.keras.layers.Flatten(),<br>    tf.keras.layers.Dense(128, activation=&#39;relu&#39;),<br>    tf.keras.layers.Dropout(0.5),<br>    tf.keras.layers.Dense(10, activation=&#39;softmax&#39;),<br>])<br><br>model.compile(<br>    optimizer=&#39;adam&#39;,<br>    loss=tf.keras.losses.SparseCategoricalCrossentropy(),<br>    metrics=[&#39;accuracy&#39;]<br>)<br><br>model.fit(ds_train, epochs=20, validation_data=ds_test)</pre><h3>Visualizing the Effect</h3><p>Below is an example of what automated augmentation looks like in practice. The original image (left) is transformed into multiple variants using RandAugment with different random policies.</p><p>Original . | . Augmented 1 . | . Augmented 2 . | . Augmented 3<br>🐱 . . . . . . . . . . . 🐱↻ . . . . . . . . . 🐱🔍 . . . . . . . . 🐱☀️</p><p>Each augmented image retains the core identity (a cat) but varies in rotation, zoom, and brightness. This diversity forces the model to learn robust features rather than memorizing exact pixel patterns.</p><h3>Best Practices for Automated Augmentation</h3><ol><li>Start with RandAugment. It’s simple, effective, and doesn’t require a search phase. Tune num_layers and magnitude first.</li><li>Validate visually. Always inspect a batch of augmented images. If they look unrealistic (e.g., a flipped digit 6 becoming a 9), your model will learn wrong patterns.</li><li>Don’t over-augment. Too many transformations can destroy the semantic content of an image. Balance diversity with realism.</li><li>Use GPU-accelerated libraries. For large datasets, consider libraries like Kornia or DALI that run augmentations on GPU.</li><li>Transfer learned policies. If you have a small dataset, try a policy learned on a larger, similar dataset (e.g., ImageNet → CIFAR-10). AutoAugment policies often transfer well.</li></ol><h3>Conclusion</h3><p>Automated data augmentation is a powerful technique that takes the guesswork out of one of the most important steps in deep learning. Whether you use reinforcement learning–based AutoAugment or the simpler RandAugment, you can train more robust models with less data and less manual effort.</p><p>The key takeaway: let the algorithm find the best augmentations for your data, and focus your time on model architecture and problem framing.</p><h3>Resources</h3><ul><li><a href="https://arxiv.org/abs/1805.09501">AutoAugment: Learning Augmentation Policies from Data</a></li><li><a href="https://arxiv.org/abs/1909.13719">RandAugment: Practical automated data augmentation with a reduced search space</a></li><li><a href="https://www.tensorflow.org/tutorials/images/data_augmentation">TensorFlow Data Augmentation Tutorial</a></li><li><a href="https://www.tensorflow.org/api_docs/python/tf/image">tf.image Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56c46682bb67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why AlexNet Changed Computer Vision]]></title>
            <link>https://medium.com/@faruk.sari/why-alexnet-changed-computer-vision-e764b069ed49?source=rss-68204645eb5d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e764b069ed49</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[alexnet]]></category>
            <category><![CDATA[relu]]></category>
            <dc:creator><![CDATA[Faruk SARI]]></dc:creator>
            <pubDate>Fri, 11 Sep 2026 14:38:58 GMT</pubDate>
            <atom:updated>2026-09-11T14:38:58.623Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*arJJYgK-_7VcuKKX1TCKMA.png" /><figcaption>Figure: The AlexNet architecture, showing the split across two GPUs.</figcaption></figure><h3><strong>Introduction</strong></h3><p>In 2012, AlexNet changed the course of computer vision. It won the ImageNet competition by a decisive margin, but its real significance was larger than a single benchmark result: it showed that a deep convolutional neural network, trained on large-scale data and accelerated by GPUs, could outperform systems built around hand-crafted features. Before this breakthrough, object recognition pipelines typically depended on engineered features such as SIFT or HOG, and datasets were still modest in size. ImageNet, by contrast, contained more than 15 million labeled high-resolution images across 22,000 categories. That scale created both an opportunity and a challenge: models needed far greater capacity to learn useful representations, yet they also needed strong inductive biases to prevent overfitting and make learning feasible.</p><p>Convolutional neural networks were a promising idea, but applying them at scale to large images was computationally expensive. Krizhevsky, Sutskever, and Hinton’s 2012 paper showed that these barriers could be overcome. AlexNet was not just a more accurate model; it was evidence that deep learning could work in practice at industrial scale.</p><h3><strong>The problem AlexNet was solving</strong></h3><p>Before AlexNet, most computer vision systems relied on feature engineering. Researchers manually designed detectors and descriptors intended to capture edges, gradients, textures, and shapes. These methods worked reasonably well for small datasets and narrow tasks, but they struggled to generalize when the visual world became more varied and more complex.</p><p>ImageNet changed the landscape. Its size and diversity made it possible to train models that learned features directly from raw pixels rather than relying on hand-designed priors. But learning from such data required a model with enough depth and capacity to capture hierarchical structure in images, while still being efficient enough to train within realistic hardware limits.</p><p>AlexNet provided a concrete answer to that challenge.</p><h3><strong>What made AlexNet different?</strong></h3><p>The model used an eight-layer CNN: five convolutional layers and three fully connected layers. It was trained on the 1.2 million training images from ILSVRC-2010, with a final 1000-way softmax classifier. In total, the network had roughly 60 million parameters and 650,000 neurons (more precisely, activations). The key point was not merely the architecture’s size, but the fact that it was trained in a way that made large-scale deep learning feasible.</p><p><strong>ReLU activations</strong></p><p>One of the most important design choices was the activation function. AlexNet replaced traditional saturating nonlinearities such as tanh and sigmoid with Rectified Linear Units (ReLUs):</p><blockquote>f(x)=max⁡(0,x)</blockquote><p>This simple change had a major effect. ReLUs trained several times faster than saturating activations, which made it practical to train a much larger network. Without this speedup, the large model would have been difficult to optimize in a reasonable time.</p><p><strong>Multiple GPUs</strong></p><p>At the time, GPUs had limited memory. A single GTX 580 only had 3 GB of VRAM, far too little for a full large-scale CNN. To work around this, the authors split the network across two GPUs. Each GPU handled half of the kernels, with communication only at certain layers. This allowed the model to scale beyond what a single GPU could support and was a crucial engineering step in making the experiment feasible.</p><p>The authors also reported that this arrangement improved performance. Compared with a one-GPU network with half the kernels, the split-GPU version reduced top-1 and top-5 error rates by 1.7% and 1.2%, respectively.</p><p><strong>Local response normalization</strong></p><p>AlexNet also used local response normalization after ReLU activations. The idea was inspired by the concept of lateral inhibition: neurons compete with nearby neurons for activation, which encourages more diverse and informative features. In the paper, this normalization step reduced top-1 and top-5 error by 1.4% and 1.2%, respectively.</p><p><strong>Overlapping pooling</strong></p><p>The pooling layers used overlapping windows, where the stride was smaller than the pooling kernel size. This small but important design choice slightly reduced error and helped make training more stable. Although the improvement was modest compared with the gains from ReLU or dropout, it added another piece of evidence that even small architectural choices mattered in deep networks.</p><h3><strong>Training and regularization</strong></h3><p>The model was trained using stochastic gradient descent with momentum, weight decay, and a carefully tuned learning rate schedule. But the paper also relied on several regularization techniques that are now standard in modern deep learning.</p><p><strong>Data augmentation</strong></p><p>AlexNet artificially expanded the dataset by randomly cropping images and horizontally flipping them. This encouraged the model to learn invariances and made it more robust to small shifts and changes in orientation.</p><p><strong>Dropout</strong></p><p>Dropout was applied to the first two fully connected layers with a rate of 0.5. This randomly deactivated units during training, preventing co-adaptation and reducing overfitting. In a model with so many parameters, this was essential for generalization.</p><h3><strong>Results</strong></h3><p>The performance gains were striking. On the ILSVRC-2010 test set, AlexNet achieved top-1 and top-5 error rates of 37.5% and 17.0%, which was considerably better than the previous state-of-the-art. In the 2012 ImageNet competition, a variant of the model won with a top-5 error rate of 15.3%, compared with 26.2% for the second-best entry — a gap of nearly 11 percentage points.</p><p>The paper also included ablation studies to isolate the contribution of each major design choice. Removing even a single convolutional layer hurt performance, demonstrating that depth mattered. Similarly, local response normalization improved accuracy, overlapping pooling gave a small but consistent boost, and dropout proved crucial for reducing overfitting in the fully connected layers, which contained most of the model’s parameters.</p><h3><strong>Why AlexNet mattered</strong></h3><p>The researchers concluded that a large, deep CNN trained on a massive dataset with efficient GPU implementation could dramatically outperform traditional computer vision pipelines. More importantly, the paper showed that representation learning — letting a model discover useful features from raw pixels — could outperform hand-engineering, especially in complex visual tasks.</p><p>AlexNet mattered because it proved something larger than a single model architecture: it showed that deep learning could scale. The bottleneck was no longer just the quality of hand-designed features; it was the size of the dataset, the power of the hardware, and the ability to train large models effectively. In other words, the field had crossed a threshold.</p><h3><strong>Personal notes</strong></h3><p>Reading this paper, I am struck by how many of its ideas have become standard practice in deep learning today: ReLU activations, dropout, data augmentation, GPU acceleration, and overlapping pooling. The decision to split the network across two GPUs was a practical necessity rather than a design preference, and it feels almost quaint in hindsight — today, frameworks like PyTorch handle multi-GPU training with a single line of code.</p><p>What stands out most is the scale of the experiment. Training for five to six days on two GTX 580 GPUs to achieve a result that reshaped the field is a reminder of how much the hardware and software ecosystem has changed. The paper’s clarity and the fact that the code was released publicly also set a benchmark for open science in machine learning.</p><p>AlexNet is still relevant not just because it won an image challenge, but because it changed the basic assumptions of the field. It turned CNNs from an interesting idea into the foundation of modern computer vision, and in doing so, it helped define the deep learning era.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e764b069ed49" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>