<?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 Amrit Das on Medium]]></title>
        <description><![CDATA[Stories by Amrit Das on Medium]]></description>
        <link>https://medium.com/@amritdas1998?source=rss-d47372ae1d73------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*bQKkyeQR194FJp1d</url>
            <title>Stories by Amrit Das on Medium</title>
            <link>https://medium.com/@amritdas1998?source=rss-d47372ae1d73------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 00:24:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amritdas1998/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[Add SSL certificate to your Website for Free (aws EC2 Instance)]]></title>
            <link>https://medium.com/maketechsimple/add-ssl-certificate-to-your-website-for-free-aws-ec2-instance-5c7496c9d6b6?source=rss-d47372ae1d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c7496c9d6b6</guid>
            <dc:creator><![CDATA[Amrit Das]]></dc:creator>
            <pubDate>Sun, 21 May 2023 19:36:43 GMT</pubDate>
            <atom:updated>2023-05-21T19:42:15.969Z</atom:updated>
            <content:encoded><![CDATA[<p>Cutting directly to the topic, use the following few commands to get SSL Certificate on your AWS EC2 Instance.</p><p><strong>This section is specifically for AWS EC2 where you are hosting your site with NGINX, If you are using any other service look below.</strong></p><p>SSH to your EC2 Instance, and use the following commands.</p><pre>sudo snap install core<br>sudo snap refresh core<br>sudo snap install --classic certbot<br><br>sudo ln -s /snap/bin/certbot /usr/bin/certbot<br><br>sudo certbot --nginx</pre><p>To check if SSL is properly installed check your website with `<em>https</em>`. <br>For example: If your websites domain name is ‘<em>test.com’ use ‘https://test.com’.</em></p><p><strong>If installing on any other medium other than amazon ec2 or nginx, please visit ‘</strong><a href="https://certbot.eff.org/">https://certbot.eff.org</a>’. On the website, select the Software (Nginx, Apache etc) and System (Ubuntu, Windows), it will generate the necessary commands for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rWSJRXBXfboaIS4Qt0M0jw.png" /></figure><p>The inorder to upgrade your website from <em>HTTP </em>to <em>HTTPS, this service is provided by </em><a href="https://letsencrypt.org/">https://letsencrypt.org</a>.</p><p>Hope this helps !!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c7496c9d6b6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/maketechsimple/add-ssl-certificate-to-your-website-for-free-aws-ec2-instance-5c7496c9d6b6">Add SSL certificate to your Website for Free (aws EC2 Instance)</a> was originally published in <a href="https://medium.com/maketechsimple">maketechsimple</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom Image Classifier Using Transfer Learning in PyTorch FrameWork]]></title>
            <link>https://medium.com/hardware-interfacing/custom-image-classifier-using-transfer-learning-in-pytorch-framework-c2f7f5155239?source=rss-d47372ae1d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2f7f5155239</guid>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Amrit Das]]></dc:creator>
            <pubDate>Sat, 15 Dec 2018 13:38:05 GMT</pubDate>
            <atom:updated>2018-12-17T11:22:05.042Z</atom:updated>
            <content:encoded><![CDATA[<p>So, the first step is to Install PyTorch Package. You can get the instructions from <a href="https://pytorch.org/"><strong>pytorch.org</strong></a><strong>. </strong>Following the instruction, install Pytorch in your PC. If you are using a dev-board like Raspberry-Pi or Odroid etc with arm architecture, you can follow up the instruction <a href="https://medium.com/hardware-interfacing/how-to-install-pytorch-v4-0-on-raspberry-pi-3b-odroids-and-other-arm-based-devices-91d62f2933c7">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*JvdgoJHUqsozOUSGXQvkgw.png" /></figure><p>Once you have installed <strong>torch</strong> and <strong>torchvision</strong> libraries, we can test our output by typing the following script on Python IDE.</p><pre>&gt;&gt;&gt; from __future__ import print_function<br>&gt;&gt;&gt; import torch<br>&gt;&gt;&gt; import torchvision<br>&gt;&gt;&gt; x = torch.rand(5,3)<br>&gt;&gt;&gt; print (x)</pre><p>The output should be something similar to:</p><pre>tensor([[0.3380, 0.3845, 0.3217],<br>        [0.8337, 0.9050, 0.2650],<br>        [0.2979, 0.7141, 0.9069],<br>        [0.1449, 0.1132, 0.1375],<br>        [0.4675, 0.3947, 0.1426]])</pre><p>Well if you got the output, let us clone our GitHub repository and move inside the repository to download some few requirements.</p><pre>cd custom_image_classifier_pytorch</pre><pre>sudo pip install -r requirements.txt</pre><p>The ‘ <em>pip install -r requirements.txt</em>’ will install the additional required Python-Packages.</p><p>We have successfully set up the environment and ready to train on our data. But for that, we will require a dataset. You can use your own custom dataset or you can download the dataset I’ll be using for the tutorial <a href="https://download.pytorch.org/tutorial/hymenoptera_data.zip">here</a>.</p><p>So my dataset has 2 classes namely <strong>ants </strong>and <strong>bees</strong>. So here we intend to train a model that should be able to differentiate between ants and bees. The ants-bees dataset is already pre-arranged into <strong>train</strong> and<strong> test</strong> datasets and you can add this to your /Dataset/ folder.</p><p>The overall directory structure should be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*FH_JnL5SDN4RAcjhI5eyhw.png" /><figcaption>Structure for the Dataset</figcaption></figure><p>The next step is to change the ‘<strong>hyper_params.json</strong>’ file.</p><p>The JSON file contains a key: value pair of all the hyperparameters like batch size, no. of classes, learning rate, no. of epochs etc. Now, if you are not getting your desired accuracy, you can play around with the parameters but it’s advisable to make a copy of the original JSON file before doing so.</p><p>Right now I’ll only change the parameter number of classes to 2 (<strong>ants and bees</strong>).</p><pre>{<br>    &quot;root_directory&quot;    :   &quot;Dataset&quot;,<br>    &quot;num_classes&quot;       :   2,<br>    &quot;num_epochs&quot;        :   25,<br>    &quot;batch_size&quot;        :   12,<br>    &quot;num_workers&quot;       :   4,<br>    &quot;learning_rate&quot;     :   0.001,<br>    &quot;optimizer&quot;         :   &quot;SGD&quot;    <br>    &quot;loss&quot;              :   &quot;Cross Entropy&quot;,<br>    &quot;momentum&quot;          :   0.9,<br>    &quot;step_size&quot;         :   7,<br>    &quot;gamma&quot;             :   0.1<br>}</pre><p>This is what my modified hyper_params.json file looks like.</p><p><strong>Training the Network</strong></p><p>Once done with structuring the Dataset and modifying the hyperparameters, we can finally train our network as follows.</p><pre>python train.py</pre><p>If everything is fine, you should get an output like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*uX-KN5TXIBarS0qZ4ca7lQ.png" /><figcaption>Training Summary</figcaption></figure><p>The trained model will be saved in the /models/ folder and the folder will look similar to :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*z3JyagC1ylf_LOz_1GElfA.png" /><figcaption>models/</figcaption></figure><p>The last trained model will have the best weights ( in my case custom_model9.model). So we will use this model for predicting the inference.</p><p>** It has been modified to store only the best result and discard the rest. The best model will be stored as /models/trained.model.</p><p><strong>Deploying the trained model:</strong></p><p>To deploy the trained model, place your image_to_be_predicted.jpg( in my case ant.jpg) in the folder Predict_Image/.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*4fWIuobxxZtZQGjC5FsKnw.png" /></figure><p>Use the predict.py model along with adequate arguments to predict the model.</p><pre># To Predict the class of image<br>python predict.py </pre><pre># To Segregate batch of images into folders<br>python predict.py --seg</pre><p>The script will predict your output and you will get the result as:</p><pre>prediciton in progress<br>(&#39;Time taken = &#39;, 0.45947909355163574)<br>(&#39;Predicted Class: &#39;, &#39;ants&#39;)</pre><p>I will soon be uploading the tutorial that will teach to make an Image classifier from scratch!</p><p>I am currently a 3rd Year ECE student from SRM Institute of Science and Technology and a member of <a href="https://www.facebook.com/srmteamhumanoid/">SRM Team Humanoid</a> where I work as a Computer Vision Engineer. You can connect to me at my <a href="http://amrit.strikingly.com/">page</a> or look of more what I do at my <a href="http://github.com/amrit-das">Git Repo</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2f7f5155239" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hardware-interfacing/custom-image-classifier-using-transfer-learning-in-pytorch-framework-c2f7f5155239">Custom Image Classifier Using Transfer Learning in PyTorch FrameWork</a> was originally published in <a href="https://medium.com/hardware-interfacing">Amrit Das</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to install PyTorch v4.0+ on Raspberry Pi-3B+, Odroids, and other ARM-based devices]]></title>
            <link>https://medium.com/hardware-interfacing/how-to-install-pytorch-v4-0-on-raspberry-pi-3b-odroids-and-other-arm-based-devices-91d62f2933c7?source=rss-d47372ae1d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/91d62f2933c7</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[odroid]]></category>
            <category><![CDATA[installation]]></category>
            <category><![CDATA[pytorch]]></category>
            <dc:creator><![CDATA[Amrit Das]]></dc:creator>
            <pubDate>Wed, 12 Dec 2018 07:47:59 GMT</pubDate>
            <atom:updated>2018-12-14T05:30:30.690Z</atom:updated>
            <content:encoded><![CDATA[<p>Installing Neural Network Frame Works on ‘ARM’ or ‘aarch’ based architectures are a real pain. Most of us reading here would have tried hell lot of commands and flags to pass through few errors. Neural Network has taken the over the world by amazement while aiding in various fields that were not even possible a couple years back. Now that we are comfortable with using these frameworks, we look forward to deploying these frameworks in mobile devices for various projects. By far Caffe is the only framework that easily accommodates itself with ARM devices. Tensorflow Lite is a work on progress.</p><p>I find working on PyTorch environment comfortable due to several reasons, like it’s completely python-based, the simplicity of usage and its dynamic approach to graph computation. Now installing PyTorch in a 64 bit PC is a piece of cake implementing the same on an arm-based/32-bit architecture is ‘Welcome To The Hell!’</p><h3>Step by Step Procedures on How to Install PyTorch from Source —</h3><p><strong>Pre-Installation notes: </strong>It’s a personal recommendation to use a 16 GB or 32 GB SD card. You can either go for the raspbian image or Ubuntu-mate (if at all GUI is necessary to you). Once you are done with Installation, update and upgrade from the terminal and install Vim ( or use nano/gedit or any other text editor)</p><pre>sudo apt update &amp;&amp; sudo apt upgrade</pre><pre>sudo apt install vim</pre><p><strong>Add extra SWAP memory: </strong>If you don’t want to get ‘Memory exhausted’ or ‘Cannot Allocate Memory’, increase you swap memory.</p><pre>sudo dd if=/dev/zero of=/swap1 bs=1M count=2048<br>sudo mkswap /swap1<br>sudo vim /etc/fstab</pre><p>This will open up your fstab file. You may or may not have a swap file. If you see something like,</p><pre>/swap0 swap swap</pre><p>You already had a swap so replace that line with the following( if the line is absent add the following line to your fstab file)</p><pre>/swap1 swap swap</pre><p>Reboot your machine, to recognize the new swap space</p><p><strong>Install prerequisite packages:</strong></p><pre>sudo apt install libopenblas-dev libblas-dev m4 cmake cython python3-dev python3-yaml python3-setuptools</pre><p>You can also try with python 2.7 but I am not sure there won’t be any errors. The PyTorch developers call for python3.</p><p><strong>Get the PyTorch from their official Github Repo:</strong></p><pre>mkdir pytorch_install &amp;&amp; cd pytorch_install<br>git clone --recursive <a href="https://github.com/pytorch/pytorch">https://github.com/pytorch/pytorch</a><br>cd pytorch</pre><p><strong>Setup Environment Variables:</strong></p><pre>export NO_CUDA=1<br>export NO_DISTRIBUTED=1<br>export NO_MKLDNN=1 <br>export NO_NNPACK=1<br>export NO_QNNPACK=1</pre><p>Most of the dev boards won’t have an NVIDIA GPU and nor does the Pi. So the no_cuda flag will make sure that the compiler doesn’t look for cuda files. Similarly, mkl_dnn is not available for 32-bit machines and it also shows error in 64-bit machines too. So it’s better turned OFF. In any case, if you reboot your machine or change terminal, add the environment variables again.</p><p><strong>Build: </strong>Here you start building the process and I would suggest having patience as this is going to cost you more than 2 hours in a Raspberry Pi 3B+. You might put this on and go for a shopping or probably watch some PyTorch Tutorials.</p><pre>python3 setup.py build</pre><p>You should not encounter error but if you encounter any error like below,</p><pre>Failed to run &#39;bash tools/build_pytorch_libs.sh --use-cuda --use-nnpack --use mkldnn --use qnnpack caffe2&#39;</pre><p>Probably you have not set the environment variables correctly so just ‘make clean’ follow the environment variable setup part again and build.</p><p>Once you have finished Building without any error,</p><pre>sudo -E python3 setup.py install</pre><p>You shouldn’t skip the ‘-E’ as this flags ensure to force use the environment variables.</p><p>If everything goes right, you should be able to use ‘PyTorch’ without any errors. Also, the PyTorch folder has its own torch folder inside the PyTorch folder so if you try to ‘import torch’ while inside the folder, you will encounter errors. So in order to test your installation,</p><pre>cd <br>python3<br>&gt;&gt;&gt; from __future__ import print_function<br>&gt;&gt;&gt; import torch<br>&gt;&gt;&gt; a = torch.rand(5,3)<br>&gt;&gt;&gt; print (a)</pre><p>If you get an output similar to</p><pre>tensor([[0.3380, 0.3845, 0.3217],<br>        [0.8337, 0.9050, 0.2650],<br>        [0.2979, 0.7141, 0.9069],<br>        [0.1449, 0.1132, 0.1375],<br>        [0.4675, 0.3947, 0.1426]])</pre><p>Yes you have successfully installed PyTorch in your dev-board!</p><p>I am currently a 3rd Year ECE student from SRM Institute of Science and Technology and a member of <a href="https://www.facebook.com/srmteamhumanoid/">SRM Team Humanoid</a> where I work as a Computer Vision Engineer. You can connect to me at my <a href="http://amrit.strikingly.com/">page</a> or look of more what I do at my <a href="http://github.com/amrit-das">Git Repo</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91d62f2933c7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hardware-interfacing/how-to-install-pytorch-v4-0-on-raspberry-pi-3b-odroids-and-other-arm-based-devices-91d62f2933c7">How to install PyTorch v4.0+ on Raspberry Pi-3B+, Odroids, and other ARM-based devices</a> was originally published in <a href="https://medium.com/hardware-interfacing">Amrit Das</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>