<?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: Nikhil Dupally</title>
    <description>The latest articles on DEV Community by Nikhil Dupally (@nikhildupally).</description>
    <link>https://dev.to/nikhildupally</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%2F2918596%2F36ea70a4-35d5-4188-9abb-5b0d6583be69.png</url>
      <title>DEV Community: Nikhil Dupally</title>
      <link>https://dev.to/nikhildupally</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nikhildupally"/>
    <language>en</language>
    <item>
      <title>What Happens When You Click on an App in Android: A Deep Dive</title>
      <dc:creator>Nikhil Dupally</dc:creator>
      <pubDate>Thu, 06 Mar 2025 20:22:29 +0000</pubDate>
      <link>https://dev.to/nikhildupally/what-happens-when-you-click-on-an-app-in-android-a-deep-dive-4dk4</link>
      <guid>https://dev.to/nikhildupally/what-happens-when-you-click-on-an-app-in-android-a-deep-dive-4dk4</guid>
      <description>&lt;h2&gt;
  
  
  What Happens When You Click on an App in Android: A Deep Dive
&lt;/h2&gt;

&lt;p&gt;Have you ever wondered what’s really going on behind the scenes when you tap an app icon on your Android phone? That one simple action sets off a whole chain reaction of processes working together to bring the app to your screen. Let’s take a look at what happens step by step.&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%2Fwm3wf6vusiu9s8ehe30z.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%2Fwm3wf6vusiu9s8ehe30z.png" alt="Android app creation flow" width="800" height="3665"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Launcher Gets to Work
&lt;/h2&gt;

&lt;p&gt;When you tap an app icon, the &lt;strong&gt;Launcher (your home screen app)&lt;/strong&gt; picks up the touch event. Here’s what happens next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Touch Processing:&lt;/strong&gt; The system detects your touch through Android’s input framework and determines which icon was pressed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Intent Creation:&lt;/strong&gt; The launcher creates an Intent that tells the system which app you want to open.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Communicating with the System:&lt;/strong&gt; It sends a request to the &lt;strong&gt;Activity Manager Service (AMS)&lt;/strong&gt; via &lt;strong&gt;Binder IPC&lt;/strong&gt; to start the app.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Checking If the App is Already Running
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Activity Manager Service (AMS)&lt;/strong&gt;, which is part of the Android system, now takes over and decides what to do next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Is the app already open?&lt;/strong&gt; If the app is already running, AMS just brings it to the foreground.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;If not, find the process:&lt;/strong&gt; AMS checks if the app’s process is active.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Starting fresh:&lt;/strong&gt; If the process isn’t running, AMS requests &lt;strong&gt;Zygote&lt;/strong&gt; to start a new instance of the app.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Zygote: The Process Factory
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Zygote&lt;/strong&gt; is a special system process responsible for launching apps efficiently. Here’s what it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Receiving the request:&lt;/strong&gt; Zygote gets a command from AMS via a socket message.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Forking a new process:&lt;/strong&gt; Instead of creating a whole new process from scratch, Zygote forks itself to make a lightweight copy. This saves time and resources.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Starting the Android Runtime (ART):&lt;/strong&gt; The new process is now ready to load the app.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Initializing the App
&lt;/h2&gt;

&lt;p&gt;Now that the app’s process is up and running, the &lt;strong&gt;Android Runtime (ART)&lt;/strong&gt; takes over:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Loading classes and resources:&lt;/strong&gt; The app’s code and assets are loaded into memory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Calling main() method:&lt;/strong&gt; The entry point of the app (ActivityThread.main()) is executed, setting up the main thread and event loop.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Creating the Application object:&lt;/strong&gt; The app’s Application class (defined in AndroidManifest.xml) is instantiated, and onCreate() is called.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Creating and Rendering the First Screen
&lt;/h2&gt;

&lt;p&gt;After the app is initialized, the first activity is launched:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AMS tells the app process to start an activity.&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ActivityThread handles the launch:&lt;/strong&gt; The activity is created, and lifecycle methods (onCreate(), onStart(), onResume()) are executed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rendering the UI:&lt;/strong&gt; The app’s interface is drawn using ViewRootImpl and SurfaceFlinger, which handle OpenGL rendering and sending the image to your screen.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Your App Appears!
&lt;/h2&gt;

&lt;p&gt;The final step is making sure you see the app on your display:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The UI updates sync with the screen’s refresh rate&lt;/strong&gt; using Choreographer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SurfaceFlinger combines all the visual elements&lt;/strong&gt; and sends the final frame to your phone’s display.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Your app is now ready to use! 🎉&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Opening an app on Android may seem instant, but under the hood, it’s a well-orchestrated process involving multiple system components. Understanding this flow can help Android developers optimize app launch times and improve performance.&lt;/p&gt;

&lt;p&gt;Got questions or thoughts? Let’s discuss &lt;a href="http://www.linkedin.com/in/dupally-nikhil" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; 🚀&lt;/p&gt;

