<?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 Nisarg Dave on Medium]]></title>
        <description><![CDATA[Stories by Nisarg Dave on Medium]]></description>
        <link>https://medium.com/@nisargdave?source=rss-af07c6d344b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DsFruBKtzMg8jHWxXIH3-w.jpeg</url>
            <title>Stories by Nisarg Dave on Medium</title>
            <link>https://medium.com/@nisargdave?source=rss-af07c6d344b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 02:36:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nisargdave/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[Object Detection case: Data preparation for Deep Neural Networks using computer vision]]></title>
            <link>https://medium.com/@nisargdave/object-detection-case-data-preparation-for-deep-neural-networks-using-computer-vision-7b9754c02a03?source=rss-af07c6d344b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b9754c02a03</guid>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-preparation]]></category>
            <category><![CDATA[deep-neural-networks]]></category>
            <dc:creator><![CDATA[Nisarg Dave]]></dc:creator>
            <pubDate>Sun, 19 Sep 2021 23:02:01 GMT</pubDate>
            <atom:updated>2021-09-19T23:02:01.626Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*S-EUCpMLTWmIwuk-GnLbsw.png" /><figcaption>Object Localization and Data Preparation for DNNs</figcaption></figure><p>In the world of Deep learning and specifically for any deep neural networks the major issue is to create the quality data for model training. For any data science project you need to have the data at first hand. The data should be qualitative and less biased. There are certain things to be considered very precisely before training any model with the data.</p><p>In the real world scenario, for any given problem one might not have the dataset upfront. The data crunching and preparation comes handy with most of these scenarios. After the relevant data collection and logging, the next challenging task is to make data appropriate for model training. As a data scientist, one should always be more careful before starting with the model training. Data should be transformed into appropriate format after the cleaning operation. In case of Deep learning, since we do mostly train neural networks which are essentially data and performance heavy networks. We can not afford to have the wrong and insanely bad model training due to less qualitative data. In case of DNNs, we have to have the proper set of quality data before starting with long due model training.</p><p>Most of the DNN related problem statements suffers with lack of compatible format for the model training. The raw data is not always in the same format as required by the model training mechanism. In my recent experiments, I was trying pretty much same with the healthcare image data. I was developing the Deep Neural Network based real time Object detection method for efficient object scraping using neural nets. The major issue as always was the data preparation before training the model. For this use case and for more specific understanding I will talk about Convolutional Neural networks which are usually useful for the multimedia data formats and responsible for classification and detection tasks!</p><p>Machine learning and Deep learning communities usually consider computer vision as a great partner for DNNs. The reason is pretty obvious and easily understandable that computer vision provides way advanced tools for playing with multimedia data. Now let’s come back to data labelling and preparation that we were talking about. CNNs have different architectures such as GoogleNet, ResNet, AlexNet, DarkNet, and many more! Usually the architectures are pretty much similar with minute differences in between the type and structure of internal layers. The most of the networks relies on specific training data formats to read/input the data while model training.</p><p>Usually for any Object detection task your input to the network is image and location coordinates of objects with the image. There might be more than one object that we are trying to detect. Depending upon use case these might change. In abstract for object detection problem, DNNs are usually supplied with the image file and corresponding text/json object file which contains the object name/class with the location coordinates so neural networks can get what we are trying to make them understand. This is sometimes bigger challenge as one might not have pre-labelled dataset. In my case, we did not have any labelled dataset and since the nature of sensitive healthcare data we might not trust crowdsourced labelling tools. For this type of data preparation and labelling task, computer vision comes to the rescue!</p><p>Basic Idea here is to use the power of OpenCV and computer vision to make the automated data labelling approach which will utilize openCV based automated object detection algorithm to prepare the data for the neural networks. Let’s get into the details to understand it in depth.</p><p>OpenCV — the library written in C++ has way complex and more advanced capabilities to detect complex shapes, structures and morphological features from the multimedia image data. We can detect the polynomial shapes, features and advanced structures using OpenCV based algorithms. In the world of Image processing, you do have more than one approach to accomplish certain task. When it comes to image everything is an array with n dimension. All you have is an array on which you will perform some mathematical operations (usually kernel tricks) to deduce certain understanding of features. First step is always about binarization of an image which means converting the image into the much simpler greyscale format. After converting to greyscale format every-time I use the trick of <strong>thresholding</strong>. Here the matter is straight-forward. For every pixel, the same threshold value is applied as specified. One should choose <strong>Adaptive thresholding</strong> which is highly dependent on each image/data type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*fGbi6Qn6Z-JHr3_ktHbcAw.png" /><figcaption>Image thresholding example</figcaption></figure><p>As you can see that, image thresholding highlights the important features as specified. The next step is about <strong>morphological operations</strong> such as <strong>erosion</strong> and <strong>dilation</strong>. These are really very important magic tricks to isolate, highlight and extract the shape contours. In short: A set of operations that process images based on shapes. Morphological operations apply a <em>structuring element</em> to an input image and generate an output image. Dilation operations consists of convolving an image A with some kernel (B), which can have any shape or size, usually a square or circle. And erosion operation is the sister of dilation. It computes a local minimum over the area of given kernel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*oCXu6Bg5y35A8yn3oiBSUw.jpeg" /><figcaption>Erosion and Dilation example</figcaption></figure><p>each operation has the kernel B which is scanned over the image, we compute the maximal/minimal pixel value overlapped by B and replace the image pixel under the anchor point with that minimal value.</p><p>After this, we will apply the openCV’s most favorite mechanism which is all about finding <strong>contours</strong>. <strong>Contours</strong> can be explained simply as a curve joining all the continuous points (along the boundary), having same color or intensity. The contours are a useful tool for shape analysis and object detection and recognition. In OpenCV, finding contours is like finding white object from black background. So remember, object to be found should be white and background should be black. After the contour approximation we will end up getting the detected contour boundary as shown in the image presented below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*JzT3FGxTSp58MNo8skhP9A.jpeg" /><figcaption>Contour Approximation (Polynomial (left) and Chain simple (right))</figcaption></figure><p>Now, we have our final detected shape such as this rectangle in this case. It might get complex depending upon the different type of object structures. This approach is capable of detecting the objects from rectangles to the very very complex objects such as polygons and even humans. All you need is the proper blend of the morphological operations, shape detectors and contour approximations. We might have to reiterate multiple times in loop to get to the object we are interested in, but surely I would say you can detect almost anything consistently for the object localization problem.</p><p>There are other alternative methods which might blend in for some special and complex cases, such as <strong>canny edge detector</strong>. Canny Edge Detection is a popular edge detection algorithm. It is a multi-stage algorithm which includes noise reduction and removal, finding intensity gradient, applying suppression, and thresholding at the end to filter the features of interest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*5NTBFYyS9a9ol_A5gmn0lg.jpeg" /><figcaption>Edges identified with traditional canny edge detector</figcaption></figure><p>Now after successfully finding all the required objects in the image we will simply dump the identified coordinates of each objects in the text file or json object format. Neural networks usually opt for either of this format. Since this approach can be highly automated to process the batch of same type of images we can perform the data labelling in very efficient and highly automated manner.</p><p>Thanks to the power of MLOps and Data version control (such as <a href="https://dvc.org/"><strong>DVC</strong></a>) we can make the automated runtime within the zsh (or bash scripting) routine to run the thousands of images using this approach to get the associated text files/JSON objects for each of the image’s identified object data. We can use OpenCV to work for us for the data preparation of the DNNs. After successfully preparing labelled training data we can proceed with the model training.</p><p><strong>Conclusion</strong>:</p><p>In short, we can say that OpenCV has built in capabilities of performing object detection, localization, data preparation and data augmentation that is utilized by state of the art deep learning algorithms. Using it with the right blend, we can make it work without incorporating tedious or complex data preparation mechanism. In fact, for simpler object detection we can rely on the OpenCV itself instead of building much complex deep neural networks based models (which aren’t always necessarily great in all use cases).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b9754c02a03" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Version control & machine learning process control using DVC & GitHub]]></title>
            <link>https://medium.com/data-science/data-version-control-machine-learning-process-control-using-dvc-github-c629511e95b5?source=rss-af07c6d344b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/c629511e95b5</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[dvc]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Nisarg Dave]]></dc:creator>
            <pubDate>Wed, 06 Nov 2019 00:17:17 GMT</pubDate>
            <atom:updated>2020-02-06T13:56:44.023Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B3NAZY4D3BN6kPdrATt5Bw.png" /><figcaption>DVC workflow</figcaption></figure><p>Even with all the success we’ve seen today in machine learning (ML), specifically deep learning and its applications in business, the data science community still lacks good practices for organizing their projects and effectively collaborating across their varied ML projects.</p><p>Improving the productivity of machine learning workflow is necessary. As a Data Scientist at <a href="https://groupkdiagnostics.com/">Group K Diagnostics</a>, I deal with the hundreds of gigabytes of data. It is indeed very tough for data scientist to manage and track the data. The data tracking is necessary thing for any data science workflow. The need for data versioning is extreme, thus Data Version control (<a href="https://dvc.org/">https://dvc.org</a>) is very crucial tool for any data scientist. This is very handy and useful tool for your data science projects. The main reasons are,</p><ul><li><strong>DVC tracks ML models and data sets:</strong> DVC is built to make ML models shareable and reproducible.</li><li><strong>ML project version control: </strong>Version control machine learning models, data sets and intermediate files.</li><li><strong>ML experiment management: </strong>Harness the full power of Git branches to try different ideas instead of sloppy file suffixes and comments in code.</li><li><strong>Deployment &amp; Collaboration:</strong> Instead of ad-hoc scripts, use push/pull commands to move consistent bundles of ML models, data, and code into production, remote machines, or a colleague’s computer.</li></ul><p>Major advantage here is that, we can use it with Amazon AWS S3, Microsoft Azure and other data/resource management systems. We can configure those systems to store, read, write and snap data. The setup and usage is very simple,</p><ol><li>Install DVC using, (assuming you have python environment ready)</li></ol><pre>pip install dvc</pre><p>2. Perform the DVC initialization, (assuming you are in Github repository, if not then perform)</p><pre>git init</pre><pre>dvc init</pre><p>3. Now let’s assume that our project has ‘data’ folder which has various data directory (connected &amp; downloaded through AWS S3)</p><pre>├── data   <br>│    ├── exp1<br>│       ├── x1.png<br>│       ├── y1.png<br>│    ├── exp2<br>│       ├── x2.png<br>│       ├── y2.png<br>│    └── exp3<br>│       ├── x3.png<br>│       ├── y3.png<br>│    └── exp4<br>│       ├── x4.png<br>│       ├── y4.png</pre><p>Now after using this data first time, we will perform the following steps.</p><pre>dvc add ./data/exp1 &amp;&amp; git add ./data/exp1.dvc</pre><pre>dvc add ./data/exp2 &amp;&amp; git add ./data/exp2.dvc</pre><pre>dvc add ./data/exp3 &amp;&amp; git add ./data/exp3.dvc</pre><pre>dvc add ./data/exp4 &amp;&amp; git add ./data/exp4.dvc</pre><p>This will create .dvc file for each folder and that file will be committed to GitHub so we know which version of model uses which version of data.</p><p>After this we need to push the dvc changes if we are using remote data storages,</p><pre>dvc push filename </pre><p>This command will push the recent changes and will update the cache, Let’s do,</p><pre>dvc status</pre><p>This will check for any potential change in data, if any then it will track it and we can commit it.</p><p>DVC makes collaboration very easy. Collaborators can set it up in the same way or they can pull up the data with, ‘ dvc pull filename’ command.</p><p>This procedure also works for data versions containing a lot more data than currently persistent in the data folder as dvc stores differences of arbitrary size between different versions in its cache and can therefore recreate older or newer states of the data directories by its checkout command. The checkout is of course also possible in the other direction.</p><p>For more information on commands visit their documentation <a href="https://dvc.org/doc">here</a>.</p><p>For using DVC with Amazon AWS S3, please visit <a href="https://dvc.org/doc/user-guide/external-dependencies">https://dvc.org/doc/user-guide/external-dependencies</a></p><p>The best overall highlights and features are,</p><ol><li>It is Git-compatible! DVC runs on top of any Git repository and is compatible with any standard Git server or provider (GitHub, GitLab, etc). Data file contents can be shared by network-accessible storage or any supported cloud solution. DVC offers all the advantages of a distributed version control system — lock-free, local branching, and versioning.</li><li>It’s storage agnoistic. You can work with S3, Google cloud and Azure.</li><li>It comes with Metric tracking and includes a command to list all branches, along with metric values, to track the progress or pick the best version.</li><li>Language- &amp; framework-agnostic</li><li>Provides end to end support for ML pipeline framework.</li><li>It can track failures!</li><li>It is also compatible with HDFS, Hive &amp; Apache Spark.</li></ol><p>So give it a shot and make your life easy! Click <a href="https://dvc.org/doc/get-started">here</a> to get started! As a Data Scientist, I highly recommend it to each and every data scientist to use it within their ML pipeline.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c629511e95b5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/data-version-control-machine-learning-process-control-using-dvc-github-c629511e95b5">Data Version control &amp; machine learning process control using DVC &amp; GitHub</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Explainable Artificial Intelligence]]></title>
            <link>https://medium.com/@nisargdave/explainable-ai-for-understanding-decisions-data-driven-optimization-in-deep-neural-networks-70b0e947dc18?source=rss-af07c6d344b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/70b0e947dc18</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Nisarg Dave]]></dc:creator>
            <pubDate>Tue, 26 Feb 2019 00:10:31 GMT</pubDate>
            <atom:updated>2019-02-27T00:49:39.279Z</atom:updated>
            <content:encoded><![CDATA[<h3>Explainable AI for Understanding Decisions &amp; Data-Driven Optimization in Deep Neural Networks</h3><p>Data Scientists aren’t sure exactly how deep neural networks (which is a complex system held together by millions of compute nodes) work. Dramatic success in machine learning led the rapid advancement in various technological sectors. The overall effectiveness is still limited because of the lack of explanation interface within those systems. Most of the advance AI-based systems can’t explain their decision and actions. Research led by DARPA XAI program also aims to create the suite of modular AI models which can explain themselves. New machine learning (a field of study of algorithms which learn and improvise from experiences) based AI systems need to have the ability to explain and justify their overall workflow.</p><p>Dr. Timothy Havens, director of the center of data sciences at Michigan Technological University, found a way for understanding the decisions made by an AI system using computational intelligence-the ability of a computer to learn a specific task from data [2] Authors studied the fusion (integrating multiple data sources) solution from data. Authors did minimize the gap between the understanding of the quality of what was learned and how trust- worthy the fusion is for the future data? Using fuzzy measure theory (additive &amp; relational function measure in possibility/belief theory), authors introduced the new data-centric XAI tool for machine learning researchers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*a13KimwrCqj1hUg_O1BZcg.png" /><figcaption><em>Fig 1: XAI Concept [1]</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*j1OR_hlJNxE0DI2GxOL3qQ.png" /><figcaption><em>Fig 2: The Need for Explainable AI [1]</em></figcaption></figure><p>The XAI concept art is shown in Figure 1 &amp; 2, which outline a data science project lifecycle with XAI integration for newly introduced machine learning process.<br>From expert systems to big data, fusion takes plenty of different types of use-cases. Every data has some story, describing the data (aggregated from heterogeneous sources) is the basic need. Deep neural network uses a different kind of data, aggregated from different sources. We are investigating fuzzy measure (additive &amp; relational function measure in possibility/belief theory) based XAI methods for data-driven optimization along with some other existing methodologies.</p><p>The deep neural network on ImageNet was trained for the image classification task. The neural networks with 3–4 different architectures such as GoogleNet, ResNet, AlexNet were used for the fusion. Thanks to the computational intelligence-based solution, fuzzy measures can fuse heterogeneous neural networks on the ImageNet dataset. The approach takes an advantage of effective data aggregation, processing, and optimization by incorporating data-centric measure. These models can even justify whether the new test data is supported by the given experimental data or not. The trust in a system is not certain but the system provides an answer, which is supported and justified by data.</p><p>By leveraging high-performance computing resources available at Michigan Technological University, we can integrate resource-intensive algorithms to enable more sophisticated and fast data processing and model training. By providing more ways to make AI models explain- able and understandable, XAI expands research possibilities for cutting-edge deep learning algorithms.[4] Using different approaches based on XAI, researchers can study all the ’black box’ type systems, more efficiently and easily. These models provide the test bed for validating, testing and explaining the AI models. XAI is also valuable for improving our under- standing of AI’s ability to predict and estimate.[3] By providing the power of understanding context and environment to the machines, we can make many complex AI models more explainable and simple (easy to understand).</p><p><strong>References</strong></p><p>1. Explainable Artificial Intelligence <a href="https://www.darpa.mil/program/explainable-artificial-intelligence">https://www.darpa.mil/program/explainable-artificial-intelligence</a></p><p>2. Explainable AI for Understanding Decisions and Data-Driven Optimization of the Choquet Integral <a href="https://www.researchgate.net/publication/326586154_Explainable_AI_for_Understanding_Decisions_and_Data-Driven_Optimization_of_the_Choquet_Integral">https://www.researchgate.net/publication/326586154_Explainable_AI_for_Understanding_Decisions_and_Data-Driven_Optimization_of_the_Choquet_Integral</a></p><p>3. An approach to explainable deep learning using fuzzy inference <a href="https://www.researchgate.net/publication/316708469_An_approach_to_explainable_deep_learning_using_fuzzy_inference">https://www.researchgate.net/publication/316708469_An_approach_to_explainable_deep_learning_using_fuzzy_inference</a></p><p>4. Holy Grail of AI for Enterprise — Explainable AI (XAI) <a href="https://blog.goodaudience.com/holy-grail-of-ai-for-enterprise-explainable-ai-xai-6e630902f2a0">https://blog.goodaudience.com/holy-grail-of-ai-for-enterprise-explainable-ai-xai-6e630902f2a0</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70b0e947dc18" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>