<?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 Harasis Singh on Medium]]></title>
        <description><![CDATA[Stories by Harasis Singh on Medium]]></description>
        <link>https://medium.com/@harasis123?source=rss-55bb2ed40f34------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VCyKPLMVMs5tKXCdGhUIyA.jpeg</url>
            <title>Stories by Harasis Singh on Medium</title>
            <link>https://medium.com/@harasis123?source=rss-55bb2ed40f34------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 00:23:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harasis123/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[Lambda(), Map(), Filter() functions in Python]]></title>
            <link>https://medium.com/analytics-vidhya/lambda-map-filter-functions-in-python-4c03679dd747?source=rss-55bb2ed40f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c03679dd747</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[function]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[filter-function]]></category>
            <category><![CDATA[lambda-function]]></category>
            <dc:creator><![CDATA[Harasis Singh]]></dc:creator>
            <pubDate>Fri, 02 Oct 2020 20:41:33 GMT</pubDate>
            <atom:updated>2020-10-19T13:08:07.174Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ycK77J1-iNmMCZSu.jpg" /></figure><p>A function is a block of code that only runs when it is called.</p><p>We can pass data, known as parameters, into a function.</p><p>A function can return data as a result.</p><h4>Lambda() Function-</h4><ul><li>Lambda function mainly used to create a function without a name</li><li>It is mainly used with <strong>filter()</strong> and <strong>map()</strong> functions.</li><li>It can receive any number of arguments, but can only have one expression.</li></ul><p><strong><em>How to use Lambda()-</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*5Tv_rLQKvKbscgL5x62qNA.png" /></figure><p><strong><em>Another Example-</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*E0B22QPsmO4H31eXVtnIug.png" /></figure><p><strong><em>Code that takes 2 inputs from the user and multiplies them using lambda-</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*lt-cD5GKS1Da3QMu8F8VkA.png" /></figure><h3>MAP() Function-</h3><ul><li>The Map() function takes a <strong>function</strong> and a <strong>list</strong> as input.</li><li>Map() performs an operation on the entire list and return the result in a new list</li><li>Syntax- map(function/lambda, list)</li></ul><p><strong><em>Here’s how we can use map()-</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*hd743Ovpv8LvJEe4sgbNWg.png" /></figure><p><strong><em>Map() can be used with lambda -</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*atFklneu5QfTc6i6kgSidw.png" /></figure><p><strong><em>Write a function that takes an argument and returns its cubic value.</em></strong></p><p><strong><em>Define a list of integers ranging from -10 to 10.</em></strong></p><p><strong><em>Apply the function to the entire list and generate a new output list.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*h2HYOdSdppu2qOEfNkHeOw.png" /></figure><h3>Filter() Function-</h3><ul><li>Filter() is used to create a list of elements for which a function returns <strong>“True”.</strong></li><li>Syntax- filter( function that returns True, list)</li></ul><p><strong><em>Here&#39;s how we can use filter()-</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kN6Ybhc-XQvBKTpuQdHsRg.png" /></figure><p><strong><em>Write a code that takes the range from the user (ie upper and lower bound) and returns a list of positive and even numbers only-</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*Hwc8PkGkNhGmB6qmoDPFDA.png" /></figure><p><em>I hope this article will help in understanding these functions in python.</em></p><p><em>Thank you and Have a nice day!!!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c03679dd747" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/lambda-map-filter-functions-in-python-4c03679dd747">Lambda(), Map(), Filter() functions in Python</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Logistic Regression in Machine Learning]]></title>
            <link>https://medium.com/analytics-vidhya/logistic-regression-in-machine-learning-71fa3249223c?source=rss-55bb2ed40f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/71fa3249223c</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[logistic-regression]]></category>
            <dc:creator><![CDATA[Harasis Singh]]></dc:creator>
            <pubDate>Wed, 23 Sep 2020 20:24:51 GMT</pubDate>
            <atom:updated>2020-09-24T12:55:20.310Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/725/0*xZtE4dJG4QGnLXfS.png" /></figure><p>Logistic Regression is a technique that can be used for traditional statistics as well as machine learning.</p><p>Logistic Regression is similar to Linear Regression except Logistic Regression predicts whether something is <strong>True or False</strong>, instead of predicting something continuous like the size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/0*_dwv87KyXFdOu_I6" /></figure><p>Also, instead of fitting line to the data , Logistic Regression fits an <strong>“S” </strong>shaped logistic finction.</p><p>The curve goes from 0 to 1, ie the curve tells us the probability of that specific point on the curve.</p><p>Logistic Regression generally used for <strong>Classification.</strong></p><p>Just like Linear Regression, logistic regression can work with <strong>continuous data</strong> (like weight and age) and <strong>discrete data</strong> (like genome and astrological sign).</p><p>Logistic Regression uses <strong>Maximum Likelyhood Estimation (MLE) </strong>to fit the line. MLE is a technique used for estimating the parameters of a given distribution, using some observed data.</p><ul><li>It calculate the likelihoods of all the points and then multiply all those likelihoods together. That is the likelihood of the data given this line.</li><li>Then you shift the line and calculate a new likelihood of the data and then again shift the line and calculate likelihood again and again…</li><li>finally the curve with the maximum likelihood is selected.</li></ul><h4>Use of Sigmoid Function in Logical Regression-</h4><p>The reason we choose a <strong>sigmoid function</strong> to model classification problems solved with <strong>logistic regression</strong> is that we want to make sure that predicted value has a defined range (ie between 0 to 1) which aids us in differentiating the classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*HVz9VHdi-Wl79EP5MknEWA.png" /></figure><blockquote>Y = 1 / 1+e -z</blockquote><p>So, if the value of z goes to positive infinity then the predicted value of y will become 1 and if it goes to negative infinity then the predicted value of y will become 0. And if the outcome of the sigmoid function is more than 0.5 then we classify that label as class 1 or positive class and if it is less than 0.5 than we can classify it to negative class or label as class 0.</p><h4>Difference Between Linear Regression and Logistic Regression-</h4><ol><li>Linear Regression fits the<strong> line </strong>to the data whereas Logistic Regression fits as <strong>“S” shaped logistic/sigmoid funtion.</strong></li><li>Linear Regression is good for predicting <strong>continuous output</strong> like salary, housing prices etc. whereas Logistic Regression is used for <strong>classification</strong> problems which predicts a probability range between 0 to 1.</li><li>With Linear Regression we fit the line using ‘<strong>least squares’, </strong>in other words we find the line that minimizes the sum of the squares of the residuals whereas Logistical Regression uses <strong>Maximum Likelihood Estimation (MLE) </strong>to fit the line.</li><li>In Linear Regression we can also use residuals to calculate <strong>R² </strong>to compare simple models to complicated models. whereas, in Logistic Regression there is <strong>no concept of residuals</strong> so we can’t calculate R².</li></ol><h4>Summary of Logistic Regression-</h4><ul><li>Logistic Regression can be used to classify samples.</li><li>It can use different types of data (like size, genome) to do the classification</li><li>It can be used to assess which variables are useful for classifying samples.</li></ul><p>I hope that you like my short article about Logistic Regression.</p><p>Thank you!!!!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71fa3249223c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/logistic-regression-in-machine-learning-71fa3249223c">Logistic Regression in Machine Learning</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Diabetes Prediction ML model using Flask and Docker]]></title>
            <link>https://medium.com/@harasis123/deploying-a-diabetes-prediction-ml-model-using-flask-and-docker-4982d5e6ea74?source=rss-55bb2ed40f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/4982d5e6ea74</guid>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ngrok]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[support-vector-machine]]></category>
            <dc:creator><![CDATA[Harasis Singh]]></dc:creator>
            <pubDate>Sat, 19 Sep 2020 20:58:26 GMT</pubDate>
            <atom:updated>2020-09-19T20:58:26.931Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*GoPSmN5IqjevIeSrKh_Juw.png" /></figure><p>Often a software application deployed on one platform will not run in another platform because of software environment differences.</p><p>Containers solve that problem by creating a controlled environment to run the application separate from the host machine’s environment. The container contains a particular operating system image and a specific version of each software package that is known to work with an application at a given point in time.</p><p>Docker is an application that allows the developer to generate containers that are easily built and can be shared across different platforms.</p><p><strong>In this, we will be creating a docker container in which we will implement a Web Application(API) of the machine learning model using flask and Linux environment.</strong></p><h3>Task 1- Prepare the Machine Learning Model</h3><p>The dataset we are going to use comes from the National Institute of Diabetes and Digestive and Kidney Diseases and contains anonymized diagnostic measurements for a set of female patients. We will train a <strong>support vector machine</strong> to predict whether a new patient has diabetes based on such measurements.</p><h4>Support Vector Machines-</h4><p><em>The objective of the support vector machine algorithm is to find a hyperplane in N-dimensional space(N — the number of features) that distinctly classify the data points.</em></p><h4>Working of SVM-</h4><ol><li>Start with data in a relatively less dimension.</li><li>Move the data to a higher dimension.</li><li>Find the Support Vector Classifier that seperates the higher dimensional data into 2 groups.</li></ol><p>SVM uses <strong>Kernel Functions</strong> to systematically find <strong>Support Vector Classifier</strong> in higher dimension</p><blockquote>Detailed Code with step-wise explanation- <a href="https://github.com/Harasis/ML-Projects/blob/master/Medical%20Diagnosis%20using%20Support%20Vector%20Machines/Medical%20Diagnosis%20using%20Support%20Vector%20Machines.ipynb">Medical Diagnosis using Support Vector Machines.ipynb</a>.</blockquote><p>Once we got the desired accuracy we will save our model as well as the scaler object using pickle and joblib libraries.</p><h3>Task 2- Use flask to create a web application(API)</h3><p><strong>Flask</strong> is an API of <strong>Python</strong> that allows us to build up web-applications. It was developed by Armin Ronacher.</p><p>A Web-Application Framework or Web Framework is the collection of modules and libraries that helps the developer to write applications without writing the low-level codes such as protocols, thread management, etc. Flask is based on WSGI(Web Server Gateway Interface) toolkit and Jinja2 template engine.</p><blockquote><em>We start by creating- </em><a href="https://github.com/Harasis/ML-Projects/blob/master/Medical%20Diagnosis%20using%20Support%20Vector%20Machines/app.py"><em>app.py</em></a></blockquote><p>for creating a form we use HTML template-</p><blockquote>folder- <a href="https://github.com/Harasis/ML-Projects/tree/master/Medical%20Diagnosis%20using%20Support%20Vector%20Machines/templates">templates</a></blockquote><p>for styling of webpage we use CSS</p><blockquote>folder- <a href="https://github.com/Harasis/ML-Projects/tree/master/Medical%20Diagnosis%20using%20Support%20Vector%20Machines/static/css">static/css</a></blockquote><p>For running the webapp, go in the same directory as of the codes and run-</p><blockquote>python3 app.py</blockquote><p>It will give you the IP address like- <a href="http://0.0.0.0:5000/">http://0.0.0.0:5000/</a>. If every thing is working fine you will get a working webpage like this-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pdboWF6GulZ3fhTGRCTuQw.png" /></figure><p>You can enter your data and this will predict the results.</p><h3>Task 3- Build a requirements document with packages needed for the application</h3><p>Before creating a docker container we need to specify all requirements that are required to run our flask app</p><blockquote><a href="https://github.com/Harasis/ML-Projects/blob/master/Medical%20Diagnosis%20using%20Support%20Vector%20Machines/requirements.txt">requirements.txt</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puFnQC9fPN5uVv44Vgn35g.png" /></figure><h3>Task 4- Build the application in a container using a Dockerfile and test it.</h3><p>To check if your docker is working fine, RUN in Linux-</p><blockquote>]# docker run hello-world</blockquote><p>We need to get Python image for our personalized container-</p><blockquote>]# docker pull python</blockquote><p>to check the available images in our system-</p><blockquote>]# docker images</blockquote><h4>Create a Dockerfile as-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p2ZHHdQM8rO8qmUbcfktag.png" /></figure><blockquote>Link- <a href="https://github.com/Harasis/ML-Projects/blob/master/Medical%20Diagnosis%20using%20Support%20Vector%20Machines/Dockerfile">Dockerfile</a></blockquote><p>Build image-</p><blockquote>]# docker build — tag (img name)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*00MD8NwkjvPuTVG9vd27nw.png" /></figure><p>Check Image-</p><blockquote>]# docker images</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UrcfX-g5pKVeCZ1K3ldyOw.png" /></figure><p>Run Image-</p><blockquote>]#docker run -it — name (container name) -p 5000:5000 (img name)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SPwztez_pqWg7vtBzXh43A.png" /></figure><p>Open the IP provided in the localhost and check if the API working or not.</p><p>If you want to run this API in different IPs , We will use the concept of tunneling using <strong>NGROK</strong></p><p>You can download ngrok for linux.</p><p>Here- <a href="https://ngrok.com/">https://ngrok.com/</a></p><p>Extract and install according to the steps provided then-</p><blockquote>]#./ngrok http 5000</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iwf5IIkaHUH2u0_6toTk3g.png" /></figure><p>copy the IP provided by ngrok and open in any device you want-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yDeh_jKCBM-gcMGZanF-6g.png" /></figure><h3>WHOA your application is dockerized!!</h3><h4>Thank you for reading.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4982d5e6ea74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Audio & Video app using Flutter]]></title>
            <link>https://medium.com/@harasis123/basic-audio-video-app-using-flutter-d24ea5aecad6?source=rss-55bb2ed40f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/d24ea5aecad6</guid>
            <dc:creator><![CDATA[Harasis Singh]]></dc:creator>
            <pubDate>Sat, 08 Aug 2020 19:41:44 GMT</pubDate>
            <atom:updated>2020-08-08T19:41:44.574Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*-OrQOlX1T_vNCsR3.png" /></figure><p>Flutter is a free and open-source software development kit (SDK) launched by Google to create mobile apps for iOS, Android, and Google Fuchsia. Its framework is based on reactive programming which incorporates Dart programming language, ready-made widgets, et al. The Google’s development kit enables users with building 2D mobile apps.</p><p>Flutter is a cross-development framework that helps users in building fully-equipped apps supporting cameras, storage, network, geolocation and so on. The framework facilitates app development for Android and iOS from a single database and the programmers can do more with less code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*aBqKKgyk_wjwDsfu" /></figure><p>One of the best things about Flutter is Hot Reload which allows developers to preview all the changes they have done to the code in no time in the app. Consequently, they can include better features, enhance appearance, get rid of bugs, and check effects firsthand. Flutter can be easily set up as it can be initialized with the coding on low-end machines, so, the users don’t have to think much about the version of the OS they have installed on their PCs.</p><p>As Flutter requires less code, it eliminates the problem of bugs to a large extent. It is based on Dart programming language which is object-oriented. Dart leverages Ahead-Of-Time (AOT) compilation or Just-In-Time (JIT) to smoothen the flow of development, reducing the need for a completely new build. Furthermore, building a ground-level app for iOS requires about 400 man-hours and about 250 hours for Android. Yet, creating apps in the premise of Flutter cuts down the time-consumption to 250 hours both for Android and iOS without disturbing the quality of Android and iOS apps.</p><h4>Audio and Video App Demo-</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuapxcxLvFUU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuapxcxLvFUU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuapxcxLvFUU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c52a678c1a2eb5f7fcef63800ff853e0/href">https://medium.com/media/c52a678c1a2eb5f7fcef63800ff853e0/href</a></iframe><p>For code-</p><ul><li>github repo- <a href="https://github.com/Harasis/Flutter_Class/tree/master/app1">https://github.com/Harasis/Flutter_Class/tree/master/app1</a></li></ul><p>To wrap up, Flutter is a top-notch cross-platform solution and is garnering a lot of attention in recent times in the app development domain. The adoption of Flutter among developers is increasing exponentially with emerging organizations looking for flutter developers for creating their mobile applications.</p><p><strong>DONE!!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d24ea5aecad6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Facial Recognition Using Transfer Learning!]]></title>
            <link>https://medium.com/@harasis123/facial-recognition-using-transfer-learning-1b6a6f61c801?source=rss-55bb2ed40f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b6a6f61c801</guid>
            <dc:creator><![CDATA[Harasis Singh]]></dc:creator>
            <pubDate>Sat, 11 Jul 2020 18:44:31 GMT</pubDate>
            <atom:updated>2020-07-11T18:46:40.745Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/645/0*kG3YVVQrSHNzj5NY.jpeg" /></figure><h3>What is Transfer Learning?</h3><p><strong>Transfer learning</strong> is a research problem in machine <strong>learning</strong> (ML) that focuses on storing knowledge gained while solving one problem and applying it to a different but related problem. For example, the knowledge gained while <strong>learning</strong> to recognize cars could apply when trying to recognize trucks.</p><p><strong>Transfer Learning</strong> is the future of Machine Learning, where the solution to training the whole resolves. It also makes the model training faster. In transfer learning, we <strong>reuse the weights of one or more layers</strong> from a <strong>pre-trained neural network model</strong> in our new model and either keeping the weights fixed, fine-tuning them, or adapting the weights entirely when training the model. In the classic supervised learning scenario of machine learning, if we intend to train a model for some task and domain, we assume that we are provided with labeled data for the same task and domain. The task and domain of the training and test data of our model are the same. We will later define in more detail what exactly a task and a domain are).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*94ZcOWl_dNf4SRwP.png" /></figure><p>For this Facial Recognition Project, I am using VGG16 architecture.</p><h3>VGG16 model and its Architecture:</h3><p>VGG16 is a convolutional neural network model proposed by K. Simonyan and A. Zisserman from the University of Oxford in the paper “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The model achieves 92.7% top-5 test accuracy in ImageNet, which is a dataset of over 14 million images belonging to 1000 classes.</p><p>In this model, we have 16 layers in the model.</p><ul><li>13 convolve layers</li><li>3 dense layers</li></ul><p>We also have the Max-Pooling Layers which helps in reducing its dimensionality and allowing for assumptions to be made about features with more accuracy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/0*7kCsmJJjuL95q44n" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TVmj3BIhbUEh6C1E.png" /></figure><p>The input to the conv1 layer is of fixed size 224 x 224 RGB image. The image is passed through a stack of convolutional (conv.) layers, where the filters were used with a very small receptive field: 3×3 (which is the smallest size to capture the notion of left/right, up/down, center). In one of the configurations, it also utilizes 1×1 convolution filters, which can be seen as a linear transformation of the input channels. The convolution stride is fixed to 1 pixel. The padding of Conv1D. layer input is such that the resolution is preserved after convolution, i.e. the padding is 1-pixel for 3×3 Conv. layers. Pooling is carried out by five max-pooling layers, which follow some of the Conv. layers (not all the conv. layers are followed by max-pooling). Max-pooling is performed over a 2×2 pixel window, with stride 2.</p><p>Three Fully-Connected (FC) layers follow a stack of convolutional layers (which has a different depth in different architectures): the first two have 4096 channels each, the third performs 1000-way ILSVRC classification and thus contains 1000 channels (one for each class). The final layer is the soft-max layer. The configuration of the fully connected layers is the same in all networks.</p><h3>Steps-</h3><h4>1. Preparation of Dataset-</h4><p>Using these notebooks we collect the testing and training images <a href="https://github.com/Harasis/ComputerVision-AI-ML-OpenCV/blob/master/FaceDetection_Using_VGG16/Collection%20Test%20Dataset.ipynb">Collection Test Dataset.ipynb</a> , <a href="https://github.com/Harasis/ComputerVision-AI-ML-OpenCV/blob/master/FaceDetection_Using_VGG16/Collection%20Train%20Dataset.ipynb">Collection Train Dataset.ipynb</a>.</p><p>These codes are using the OpenCV module. They detect the face using the library called <a href="https://github.com/Harasis/ComputerVision-AI-ML-OpenCV/blob/master/FaceDetection_Using_VGG16/haarcascade_frontalface_default.xml">haarcascade_frontalface_default.xml</a>. Then, convert those images to GrayScale and cropping them to 400X400 pixels. In the end, Images are saved to the specified folder.</p><h4>2. Training VGG16 model-</h4><p>Using <a href="https://github.com/Harasis/ComputerVision-AI-ML-OpenCV/blob/master/FaceDetection_Using_VGG16/VGG16%20model.ipynb">VGG16 model.ipynb</a> we are going to train our VGG16 model based on the training and validation images collected from <strong>Step 1</strong>. We have configured this model according to the input_shape of of our input image data and it will provide our required output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xD2ayObYxBC95bC2.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/0*hO9y83Ygrnk0EvK3.jpeg" /></figure><p><strong>Seeing our layers classification</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/0*xIsedViCJTqUkspA.jpeg" /></figure><h4>Freezing the layers of the model</h4><p>Here we freeze all the layers of the model. By default, the layers of the model are set to trainable. So we make all the layers of the model to freeze so that they wouldn’t we train again.</p><p>All the layers are set to false, which means that they will not train again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/0*pGuZRoDel2SxDJc9.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/0*TGmkeTauHY1Ev5Ks.jpeg" /></figure><h4>Loading our Image Data Set</h4><p>In this, we are loading our data set, and this function will process our image and tell how many images are there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/0*cfCcZsZhe31HHTfh.jpeg" /></figure><h4>Training our Layers</h4><p>Now we will train our layers to build the vgg16 model again by using transfer learning. So here I have given the training samples, test samples, and the batch size.</p><p>Then we have compiled the model and save it as “face_vgg16.h5”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/0*ykkcDk6D_kO3okir.jpeg" /></figure><p><strong>Model is trained for 10 epoch and early stopping is also applied to prevent overfitting.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U3sJu-1j6JmPv-Rr.jpeg" /></figure><h3>Loading our model</h3><p>Now here we have loaded the model that we have trained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/0*PQLq1d7X7Yc3coD2.jpeg" /></figure><h4>3. Running Facial-Recognition Code-</h4><p>We will use <a href="https://github.com/Harasis/ComputerVision-AI-ML-OpenCV/blob/master/FaceDetection_Using_VGG16/Model%20Run%20to%20detect%20-Copy1.ipynb">Model Run to detect -Copy1.ipynb</a> to run the model created in <strong>Step 2.</strong></p><p>See my GitHub — <a href="https://github.com/Harasis/ComputerVision-AI-ML-OpenCV/tree/master/FaceDetection_Using_VGG16">https://github.com/Harasis/ComputerVision-AI-ML-OpenCV/tree/master/FaceDetection_Using_VGG16</a> . I have Described each step for the code.</p><h3>Applications of the project-</h3><ol><li>Automation in Attendance system</li><li>Police Surveillance</li><li>Spying</li><li>Finding Lost People</li></ol><p>You can ask me if you have any queries.</p><p>Thank you and Have a nice day</p><p>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b6a6f61c801" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloak Of Invisibility- A Computer Vision Project]]></title>
            <link>https://medium.com/@harasis123/cloak-of-invisibility-a-computer-vision-project-f741a71f5b2d?source=rss-55bb2ed40f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/f741a71f5b2d</guid>
            <category><![CDATA[harry-potter]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[opencv]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[mimic]]></category>
            <dc:creator><![CDATA[Harasis Singh]]></dc:creator>
            <pubDate>Tue, 07 Jul 2020 16:31:53 GMT</pubDate>
            <atom:updated>2020-07-07T17:31:29.707Z</atom:updated>
            <content:encoded><![CDATA[<p>Most of you are also obsessed with Harry Potter movies and novels like me and I know how thrilled I was when I watched the first harry potter movie. All those funny-sounding spells, that nimbus 3000 brooms, all those yucky candies and that Cloak of Invisibility.</p><p>So here in this blog, I will show you how you can make your own Invisibility cloak.</p><p>A little back story about Cloak of Invisibility in Harry Potter-</p><blockquote><em>Dumbledore gave Harry the cloak. The Cloak of Invisibility was one of the three Deathly Hallows and it belonged to Harry’s father, James. The cloak had been passed down, from father to son (or daughter, I suppose) for centuries. The cloak had been magically made by Death and given to one of the three Peverell brothers, to whom Harry Potter is distantly related.</em></blockquote><blockquote><em>Interestingly, Albus Dumbledore had the cloak at the time Voldemort killed James and Lily Potter. I always wondered if Lily could have hidden in the cloak somehow, except babies are notoriously noisy and Harry likely wouldn’t have kept them hidden for long. So Dumbledore was examining the Cloak, checking to see if it could indeed be the one Cloak of Invisibility that never wears out, never loses its enchantments and when combined with the other two Deathly Hallows, gives the holder, immortality. (Though if any wizard possessed all three, they never managed to stay alive long enough to enjoy immortality :)</em></blockquote><blockquote><em>Dumbledore decided to give the cloak back during his first Christmas at Hogwarts, knowing full well how much mischief James Potter got into with the aid of that beautiful cloak, and I’m quite sure the Headmaster knew this would likely propel Harry toward interesting adventures of his own. (And once he became the proud owner of the Marauder’s Map, he had two awesome tools that allowed him to find plenty of things to do past curfew.)</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*KlAYppOUZHotX8GV.gif" /></figure><p>We will be using python’s OpenCV module for this and achieve invisibility in a few lines of code.</p><p>You will be needing a <strong>red cloth</strong> which will be acting as our cloak.</p><h3>Working Idea-</h3><p>We are extracting each frame of the video, with the help of segmentation. we separate the background and foreground of the image.</p><p>Then, We replace the foreground of a particular color with the background which gives the illusion of getting disappeared.</p><p>My code is specifically designed to give you invisibility effect when you use <strong>Red Cloth</strong>.</p><h3>Steps-</h3><h4><strong>1. Importing needed libraries and generate the output video-</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*4PtLvmkRPSJ5faqlhzm6pQ.png" /></figure><p>First of all, we will Import the libraries for the program. CV2 for computer vision operations, ‘time’ for time-related operations in the program, Numpy for numerical related computations.</p><h4>2. Writing and Saving the video-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7K1eqICUynmDn7EMoaxNGA.png" /></figure><h4>3. <strong>Recording and caching the background for each frame-</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6_Mh2bgcnzXKEpAyZFrbAg.png" /></figure><p>We are replacing the red colored pixels with the background pixels to create the invisible effect in the video. For doing this, we have to store the background image for each frame.</p><p>For capturing the current frame, we have used Cap.read() function and stored it in the variable named ‘background’. The variable ‘ret’ is used to store Boolean True/False, ret will give True value if the frame is read correctly otherwise it will give False. We are capturing the background in a for loop so that we have several frames for the background as averaging over multiple frames also reduces noise.</p><h4>4. Identifying the Red portion in each frame-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g-m-5lt4uwv398kAMwG1DA.png" /></figure><p>In this part, we are identifying the red portion in the image.</p><p>We are converting our video from BGR to HSV because The HSV model describes colors similarly to how the human eye tends to perceive color. RGB defines color in terms of a combination of primary colors. In situations where color description plays an integral role, the HSV color model is often preferred over the RGB model.</p><p><em>‘Hue</em>’ represents the color, ‘<em>Saturation</em>’ represents the amount to which that respective color is mixed with white and ‘<em>Value</em>’ represents the amount to which that respective color is mixed with black <em>(Gray level</em>).</p><p>In RGB, we cannot separate color information from luminance. HSV or Hue Saturation Value is used to separate image luminance from color information.</p><p>In Hue value, the red color is in range 0–30 as well as 150–180. To avoid the detection of skin as the red color we will use 0–10 and 170–180 range and combine both with the OR operator(+ in python)</p><h4>5. Replacing the red portion with the mask image-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5bC0EfXjQjexFX20UVa5-Q.png" /></figure><p>Now, we have a red part of the video in the ‘mask’ image, we will segment the mask part from the frames. We will do a morphology open and dilation for that.</p><h4>6. Mimic the magic of invisibility cloak-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*L4c5aqwrXiOERHQm34agiA.png" /></figure><p>Now we will replacement of the pixels of the detected red color region in the frames with the pixel values of the static background which was saved earlier.</p><blockquote><strong><em>Github- </em></strong><a href="https://github.com/Harasis/ComputerVision-AI-ML-OpenCV/tree/master/Invisible%20Cloak"><strong><em>https://github.com/Harasis/ComputerVision-AI-ML-OpenCV/tree/master/Invisible%20Cloak</em></strong></a></blockquote><p>After Running the code, wait for some seconds to let the background behind you get saved, and then you can come in front of the camera and get invisible.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQfpjGhdmtyc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQfpjGhdmtyc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQfpjGhdmtyc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac727a64b2a8c1d54558230cc3c68a12/href">https://medium.com/media/ac727a64b2a8c1d54558230cc3c68a12/href</a></iframe><blockquote>Now you will get your own Invisibility Cloak, Have fun !!!</blockquote><h4>As according to J.K. Rowling-</h4><blockquote>“We do not need magic to change the world, we carry all the power we need inside ourselves already: we have the power to imagine better.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f741a71f5b2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automation of Docker, Git and Github with Jenkins- A Devops Project]]></title>
            <link>https://medium.com/analytics-vidhya/automation-of-docker-git-and-github-with-jenkins-a-devops-project-72dda6ee8355?source=rss-55bb2ed40f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/72dda6ee8355</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[website]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Harasis Singh]]></dc:creator>
            <pubDate>Tue, 16 Jun 2020 09:12:16 GMT</pubDate>
            <atom:updated>2020-06-16T13:46:19.662Z</atom:updated>
            <content:encoded><![CDATA[<h3>Website Deployment Automation using Jenkins on Docker - A Devops Project</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*OW0XC-CqMFhJingCMIJ3nQ.jpeg" /></figure><p>This automation will help us to deploy <strong>Webpages</strong> uploaded by developer on Github of extension<strong> .html </strong>and<strong> .php </strong>on docker containers. Every part is <strong>Automated</strong> using Jenkins which <strong>itself is running</strong> on a docker. User even get an email when a Site is deployed.</p><h3>Tools Used-</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*NmxOR8kzAQ9BndejlYfq0Q.png" /></figure><ul><li>Git and Github- for version control and hosting our repository.</li><li>Jenkins- to automate various jobs.</li><li>Rhel8- as a base os for running services like docker and ngrok.</li><li>Docker- to Deploywebpages and jenkins.</li></ul><h3>Task Description-</h3><p>1. Create container image that’s has Jenkins installed using Dockerfile.</p><p>2. When we launch this image, it should automatically starts Jenkins service in the container.</p><p>3. Create a job chain of Job1, Job2, Job3 and Job4 using build pipeline plugin in Jenkins</p><p>4. Job1 : Pull the Github repo automatically when developers push repository to Github.</p><p>5. Job2 : By looking at the code or program file, Jenkins should automatically start the respective language interpreter install image container to deploy code ( eg. If code is of PHP, then Jenkins should start the container that has PHP already installed ).</p><p>6. Job3 : Test your app if it is working or not.</p><p>7. Job4 : if webpages areworking , then send confirmation email to developer.</p><p>8. Create One extra job Job5 for monitor : If container where app is running. fails due to any reason then this job should automatically start the container again.</p><h3>Automation Steps-</h3><h4>1. Creating Personalized Docker Image with Jenkins Installed in it-</h4><p>We can create personalized Docker image using Dockerfile.</p><p>A <strong>Dockerfile</strong> is a text document that contains all the commands a user could call on the command line to assemble an image. Using docker build users can create an automated build that executes several command-line instructions in succession. <strong>In short Dockerfile is used to create our own personalized Docker Image.</strong></p><ul><li>To create a dockerfile I have created a new folder named ws.</li></ul><p><em>]# mkdir ws/</em></p><p><em>]#cd /ws</em></p><ul><li>Then create a docker file in ws directory using</li></ul><blockquote><em>]#gedit Dockerfile</em></blockquote><ul><li>So, we will start creating Dockerfile using <strong>centos</strong> image pulled from docker hub as shown in the image below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UUTqEgmwVSlDZFJNq491FA.png" /></figure><ul><li>after saving docker file come to parent directory</li></ul><blockquote><em>]#cd ..</em></blockquote><ul><li>run command to create image</li></ul><p><em>]#docker build -t automation:v1 /ws/</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*cfl0w26UQlhxhsTSj95OQQ.png" /><figcaption>Dockerfile Success</figcaption></figure><h4>2. Run Docker Image-</h4><p>After we have created a docker image we have to run it using-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*hDDIqvM2TuN1h-MeEaYXFA.png" /></figure><ul><li>privileged is used to give container root capabilities of a host machine, allowing the ability to access resources which are not accessible in ordinary containers.</li><li>we have set the <strong>port 9999</strong> of host machine to access the <strong>port 8080</strong> of docker container on which the jenkins works.</li><li>-v to connect / of host machine to /host of docker container.</li></ul><p>After running the command we get -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*UaVsX3cMnlg3cuazax5sUQ.png" /></figure><h4>3. Setting up of Jenkins -</h4><ul><li>copy the password given after running the docker image.</li><li>go to the browser</li><li>then enter the url- Ip of host machine:9999</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*9VegHAJoHu1S7T_caZq-sA.png" /></figure><ul><li>you can change the password of admin by going to <strong>manage jenkins tab.</strong></li><li>after successful completion you will get-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*p901RHwFxsoN8nJUlR_Xng.png" /></figure><h4><strong>4. Setting our local git repository-</strong></h4><p>First, I have created an empty <a href="https://github.com/Harasis/MachineLearning_Automation">Github</a> repository named <a href="https://github.com/Harasis/Jenkins_Automation_T2">Jenkins_Automation_T2</a>. Then by using the basic git commands I have uploaded my codes to that Repo.</p><p>Then, I have configured a post-commit script which will automatically push my code whenever a developer commit any new change.</p><ul><li>To do this you have to go to your code folder where you have set your .git</li><li>then using [$cd /.git/hooks ] go to the hooks directory</li><li>then using [$cat &gt; post-commit] create a script that will push your code when you commit</li><li>in post-commit write what’s in the image below and press ctrl+d to save it.</li><li>then goto your main code folder and try to commit.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*K61d3sSCksLezA9nKomPog.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mkJRjNV6HaKSbFcETZSbAA.png" /></figure><p><strong>5. Setting </strong><a href="https://ddos-guard.net/en/terminology/technology/ip-tunnel"><strong>Tunnel</strong></a><strong> for private ip in Rhel-</strong></p><p>We have to set web-hooks in Github repo in Step-3, I am using private ip but Github is on Public World and Github needs access to our private ip on which Jenkins is running. Here comes the concept of Tunnel which will help us.</p><p>We set up <a href="https://ngrok.com/download">ngrok</a> software for the port and protocol Jenkins is running. In my case Jenkins is running on port 9999 on docker and using http protocol. Use command-</p><blockquote><em>]#./ngrok http 9999</em></blockquote><p>We will use this ip provided by ngrok in setting up our web-hooks in Github repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*U4Fhjh3xBau80h18o7F6ng.png" /></figure><p><strong>6. Setting Web-hooks in Github Repo-</strong></p><p>We will be needing web-hooks for our Jenkis JOB1 which will detect any change in the Github repo and send it to our Rehl Os at the specified location</p><ul><li>To set Web-hooks we have to go to our git hub repository and then</li></ul><blockquote><em>-&gt;Settings -&gt;in Options -&gt;Webhooks -&gt;Add Webhook -&gt;Enter your password -&gt;In payload url enter [ngrok_ip/github-webhook/] -&gt;Change Content type to [application/json] -&gt;then Save the Webhook</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_vKS062hXi_eco_n1NPRgg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2R-KYe_V2wQcrHU_5iKr9Q.png" /></figure><ul><li>then update the webhook</li></ul><p>if everything is working fine then you will get the <strong>green</strong> arrow-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*1hnZbRJ1FVSgHOicp7Icnw.png" /></figure><h4>7. Creating Job1 in Jenkins-</h4><p>Job1 will pull the github repository automatically when the developer push any update.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6yW04uL0irA9mKO2MA_oHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eTyifTK3XcnxiU76.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OpKaA0XT69NDoLfhTHOKgQ.png" /></figure><h4>8. Creating Job2 in Jenkins-</h4><p>Job2 will look at the code or program file, and then automatically start the respective language interpreter install image container to deploy code i.e If code is of PHP, then Jenkins should start the container that has PHP already installed and if the code is of HTML then jenkins should start container with httpd.</p><p>You have to <strong>pull</strong> respective Images from <strong>dockerhub.</strong></p><p>In my case I have -</p><ul><li>Httpd image for html files.</li></ul><blockquote>]#docker pull httpd</blockquote><ul><li>Personalized image for php files.</li></ul><blockquote>]#docker pull vimal13/apache-webserver-php</blockquote><blockquote><strong><em>These images are downloaded on Base OS</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*rwzjGOojLkU0TZlQxzryRg.png" /></figure><p><strong>Job2 configurations-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NP4PlURpMOcuzlFYXdbUVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lKwEJWptG_QLP2lIhMWlnA.png" /></figure><p>here <strong>chroot</strong> is used to replicate the directory of docker container to our BaseOS. In other words , Jenkins is working on a container so the github files will be copied to folder <strong>/host/git_repository</strong> in the docker container. But we have installed docker images in Base OS and we need to run the .html and .php files from it .</p><p>Hence using <strong>chroot</strong> we can replicate our /git_repository from conatiner to our BaseOS.</p><p><strong>If everything is working fine You can check the Webpages have been deployed.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*4Hf0oIzuHA7JCR0mybvMqA.png" /><figcaption>php Site Deployed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*q0UvAMHMaN-TDTTZv6zk4A.png" /><figcaption>html Site Deployed</figcaption></figure><h4>9. Creating Job3 in Jenkins-</h4><p>Job3 will Test if our websites are working or not.</p><p>I have Divided Job3 in <strong>Job3_html</strong> and <strong>Job3_php.</strong></p><p>Job3_html will check the status of html Pages.</p><p>Job3_php will check the status of php Pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ARZaC71kQHLMipDAdILg4A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bgp4KNL4ex4LFoX1AOeEDA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wd-iIy1-7j09deHaG6Zvjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6jXt8MORCWu5EM_58AIl_w.png" /></figure><h4>10. Creating Job4 in Jenkins-</h4><p>Job4 will send the confirmation mail to the developer.</p><p>Again I have divided Job4 in <strong>Job4_html</strong> and <strong>Job4_php.</strong></p><ul><li>Job4_html will send the confirmation mail of .html site to the developer using python file- <a href="https://github.com/Harasis/Jenkins_Automation_T2/blob/master/mail.py"><strong><em>mail.py</em></strong></a></li><li>Job4_php will send the confirmation mail of .php site to the developer using python file- <a href="https://github.com/Harasis/Jenkins_Automation_T2/blob/master/mail_php.py"><strong><em>mail_php.py</em></strong></a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ChTQ4XL9mHRlmfoABVjNDQ.png" /><figcaption>will triggered after Job3_html</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RWZ96XMpzafbuFPaoyfNvw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GFTNjaIrPNVXTA6bl8QIuw.png" /><figcaption>will triggered after Job3_php</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lOrInWu1JJjvO7hfXE-Qyg.png" /></figure><h4>11. Build Pipeline-</h4><p>Can be created using the Build Pipeline Plugin in Jenkins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c6UWGTuv_dS1Cwjaqao_tg.png" /></figure><h4>12. Creating Job5 in Jenkins-</h4><p>This job is outside our Pipeline . This job will <strong>monitor</strong> If containers where websites are running. fails due to any reason then this job should <strong>automatically start</strong> that respective container again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bkCvQQm9URE-AAWcJEoC5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0uRxSJNU8nxfbeMwvM11-A.png" /></figure><p>If everything working fine then console output of Job5 will be-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WNShPPq7wBZi9DWx3cczsA.png" /></figure><h3><strong><em>Project Done!!</em></strong></h3><p>Thankyou for Reading my blog.</p><p>Have a nice day.</p><p>Github Repo-</p><p><a href="https://github.com/Harasis/Jenkins_Automation_T2">https://github.com/Harasis/Jenkins_Automation_T2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72dda6ee8355" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/automation-of-docker-git-and-github-with-jenkins-a-devops-project-72dda6ee8355">Automation of Docker, Git and Github with Jenkins- A Devops Project</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automation of Deep Learning Model using Jenkins]]></title>
            <link>https://medium.com/analytics-vidhya/automation-of-deep-learning-model-using-jenkins-79c2e732445b?source=rss-55bb2ed40f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/79c2e732445b</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[redhat-linux]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Harasis Singh]]></dc:creator>
            <pubDate>Sun, 24 May 2020 19:20:49 GMT</pubDate>
            <atom:updated>2020-07-10T16:31:20.965Z</atom:updated>
            <content:encoded><![CDATA[<p>In <a href="https://en.wikipedia.org/wiki/Machine_learning">machine learning</a>, <strong>hyperparameter optimization</strong> or tuning is the problem of choosing a set of optimal <a href="https://en.wikipedia.org/wiki/Hyperparameter_(machine_learning)">hyperparameters</a> for a learning algorithm. A hyperparameter is a <a href="https://en.wikipedia.org/wiki/Parameter">parameter</a> whose value is used to control the learning process. By contrast, the values of other parameters (typically node weights) are learned.</p><p>The same kind of machine learning model can require different constraints, weights or learning rates to generalize different data patterns. These measures are called hyperparameters, and have to be tuned so that the model can optimally solve the machine learning problem.</p><p>So, instead of manually tuning our Hyperparameters, We are giving this job to Jenkins for Automation.</p><h3>Tools Used-</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*6JX5b7fIf-wQtER_J0DQmg.png" /></figure><ul><li>Git and Github- for version control and hosting our repository.</li><li>Jenkins- to automate various jobs.</li><li>Rhel8- as a base os for running services like httpd, jenkins,ngrok.</li><li>Docker- to run our python model.</li></ul><h3>Dataset-</h3><p>I am using Fashion MNIST dataset for my deep learning model. Fashion-MNIST is a dataset of Zalando’s article images — consisting of a training set of 60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image, associated with a label from 10 classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*GNLB2jtcfb_xTqgQd9ntJA.png" /><figcaption>Fashion MNIST dataset</figcaption></figure><h3>Steps For Automation-</h3><h4>Task Description</h4><ol><li>Create a container image that’s has Python3 ,Keras ,numpy and all the required libraries installed using dockerfile</li><li>When we launch this image, it should automatically starts train the model in the container.</li><li>Create a job chain of job1, job2, job3, job4 and job5 using build pipeline plugin in Jenkins</li><li>Job1 : Pull the Github repo automatically when some developers push repo to Github.</li><li>Job2 : By looking at the code or program file, Jenkins should automatically start the respective machine learning software installed, Interpreter install image container to deploy code and start training( eg. If code uses CNN, then Jenkins should start the container that has already installed all the softwares required for the cnn processing).</li><li>Job3 : Display the Accuracy in webbrowser (locally connected)</li><li>Job4 : if metrics accuracy is less than 88% , then tweak the machine learning model architecture.</li><li>Job5: Retrain the model or notify that the best model is being created.</li><li>Job6: Will notify the developer that tweaking is started as model accuracy is less than required.</li><li>Create One extra job job7 for monitor : If container where app is running. fails due to any reason then this job should automatically start the container again from where the last trained model left</li></ol><h4>Lets Begin The Work-</h4><ol><li><strong>Setting our local git repository-</strong></li></ol><p>First, I have created an empty <a href="https://github.com/Harasis/MachineLearning_Automation">Github</a> repository named <a href="https://github.com/Harasis/MachineLearning_Automation">MachineLearning_Automation</a>. Then by using the basic git commands i have uploaded my codes to that Repo.</p><p>I have configured a post-commit script which will automatically push my code whenever I commit any new change.</p><ul><li>To do this you have to go to your code folder where you have set your .git</li><li>then using [$cd /.git/hooks ] go to the hooks directory</li><li>then using [$cat &gt; post-commit] create a script that will push your code when you commit</li><li>in post-commit write what’s in the image below and press ctrl+d to save it.</li><li>then goto your main code folder and try to commit</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*DUdmJg5PO6NO8AO1AteaHw.png" /></figure><p><strong>2. Setting </strong><a href="https://ddos-guard.net/en/terminology/technology/ip-tunnel"><strong>Tunnel</strong></a><strong> for private ip in Rhel-</strong></p><p>We have to set web-hooks in Github repo in Step-3, I am using private ip but Github is on Public World and Github needs access to our private ip on which Jenkins is running. Here comes the concept of Tunnel which will help us.</p><p>We set up <a href="https://ngrok.com/download">ngrok</a> software for the port and protocol Jenkins is running. In my case Jenkins is running on port 8080 and using http protocol. Use command-</p><blockquote>]#./ngrok http 8080</blockquote><p>We will use this ip provided by ngrok in setting up our web-hooks in Github repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*eslA4f0jbZ9WPNJoDP_Y5g.png" /></figure><p><strong>3. Setting Web-hooks in Github Repo-</strong></p><p>We will be needing web-hooks for our Jenkis JOB1 which will detect any change in the Github repo and send it to our Rehl Os at the specified location</p><ul><li>To set Web-hooks we have to go to our git hub repository and then</li></ul><blockquote>-&gt;Settings -&gt;in Options -&gt;Webhooks -&gt;Add Webhook -&gt;Enter your password -&gt;In payload url enter [ngrok_ip/github-webhook/] -&gt;Change Content type to [application/json] -&gt;then Save the Webhook</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*ONGXMW4JM9DyQNUnd-KApA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*TfBvanXH7viNMI3jlnJfww.png" /></figure><p><strong>4. Create JOB1 in Jenkins-</strong></p><p>JOB1 will automatically pull the Github repo to a specified directory in our Rhel Os whenever developer pushes any new code.</p><p>JOB1 configurations-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hHdVPwyZkpkieGUVZepBiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SxHho9Ak-F_FJyI38d-gCw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DXJGxb2-2m4t45r8_9KOfA.png" /></figure><p>If everything work perfectly then we will have -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*4_H7gGciW6NOyIfWcKF8Vw.png" /></figure><p><strong>5. Creation Our Own Docker Image-</strong></p><p>To run our ML code named <a href="https://github.com/Harasis/MachineLearning_Automation/blob/master/machinelearning_code.py">machinelearning_code.py</a> in Docker container we have to create our own Docker Image with Centos as the base and all the required libraries and python36 installed within it.</p><ul><li>To create Docker image first create a new folder named ws using-</li></ul><blockquote>]# mkdir ws/</blockquote><blockquote>]#cd /ws</blockquote><ul><li>Then create a docker file in ws directory using</li></ul><blockquote>]#gedit Dockerfile</blockquote><ul><li>in Dockerfile write-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*t8yAhFr4QXM4t9WvR8jGgw.png" /></figure><ul><li>after saving docker file come to parent directory</li></ul><blockquote>]#cd ..</blockquote><ul><li>run command to create image-</li></ul><blockquote>]#docker build -t machinelearning:v1 /root/Desktop/ml-automation /ws/</blockquote><ul><li>after build completion we will see -</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*iP4RoBHUPV8TeGLAHY0vKQ.png" /></figure><p><strong>6. Creating JOB2 in Jenkins-</strong></p><p>JOB2 has a task By looking at the code or program file, automatically start the respective machine learning software installed, Interpreter install image container to deploy code and start training( eg. If code uses CNN, then Jenkins should start the container that has already installed all the softwares required for the cnn processing) ie Run Docker Container from the Docker Image created in *Step 5*.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a5MSq00EQAj8OvJ5YAXYDw.png" /></figure><ul><li>you can see checking.py from here -<a href="https://github.com/Harasis/MachineLearning_Automation/blob/master/checking.py">checking.py</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CKRwkkJlv-OCOzHFNDVIUg.png" /></figure><ul><li>After successful build of JOB2, Console output must be like this-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*hGXxhSYevl6j9_JH3lvq0Q.png" /></figure><p><strong>7. Creating JOB3 in Jenkins-</strong></p><p>JOB3 has a task to copy the [show_output.html] file from Parent Directory to /var/www/html which is the default directory for webpages in <a href="https://httpd.apache.org/">Apache Webserver</a>.</p><p>This [show_output.html] file will show us The hyperparameters used and the Accuracy of our model.</p><ul><li>Before going in Jenkins run following command to start httpd server in rhel-</li></ul><blockquote>]#systemctl start httpd</blockquote><ul><li>JOB3 configurations-</li></ul><p>Set Build Triggers to -&gt;Build after other Projects are build-&gt;put JOB2 in it. After that do -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kz_JKGuBEjq0HgAxWdtiGg.png" /></figure><ul><li>After successful build of JOB3, We can see show_output.html file in our local web-browser.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*qWFMWohL6v01bi5UDt1Hmg.png" /></figure><p><strong>8. Creating JOB4 in Jenkins-</strong></p><p>JOB4 will monitor the accuracy of Model and if the accuracy of model is less then 98%. It will launch the <a href="https://github.com/Harasis/MachineLearning_Automation/blob/master/tweaker.py">tweaker.py</a> program which will add extra Convolution Layers and Run JOB2 again to train model and JOB6 to send Email to the Developer “That accuracy is low, Running the Tweaker program”.</p><p>And if the Model Acheived required accuracy JOB5 will run as JOB4 will get terminated by [exit 0] command.</p><ul><li>JOB4 configuration-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XFlHLRdGRsRp1EldWEuEbA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NtYSy7dEYrbwI-44HIxzPA.png" /></figure><ul><li>as JOB4 will run again and again until desired accuracy is not acheived, Our show_display.html file will also get changed by JOB3 and will show different accuracies and hyperparameters from each run of JOB2 model.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*DafnW6P79HHSxHZhimMdmw.png" /></figure><p><strong>9. Creating JOB5 in Jenkins-</strong></p><p>After getting the desired accuracy from JOB2 model, JOB4 will get terminated and JOB5 will run. This job will run <a href="https://github.com/Harasis/MachineLearning_Automation/blob/master/model_success_mail.py">model_success_mail.py</a> and send the notification of PROJECT COMPLETION to the developer.</p><ul><li>JOB5 configurations-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*moB3IHIencTuF1ochpfb9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QeId-gf6xtu4ipp5KenUww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LowaUjgGG7GQ0xitnPg55Q.png" /></figure><ul><li>Python file to send email, edit this code in Rhel using gedit and put your own Credentials in this-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*nXqlp5W85oYf8k8vkD2tbA.png" /></figure><p><strong>10. Creating JOB6 in Jenkins-</strong></p><p>when JOB2 model does not acheived the desired accuracy, Then JOB4 will run JOB2 and JOB6. JOB6 will send the message of unsuccess and running the tweaking code by running <a href="https://github.com/Harasis/MachineLearning_Automation/blob/master/model_lessaccuracy_mail.py">model_lessaccuracy_mail.py</a>.</p><ul><li>JOB6 configurations-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hYVXI4hFjc6DhY7Uq7Jg6A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wAYTi7Wo_I09jBiWsnSv7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4P4BNpuOS1sVYMxrm3bNoA.png" /></figure><ul><li>Python code for this-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*UldXsZ4kAReJ6wa3YDeXDw.png" /></figure><p><strong>11. Creating JOB7 in Jenkins-</strong></p><p>JOB7 will run Every Hour and check If Container where model is running, Fails due to any reason then this job should automatically start the container again from where the last trained model left.</p><ul><li>Configuring Poll SCM schedule for one hour-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HJ9EqjhAZdjI_dE4iT5x2g.png" /></figure><ul><li>Execute shell command-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OF1IGfmdpFiDHwyvz8NOBg.png" /></figure><ul><li>console output if container is running fine-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*edKJ647ZD6LZmLGW2FZXHA.png" /></figure><h4>PROJECT COMPLETED!!!</h4><p>Voila!!!! That’s how you can automate machine learning model using jenkins.</p><p>GITHUB REPO- <a href="https://github.com/Harasis/MachineLearning_Automation">https://github.com/Harasis/MachineLearning_Automation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79c2e732445b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/automation-of-deep-learning-model-using-jenkins-79c2e732445b">Automation of Deep Learning Model using Jenkins</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Automated Project With Jenkins !!]]></title>
            <link>https://medium.com/@harasis123/basic-automated-project-with-jenkins-296813c60595?source=rss-55bb2ed40f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/296813c60595</guid>
            <dc:creator><![CDATA[Harasis Singh]]></dc:creator>
            <pubDate>Wed, 06 May 2020 22:12:09 GMT</pubDate>
            <atom:updated>2020-05-06T22:12:09.829Z</atom:updated>
            <content:encoded><![CDATA[<h3>Basic Automated Project With Jenkins !!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wQ53uRYuyWok0ilTI7BKAg.jpeg" /></figure><p><a href="http://jenkins-ci.org/"><strong><em>Jenkins</em></strong></a><strong><em> is an extensible, open source continuous integration server. It builds and tests your software continuously and monitors the execution and status of remote jobs, making it easier for team members and users to regularly obtain the latest stable code.</em></strong></p><p>This is a series of tutorials for Jenkins, Install and Configure, Automate the builds, CI/CD using Jenkins, Jenkins Pipeline as a Code, etc. This is a <strong>Part I Getting Started with Jenkins</strong>. We are talking of Devops build and release mechanism. You know the code starts right away from the development machine i.e. from your local machine and it must need some sort of version control in place to track the each and every change over a period of time. A <a href="https://en.wikipedia.org/wiki/Version_control"><strong>Version Control System</strong></a><strong>(VCS)</strong> keep individual’s code in a consistent way by managing the replicas over the change. So, your written code reach the centralized repository i.e.<strong> </strong><a href="https://www.techopedia.com/definition/3879/source-code-manager-scm"><strong>Source Code Management</strong></a><strong>(SCM)</strong> using the Pull Request(PR) or some sort of merging technique. <a href="https://git-scm.com/"><strong>Git</strong></a> is widely used version control system in most of the projects. Once your codebase is ready it can go through different environments like development, staging and production. And, in between lot of configuration task need to be done i.e building a stuff, then deploying it, configuring softwares and tools, setting up the servers, monitoring and logging mechanism, prevention alerts, etc. The most of the task needs automation in place as it’s impossible to configure hundreds of thousands of machines manually. So, there is a need for better tool which will automate the build, test your system in staging and deploy it to production. Hudson was a very popular open source Continuous Integration(CI) tool developed by Sun Microsystems. Oracle brought the Sun Microsystem and then it started from this project named as Jenkins. So, Jenkins has become more popular over the last few years.</p><p><a href="http://jenkins-ci.org/"><strong><em>Jenkins</em></strong></a><strong><em> is an extensible, open source continuous integration server. It builds and tests your software continuously and monitors the execution and status of remote jobs, making it easier for team members and users to regularly obtain the latest stable code.</em></strong></p><p><strong>What is Continuous Integration(CI) ?</strong></p><p><strong><em>Continuous Integration(CI) is a continuous process of of merging new code into the centralized repository.</em></strong> You can easily find the issues if there are any. The static code checking is perform in this process to catch the bugs earlier. The unit test plays the important role in this process to validate the code merge into the centralized repository. It is best practice to have a build server designed specifically for performing these tests so your development team can continue merging requests even while tests are being performed.</p><p><strong><em>“Continuous Integration(CI) doesn’t get rid of bugs, but it does make them dramatically easier to find and remove”</em> — Martin Fowler, Chief Scientist, ThoughtWorks.</strong></p><p>Code changes made by individual team members are merged together into end-to-end working software, which we called as Integration phase. It’s hard work which often results in code conflicts, difficult to find bugs, code redundancies and and difficult to fix them which leads to software delivery delay. So, with this above approach in agile methodology, we can overcome all these difficulties as today’s businesses need new features to be incorporated into application with a day or week. This required the change of software delivery lifecycle.</p><p>Jenkins is the ultimate CI tool. It is a cross platform continuous integration application. Jenkins is used to build and test softwares continuously making it easier for developers to build software rapidly. It’s a plug and play as it can not do most work without respective plug-in’s. As continuous integration evolved, the industry created the notion of continuous delivery and continuous deployment to render production deployments a non-issue. These automated tools allow us to achieve checking code from your machine to deploying it into production system seamlessly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*RpcQ2CV0tTYDokmF33BTAQ.jpeg" /></figure><h3>Objective :</h3><p>Setup up an infrastructure such as there are three teams/environments :</p><ol><li>Production Team</li><li>Testing Team</li><li>Quality Assurance Team</li></ol><p>A working code is deployed by Production Team. Now a new product update comes and the developer creates a branch (dev1) from master node using git. QA team checks the code and merge both master and dev1 nodes. We have to automate this process using Jenkins. This Project is a part of DevOPS training By Mr. Vimal Daga.</p><h3>Requirements :</h3><ol><li>Rhel 8- as a base for Docker</li><li>Docker Image- http</li><li>Git bash on Windows</li><li>ngrok to create a tunnel for network to connect to IPs outside the private network</li><li>Github and WebHooks</li></ol><h3>My Approach</h3><ol><li>Made 3 Jobs for testing(Newjob1), production (Newjob2) and Quality Assurance(Newjob3)</li></ol><h3>Process :</h3><h3>Operations Side:</h3><ol><li>My job 1 and job2 will get their code from the github (from their respective branches =&gt; master:production, dev:testing)</li><li>Both the containers have diferent web addresses so the quality team can monitor both</li><li>Quality team continously checks for changes in testing environemnt, and decides wether to approves it or not</li><li>On approval QA team manually builds the job3</li><li>Since job three is the upstream job of job2 and job1 , so on succesfull approval foloowong things will happen:</li><li>Dev and Master branch will be merged</li><li>Code will be pushed to the github</li><li>job 1 and job2 will be build</li><li>ngrok will be running in the system to provide public accessable addres so that github webhook will work and production site can be accessible to the public</li></ol><h3>STEPS:</h3><ol><li>Created a hook for post-commit and post-merge so the developer need not to be manually push the code every time he commits</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*kXK2Y81ym4HHgxK_OBOItA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*NmbTmoR1aDpR4Nw13j0Ckg.jpeg" /></figure><p>2. Added The webhooks to the Jenkins Github API :=&gt; ip/github-webhook/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*snZjQUq76yDdfSg8TvIhPQ.jpeg" /></figure><p>3. In Jenkins-</p><ul><li>Job1(branch) Configurations-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RcODiJZDb_chpVYDP8-Enw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Qcnpy6HnaxFK3myCN7wWw.jpeg" /></figure><ul><li>Job2(master) configuration-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aHlXeHzDxt44eA-ssJrK1g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dUDGBKUssZbvDCSil5vg5w.jpeg" /></figure><ul><li>Job3 (to merge) configuration-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9HSOJ4XYvIw-8c5y90jS7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cT6iKsKoDGs_G2vRMru1nw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dIjW7Nb9jBLgG5E_M6WeKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*tIJl60MyrzOjBMfO0-WzKQ.png" /></figure><p>4. ngrok on rhel</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*gHRLtNrKSXU1PG15CHeLdA.png" /></figure><p>5. now we commit through developer and then job3 will automatically runs and merge both the master and branch(dev1)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*o7copesZ0ggKjhsHs_NQDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*zy4lqNs_eFsCiQCOL7DdVQ.png" /></figure><h3>Diagram:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*lBUC1rl6nHhOkwJSDxLjIg.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=296813c60595" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>