</description>
    </item>
    <item>
      <title>JSON vs Protocol Buffers vs FlatBuffers: A Deep Dive</title>
      <dc:creator>Nikhil Dupally</dc:creator>
      <pubDate>Thu, 06 Mar 2025 20:21:17 +0000</pubDate>
      <link>https://dev.to/nikhildupally/json-vs-protocol-buffers-vs-flatbuffers-a-deep-dive-1a2h</link>
      <guid>https://dev.to/nikhildupally/json-vs-protocol-buffers-vs-flatbuffers-a-deep-dive-1a2h</guid>
      <description>&lt;h2&gt;
  
  
  JSON vs Protocol Buffers vs FlatBuffers: A Deep Dive
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Why I Explored These Three?
&lt;/h2&gt;

&lt;p&gt;In today’s fast-paced technological landscape, efficient data serialization is more critical than ever. As developers, we constantly seek ways to optimize our applications for speed and performance. Recently, while working on a project that required handling large volumes of data, I encountered a bottleneck in our data processing pipeline. That’s when I started exploring different data serialization formats and stumbled upon JSON, Protocol Buffers, and FlatBuffers. These three formats offer unique approaches to data serialization, each with its own set of strengths and weaknesses. In this blog post, we’ll delve into the world of JSON, Protocol Buffers, and FlatBuffers, comparing their performance characteristics and exploring their suitability for various use cases. So, if you’re curious to learn about the trade-offs between these popular data serialization formats, join me on this journey as we uncover their secrets and discover which one reigns supreme in the realm of efficient data handling.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Three Serialization Formats
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. JSON (JavaScript Object Notation)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.json.org/json-en.html" rel="noopener noreferrer"&gt;JSON&lt;/a&gt; is the most widely used data interchange format due to its simplicity, readability, and human-friendly syntax. It is text-based and widely supported across programming languages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Easy to read and debug.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Supported in almost every programming language.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No schema enforcement, making it flexible.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cons:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Larger size due to human-readable formatting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Slow parsing speed compared to binary formats.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No built-in support for strong typing.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Protocol Buffers (ProtoBuf)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developers.google.com/protocol-buffers" rel="noopener noreferrer"&gt;Protocol Buffers&lt;/a&gt;, developed by Google, is a compact and efficient binary serialization format designed for high-performance data exchange.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Compact binary format, reducing size significantly compared to JSON.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Faster serialization and deserialization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Strongly typed with schema enforcement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backward and forward compatibility with versioning.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cons:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Requires defining a schema (.proto file) before use.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not human-readable, making debugging harder.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Needs a compiler to generate language-specific code.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. FlatBuffers
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/google/flatbuffers" rel="noopener noreferrer"&gt;FlatBuffers&lt;/a&gt;, also developed by Google, is a highly optimized serialization library designed for scenarios where zero-copy deserialization is required.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pros:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Extremely fast as it allows direct access to serialized data without parsing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Efficient memory usage, avoiding extra allocations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backward and forward compatible.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Supports optional schema evolution like ProtoBuf.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cons:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;More complex API compared to JSON and ProtoBuf.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not as widely supported as JSON.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generates larger binary files than ProtoBuf due to additional metadata.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Benchmarking in Java Using JMH
&lt;/h2&gt;

&lt;p&gt;To get a precise comparison, I used &lt;a href="https://openjdk.org/projects/code-tools/jmh/" rel="noopener noreferrer"&gt;JMH&lt;/a&gt;** (Java Microbenchmark Harness)** to benchmark the serialization and deserialization times of JSON, Protocol Buffers, and FlatBuffers in Java. JMH is designed for benchmarking Java code with precise control over JVM optimizations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benchmark Setup:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Test Data&lt;/strong&gt;: A simple object with multiple fields (integers, strings, nested objects).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Libraries Used&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;JSON: &lt;a href="https://github.com/FasterXML/jackson" rel="noopener noreferrer"&gt;Jackson&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ProtoBuf: &lt;a href="https://developers.google.com/protocol-buffers/docs/javatutorial" rel="noopener noreferrer"&gt;Google’s Protocol Buffers Java library&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;FlatBuffers: &lt;a href="https://google.github.io/flatbuffers/" rel="noopener noreferrer"&gt;Google’s FlatBuffers Java library&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Benchmarking Process&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Serialize the object to a byte array.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deserialize the byte array back into an object.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Measure the time taken for both operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run the benchmarks multiple times to minimize JVM warm-up effects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use different payload sizes to test performance under various conditions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Results&lt;/strong&gt;&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%2Fj9kl5zzg5z65l1db8rld.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%2Fj9kl5zzg5z65l1db8rld.png" width="800" height="542"&gt;&lt;/a&gt;&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%2F9y9xpsz9as3vamecbqbp.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%2F9y9xpsz9as3vamecbqbp.png" width="800" height="542"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Observations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;JSON had the slowest performance due to its text-based format and parsing overhead.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Protocol Buffers significantly outperformed JSON in both serialization and deserialization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;FlatBuffers had the best deserialization performance due to its zero-copy access mechanism.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ProtoBuf had the smallest serialized size, making it ideal for network efficiency.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real-World Use Cases
&lt;/h2&gt;

&lt;h2&gt;
  
  
  When to Use JSON?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When human readability and debugging are important (e.g., REST APIs, configuration files).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When interoperability with multiple systems is required.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When schema enforcement is not critical.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; JSON is widely used in web APIs like OpenWeather API, where readability and ease of use matter more than performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use Protocol Buffers?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When data exchange needs to be compact and fast (e.g., gRPC services, IoT data transfer).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When schema enforcement and strong typing are needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When backward and forward compatibility is essential.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; gRPC-based microservices in large-scale distributed systems, such as in banking or messaging applications, often use ProtoBuf for efficient data transfer.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use FlatBuffers?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When ultra-low latency is required (e.g., game development, real-time applications, high-frequency trading systems).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When zero-copy deserialization is needed for performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When dealing with structured data requiring frequent reads but infrequent writes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Game engines like Unity use FlatBuffers for real-time physics and AI updates because they require fast access to large structured data without parsing overhead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;JSON, Protocol Buffers, and FlatBuffers each serve distinct purposes. JSON is ideal for human-readable data exchange, Protocol Buffers excel in efficient network communication, and FlatBuffers shine in real-time scenarios requiring zero-copy deserialization.&lt;/p&gt;

&lt;p&gt;For my hobby project, I found that while JSON was easy for quick prototyping, switching to ProtoBuf significantly improved performance. If extreme speed was necessary, FlatBuffers would be the best choice. Choosing the right serialization format depends on the specific use case and performance constraints.&lt;/p&gt;

&lt;p&gt;The code can be found in this &lt;a href="https://github.com/NikhilDupally/Serialization-Benchmark" rel="noopener noreferrer"&gt;Github repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Which one do you prefer in your projects? Let’s discuss &lt;a href="http://www.linkedin.com/in/dupally-nikhil" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Leveraging Filter Correlations for Deep Model Compression</title>
      <dc:creator>Nikhil Dupally</dc:creator>
      <pubDate>Thu, 06 Mar 2025 20:16:19 +0000</pubDate>
      <link>https://dev.to/nikhildupally/leveraging-filter-correlations-for-deep-model-compression-2g10</link>
      <guid>https://dev.to/nikhildupally/leveraging-filter-correlations-for-deep-model-compression-2g10</guid>
      <description>&lt;h2&gt;
  
  
  Leveraging Filter Correlations for Deep Model Compression
&lt;/h2&gt;

&lt;p&gt;This Blog is to explain &lt;strong&gt;&lt;em&gt;Leveraging Filter Correlations for Deep Model Compression&lt;/em&gt;&lt;/strong&gt; Paper accepted in &lt;strong&gt;&lt;em&gt;WACV 2020.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Approach&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Iteratively identify pairs of filters with the largest &lt;strong&gt;pairwise correlations&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The model is re-optimized to make the filters in these pairs maximally correlated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After discarding the filters in each round, we further fine tune the model (for smaller number of epochs) to recover from the potential small loss incurred due to the compression.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fevhuiop3jsrpltqltp6v.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%2Fevhuiop3jsrpltqltp6v.png" width="633" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Episode Selection
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;N- pairs&lt;/strong&gt; of filters are selected from each layer with &lt;strong&gt;maximum correlation&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Correlation between filters:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fkq2pemtt27z1eipxuanq.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%2Fkq2pemtt27z1eipxuanq.png" width="441" height="98"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This selected set of filter pairs from all the layers is called &lt;strong&gt;&lt;em&gt;one episode.&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Optimization
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We optimize this cost function with the new regularizer applied to the selected episode.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Our new regularizer (CSt) is as follows:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fsp5fxfee5yeotkzbfman.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%2Fsp5fxfee5yeotkzbfman.png" width="496" height="131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This new regularizer is added to the original cost function so our new objective function is as follows:&lt;/li&gt;
&lt;/ul&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%2Fnp3ze2c5imrkikp7bvj6.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%2Fnp3ze2c5imrkikp7bvj6.png" width="384" height="67"&gt;&lt;/a&gt;&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%2F9fxkwhi6n3n8p8wdn2l0.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%2F9fxkwhi6n3n8p8wdn2l0.png" width="629" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pruning and Fine-Tuning
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;After increasing the correlation between filters in each pair we can prune one filter from each pair.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Our model has a reduced set of the parameter Θ’.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fvujyt6oal1nz27fos342.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%2Fvujyt6oal1nz27fos342.png" width="321" height="59"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Where pi is the set of filters finally selected to be removed from the model.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Further, we fine-tune the model w.r.t. the parameter Θ’.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;[1] .Singh, Pravendra, et al. “Leveraging filter correlations for deep model compression.” &lt;em&gt;The IEEE Winter Conference on Applications of Computer Vision&lt;/em&gt;. 2020.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
