<?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 Shayan Ali Bhatti on Medium]]></title>
        <description><![CDATA[Stories by Shayan Ali Bhatti on Medium]]></description>
        <link>https://medium.com/@bhatt226?source=rss-be3073cc7349------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5XbcJENCtt9lPtFxaAP7oA.jpeg</url>
            <title>Stories by Shayan Ali Bhatti on Medium</title>
            <link>https://medium.com/@bhatt226?source=rss-be3073cc7349------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 15:17:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bhatt226/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[Store Empty Inventory Detector using YOLOv5]]></title>
            <link>https://medium.com/analytics-vidhya/store-empty-inventory-detector-using-yolov5-57292614231?source=rss-be3073cc7349------2</link>
            <guid isPermaLink="false">https://medium.com/p/57292614231</guid>
            <category><![CDATA[yolov5]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Shayan Ali Bhatti]]></dc:creator>
            <pubDate>Tue, 16 Mar 2021 20:10:59 GMT</pubDate>
            <atom:updated>2022-03-14T15:25:26.497Z</atom:updated>
            <content:encoded><![CDATA[<h3>Grocery Store Empty Inventory Detector using YOLOv5</h3><p>The success of deep learning to solve complex problems is not hidden from anyone these days. Deep learning is helping automate problems in all walks of life. In this article, I present the application of YOLOv5, a deep learning based algorithm, to detect empty inventory in grocery stores.</p><p>Usually, when we go to a grocery store, and we see a shelf that doesnt have the product we need, then many customers would leave without asking the store workers if they have that item. Even if the store had that item in their warehouse. This can cause the store to lose out on potential sales for as long as the inventory remains empty. The system I designed using YOLOv5 can help stores replenish inventory quickly so that they dont lose customers and sales.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F4a4O-INhB7qsTmvImrnvg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4ad9V4mq-HPkPS15m5QrA.jpeg" /></figure><h3>Requirements</h3><p>For this project, we need:</p><ol><li>YOLOv5, a great work by Glenn Jocher, present at <a href="https://github.com/ultralytics/yolov5">https://github.com/ultralytics/yolov5</a></li><li>SKU dataset, present at <a href="https://retailvisionworkshop.github.io/detection_challenge_2020/">https://retailvisionworkshop.github.io/detection_challenge_2020/</a></li><li>If you have a dataset of your store, even better.</li><li>LabelImg, a great and simple-to-use annotation tool, present at <a href="https://github.com/tzutalin/labelImg">https://github.com/tzutalin/labelImg</a></li><li>Bounding box augmentation tool, (if you want to augment the already annotated images and not annotate more images), present at <br><a href="https://github.com/mukopikmin/bounding-box-augmentation">https://github.com/mukopikmin/bounding-box-augmentation</a></li></ol><h3>Process</h3><p>First, we are going to use the SKU dataset. The SKU dataset is specifically for detecting items in grocery store shelves and refrigerators. SKU has all images and the annotations for each item on the shelf. But for our application, we don’t need the annotations of items on shelves. We want the opposite of that. Because we are only going to use those images in which the inventory was empty for any product(s) on the shelf.</p><p><strong>Annotation</strong></p><p>For annotation, we use <strong>LabelImg</strong> tool, to annotate the voids in any image of our application as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZYbdGctM6LUzZ692oLp4ug.png" /></figure><p><strong>Augmentation</strong></p><p>If you dont have abundant image samples, then use the augmentation code mentioned in the requirements above, which adds different kinds of augmentations and also augments the bounding boxes annotated in the image.</p><p>For augmentation, once you are done annotating the images using the above LabelImg tool, put all the images and their annotations (.xml) files in the “input” folder of the above downloaded Bounding Box Augmentation repository. Then run the following command:</p><pre>pipenv run python augment.py</pre><p>By default, this will augment each image and its annotation present in the “input” folder, to 10 times. To increase this, one can change the AUGMENT_SIZE in the augment.py file in the repository.</p><h3>Training</h3><p>To train the void detector model, I used YOLOv5 and trained the yolov5m model for 300 EPOCHS on a 12 GB NVIDIA GeForce RTX2080 GPU. The data I used included few grocery store shelf images and around 100 images from SKU dataset, that I annotated myself and augmented by a factor of 10. In total, I had 1254 images. The mAP@0.5 score came out to be 0.82.</p><h3>Results</h3><p>The inference results of shelf void detection are as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F4a4O-INhB7qsTmvImrnvg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4ad9V4mq-HPkPS15m5QrA.jpeg" /></figure><p>Developers can also store the co-ordinates of voids in database and compare with new data lets say, after 2 hours, to find out if previous voids persist or not. If they persist then those voids should be prioritized and will let stores know what items need urgent attention and have not been replenished in a long time. For this task, simply new and previous void boxes’s IoU(Intersection over Union) needs to be computed and if its greater than 0.5 then that means the void is persisting and has been there for some time. Hope that makes sense.</p><h3>Conclusion</h3><p>Deep learning, despite of its large success, still has many uncharted territories to conquer. In this article, I presented one such application that can let stores know where they are out of inventory. This system when implemented, can help stores achieve higher sales, that they would otherwise lose, due to the late replenishment of inventory. Please show appreciation if you liked the article, by claps, so that I have more motivation to share my work.</p><h3>Special Thanks</h3><p>Special thanks to the people who designated me with this task and the developer of YOLOv5, Mr. Glenn Jocher.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57292614231" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/store-empty-inventory-detector-using-yolov5-57292614231">Store Empty Inventory Detector using YOLOv5</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[Tackling Class Imbalance for Object Classification Using YOLOv5 with a 2 Model Approach]]></title>
            <link>https://medium.com/analytics-vidhya/tackling-class-imbalance-for-object-classification-using-yolov5-with-a-2-model-approach-4b77f0ffe298?source=rss-be3073cc7349------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b77f0ffe298</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[yolov5]]></category>
            <dc:creator><![CDATA[Shayan Ali Bhatti]]></dc:creator>
            <pubDate>Thu, 25 Feb 2021 19:30:19 GMT</pubDate>
            <atom:updated>2022-06-16T17:07:35.110Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the age of Artificial Intelligence and it is governed by deep learning specially for image classification tasks in which an image can have lots of information that is of our interest. To extract and identify this information, deep learning based techniques are used. Some of those techniques include segmentation using RCNN or fast object detection using the YOLO series of deep learning models etc.</p><p>These models do amazingly well in finding granular level information from images and giving the desired results. However, training these models requires:</p><ol><li>Lots and lots of diverse data.</li><li>Maintaining class balance between different classes of data we aim to classify in images.</li><li>Great Hardware i.e. high performance GPUs for training data</li><li>And last but not the least, it can take days to train deep learning models.</li></ol><p>Thus, after these steps if you want to add another class to the data then it might mean either changing the model’s last layer’s output to accommodate for the new class and retraining only last few layers OR in worse case, retraining the model with all data of new class too. And do the same for every new class(es) you want to add to previous trained model, which will be hectic.</p><p>To remedy that, in this article, I propose the use of 2 models for object classification using YOLOv5. First model will be YOLO, whose responsibility will be to just identify super classes. Second model will be an image classifier that will take the desired superclass that we want and further classify it into subclass.</p><h3>Procedure:</h3><p>Following simple steps can be followed:</p><ol><li>Train the YOLO model with images of only the super classes you anticipate to predict. Thus training data images will only be annotated with super classes. YOLO will tell us where super classes are located. For example, if we want to identify person and product, then the super classes can be Person class and Object class as shown below:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*0HgfOPx_yawW280JXO4LFg.png" /></figure><p>2. Now, Object is what we aim to classify if it is pepsi or coca-cola or whatever. Thus, from YOLO model’s output, we will get all the objects in the image labeled as “Object” and send them to an image classifier to get the name of that object.</p><p>3. For this, take an image classifier of choosing (Resnext etc.) and train it with the images of sub class you desire to predict. For example, if we want to identify pepsi then we can train image classifier with images of just Pepsi and so on .. as many products as we anticipate to see.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/67/1*1BjMv9dwIal6mYwILxTO7A.png" /></figure><p>4. In the end, YOLO will tell us what super classes in image are, and Image classifier will tell us what the subclasses actually are.</p><p>Here is how workflow looks in essence:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*t7IwdhXCvuyaM8wGxZu7rw.png" /></figure><p><strong>Advantages:</strong></p><ol><li>This approach gives us the liberty to collect data even from Google Images for sub class as we dont have to collect samples of the desired product in a fixed environment and deal with class imbalance. We can simply get the images of sub class from Google and augment them. For example, if in retail context, we aim to classify what product is being sold then if we were to use only YOLO, then we will have to have samples of one particular product hundreds of times so that model could learn it, and same process for all products. Thus, single model approach will become impractical where the products that we aim to observe, are many more.</li><li>No need to keep retraining YOLO model for days if it does well on superclasses.</li><li>Any addition in subclass will only need training of image classifier which is not as extensive as retraining the YOLO model.</li></ol><p><strong>Link To Code:</strong></p><p>I used the default YOLOv5 code from Ultralytics, which is an amazing work by Mr. Glenn Jocher, and converted the repository to have 2 stage detection support for a ResNext model. Currently, the code is good for 2 cases i.e. same super class and subclass and one superclass and subclass but can be editted to provide more super class support.</p><p>Here is the link of my Github code that you can use to convert a default YOLOv5 into a 2 stage detector that i explained above.</p><p><a href="https://github.com/necla-ml/yolov5">necla-ml/yolov5</a></p><p><strong>Conclusion:</strong></p><p>Deep learning models are amazing for object detection but, come with the resource extensiveness, and require training for good amount of time. But using smart techniques this training time can be reduced. If the technique and code helps, then please give credit by mentioning my name and profile.</p><p><strong>Special Thanks:</strong></p><p>I would like to thank the people who trusted me with this task and to Glenn Jocher and the developers behind YOLOv5.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b77f0ffe298" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/tackling-class-imbalance-for-object-classification-using-yolov5-with-a-2-model-approach-4b77f0ffe298">Tackling Class Imbalance for Object Classification Using YOLOv5 with a 2 Model Approach</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[Video Augmentation for Machine Learning]]></title>
            <link>https://medium.com/analytics-vidhya/video-augmentation-for-machine-learning-5e1c720e95ad?source=rss-be3073cc7349------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e1c720e95ad</guid>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[image-augmentation]]></category>
            <category><![CDATA[python3]]></category>
            <dc:creator><![CDATA[Shayan Ali Bhatti]]></dc:creator>
            <pubDate>Mon, 28 Dec 2020 04:29:44 GMT</pubDate>
            <atom:updated>2021-01-16T16:21:19.995Z</atom:updated>
            <content:encoded><![CDATA[<h3>Video Augmentation for Machine Learning Using Multithreading</h3><p>In this article, a simple implementation of fast video augmentation is explained, to increase the number of videos for machine learning training tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*r3N3_0ROm0NaHcVOKcvMDg.jpeg" /></figure><h3>Introduction:</h3><p>In machine learning, a lot of times we have to deal with data that is insufficient to train the model to work properly. For image processing based tasks, we remedy this by augmenting our data with different techniques such as rotation, noise addition, cropping, altering brightness etc. so that our model can generalize well to all kinds of input data and be able to take the right decisions.</p><p>For image based tasks, we can use any number of augmentation methods. Keras library provides ImageDataGenerator function, then Pytorch has some functions and there is one library called “imgaug” that allows augmentation with different specifications too. For this task, I used “imgaug” to augment videos.</p><p>To augment video, the process is mostly same as image augmentation because a video is actually a collection of pictures (frames) ran fast on screen at a speed referred to as Frames Per Seconds (FPS), thus making it a video.</p><h3>Process:</h3><p>Simply put, we will fetch each frame of input videos, find FPS, augment them using imageio, and use OpenCV to create the augmented video with the original FPS. The whole process is done using ThreadPoolExecutor to speed up the process by executing augmentation in separate threads.</p><h3>Pre-requisites:</h3><p>The libraries that come in handy for video augmentation are as follows:</p><ol><li>Opencv — To get input video FPS (Can be installed using pip install opencv-python)</li><li>imgaug — for Image augmentation (Can be installed using pip install imgaug)</li><li>imageio — for video reading and image writing (Can be installed using pip install imageio)</li><li>imageio-ffmpeg — for creating video from images (Can be installed using pip install imageio-ffmpeg)</li></ol><p>Rest are basic libraries os, shutil (for creating/removing folders), random (for generating random numbers) and argparse (to fetch command line arguments).</p><h3><strong>Link To Code:</strong></h3><p>The code for video augmentation can be accessed on Github at:</p><p><a href="https://github.com/shayanalibhatti/Video-Augmentation-Code">https://github.com/shayanalibhatti/Video-Augmentation-Code</a></p><h3>Result:</h3><p>For augmentation of videos, I have used a random number generator to rotate output video at an angle, and did same for Additive Gaussian noise to be added to videos. Here is the result of the code, (unfortunately) a rotated and noise added snap of each clip, as video cannot be uploaded here. It is just to show how the augmentation works. Feel free to try on your own clips to see augmented videos. Following video used for input is by <a href="https://pixabay.com/users/2322922-2322922/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2637">Nicolas Boulard</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2637">Pixabay</a> (<a href="https://pixabay.com/videos/countdown-10-seconds-film-2637/">https://pixabay.com/videos/countdown-10-seconds-film-2637/</a>)</p><h4>Input video snapshot:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VRgd9yHFUSp-ePjQXPOvpQ.png" /></figure><h4>Output videos snapshot:</h4><p>Following image shows the rotated and noise added, augmented .mp4 video clips. Try the code to see the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8WsofiR8nYgM6Acgn0P4cg.jpeg" /></figure><h3>Conclusion:</h3><p>Hopefully this article and link to code can be used to make it easier for machine learning enthusiasts to augment their videos to come up with robust models to solve real-world problems. Feel free to experiment with the code and tweak it to your liking. And if the code helps, give a clap :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e1c720e95ad" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/video-augmentation-for-machine-learning-5e1c720e95ad">Video Augmentation for 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[Retail Store Item Detection using YOLOv5]]></title>
            <link>https://medium.com/analytics-vidhya/retail-store-item-detection-using-yolov5-7ba3ddd71b0c?source=rss-be3073cc7349------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ba3ddd71b0c</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[yolov5]]></category>
            <dc:creator><![CDATA[Shayan Ali Bhatti]]></dc:creator>
            <pubDate>Sat, 04 Jul 2020 23:15:31 GMT</pubDate>
            <atom:updated>2020-07-13T13:00:51.090Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I present an application of the latest version of popular deep learning algorithm YOLO i.e. YOLOv5, to detect items present in a retail store shelf. This application can be used to keep track of inventory of items simply using images of the items on shelf.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*QsiP9Yjx8KNHLq2BSkykYg.png" /></figure><h3><strong>Introduction</strong></h3><p>Object detection is a computer vision task that requires object(s) to be detected, localized and classified. In this task, first we need our machine learning model to tell if any object of interest is present in the image. If present, then draw a bounding box around the object(s) present in the image. In the end, the model must classify the object represented by the bounding box. This task requires fast object detection so that it can be implemented in real-time. One of its major applications is its use in real-time object detection in self-driving vehicles.</p><p>Joseph Redmon, et al. originally designed YOLOv1, v2 and v3 models that perform real-time object detection. YOLO “You Only Look Once” is a state-of-the-art real-time deep learning algorithm used for object detection, localization and classification in images and videos. This algorithm is very fast, accurate and at the forefront of object detection based projects.</p><p>Each of the versions of YOLO kept improving the previous in accuracy and performance. Then came YOLOv4 developed by another team, further adding to performance of model and finally the YOLOv5 model was introduced by Glenn Jocher in June 2020. This model significantly reduces the model size (YOLOv4 on Darknet had 244MB size whereas YOLOv5 smallest model is of 27MB). YOLOv5 also claims a faster accuracy and more frames per second than YOLOv4 as shown in graph below, taken from <strong>Roboflow.ai’s</strong> website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vh2in4Pw58sMbrJO.png" /><figcaption>Fig 1.1: YOLOv5 is faster than EfficientDet model</figcaption></figure><p>More details about how YOLO works can be found on internet. In this article, I will only focus on the use of YOLOv5 for retail item detection.</p><h3>Objective</h3><p>To use YOLOv5 to draw bounding boxes over retail products in pictures using SKU110k dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*QsiP9Yjx8KNHLq2BSkykYg.png" /><figcaption>Fig 1.2: Store shelf image (on left) vs desired output with bounding box drawn on objects (right)</figcaption></figure><h3>Dataset</h3><p>To do this task, first I downloaded the SKU110k image dataset from the following link:</p><p><a href="http://trax-geometry.s3.amazonaws.com/cvpr_challenge/SKU110K_fixed.tar.gz">http://trax-geometry.s3.amazonaws.com/cvpr_challenge/SKU110K_fixed.tar.gz</a></p><p>The SKU110k dataset is based on images of retail objects in a densely packed setting. It provides training, validation and test set images and the corresponding .csv files which contain information for bounding box locations of all objects in those images. The .csv files have object bounding box information written in the following columns:</p><p><em>image_name,x1,y1,x2,y2,class,image_width,image_height</em></p><p>where x1,y1 are top left co-ordinates of bounding box and x2,y2 are bottom right co-ordinates of bounding box, rest of parameters are self-explanatory. An example of parameters of train_0.jpg image for one bounding box, is shown below. There are several bounding boxes for each image, one box for each object.</p><p><em>train_0.jpg, 208, 537, 422, 814, object, 3024, 3024</em></p><p>In the SKU110k dataset, we have 2940 images in the test set, 8232 images in the train set and 587 images in the validation set. Each image can have varying number of objects, hence, varying number of bounding boxes.</p><h3>Methodology</h3><p>From the dataset, I took only 998 images from the training set and went to Roboflow.ai website which provides online image annotation service in different formats including YOLOv5 supported format. The reason for picking only 998 images from training set is that the Roboflow.ai’s<strong> </strong>image annotation service is free for the first 1000 images only.</p><p><strong>Preprocessing</strong></p><p>Preprocessing of images includes resizing them to 416x416x3. This is done on <strong>Roboflow’s </strong>platform. An annotated, resized image is shown in figure below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*AnPrhjG5vRS3BvAhv69dOw.jpeg" /><figcaption>Fig 1.3: Image annotated by Roboflow</figcaption></figure><p><strong>Automatic Annotation</strong></p><p>On Roboflow.ai website, the bounding box annotation .csv file and images from training set are uploaded and Roboflow.ai’s<strong> </strong>annotation service automatically draws bounding boxes on images using the annotations provided in the .csv files as shown in image above.</p><p><strong>Data Generation</strong></p><p>Roboflow also gives option to generate a dataset based on user defined split. I used 70–20–10 training-validation-test set split. After the data is generated on Roboflow, we get the original images as well as all bounding box locations for all annotated objects in a separate text file for each image, which is convenient.</p><p>Finally, we get a link to download the generated data with label files. This link contains a key that is restricted to only your account and is not supposed to be shared.</p><h3><strong>Hardware Used</strong></h3><p>The model was trained on Google Colab Pro notebook with Tesla P100 16GB Graphics Card. It costs $9.99 and it is good for a month’s use. Google Colab notebook can also be used which is free but usage session time is limited.</p><h3>Code</h3><p>I recommend using the Google Colab notebook provided by Roboflow.ai at<br><a href="https://models.roboflow.ai/object-detection/yolov5">www.models.roboflow.ai/object-detection/yolov5</a><br>It is originally trained for COCO dataset but can be tweaked for custom tasks which is what I did. I started by cloning YOLOv5 and installing the dependencies mentioned in requirements.txt file. Also, the model is built for Pytorch, so I import that.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5eeeac2ed5397361bf433ff83bc0df0b/href">https://medium.com/media/5eeeac2ed5397361bf433ff83bc0df0b/href</a></iframe><p>Next, I download the dataset that I created at Roboflow.ai. The following code will download training, test and validation set and annotations too. It also creates a .yaml file which contains paths for training and validation set as well as what classes are present in our data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8d4a13fe2a1ba7adaf8d7cdc80cbea8/href">https://medium.com/media/e8d4a13fe2a1ba7adaf8d7cdc80cbea8/href</a></iframe><p>This file tells the model the location path of training and validation set images alongwith the number of classes and the names of classes. For this task, number of classes is “<strong>1</strong>” and the name of class is “<strong>object</strong>” as we are only looking to predict bounding boxes. data.yaml file can be seen below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*6rO5D-7wp-XIJUeVAwB0Gg.jpeg" /><figcaption>Fig 1.4: A view of data.yaml file</figcaption></figure><p><strong>Network Architecture</strong></p><p>Next let’s define the network architecture for YOLOv5. It is the same architecture used by the author Glenn Jocher for training on COCO dataset. I didnt change anything in the network. However, few tweaks were needed to change bounding box size, color and also to remove labels otherwise labels would jumble the image because of so many boxes. These tweaks were made in detect.py and utils.py file. The network is saved as custom_yolov5.yaml file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/67fee370a7279494970f9e26bf4ab5d9/href">https://medium.com/media/67fee370a7279494970f9e26bf4ab5d9/href</a></iframe><p><strong>Training</strong></p><p>Now I start the training process. I defined the image size (img) to be 416x416, batch size 32 and the model is run for 300 epochs. If we dont define weights, they are initialized randomly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f40fe6be943a84c5024c9066f37e597b/href">https://medium.com/media/f40fe6be943a84c5024c9066f37e597b/href</a></iframe><p>It took 4 hours 37 minutes for training to complete on a Tesla P100 16GB GPU provided by Google Colab Pro. After the training is complete, model’s weights are saved in Google drive as last_yolov5_results.pt</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/402027898634bd37b093a6894545bd5e/href">https://medium.com/media/402027898634bd37b093a6894545bd5e/href</a></iframe><h3>Observations</h3><p>We can visualize important evaluation metrics after the model has been trained using the following code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/570cd3a3eed20a951c9135e4acf31140/href">https://medium.com/media/570cd3a3eed20a951c9135e4acf31140/href</a></iframe><p>The following 3 parameters are commonly used for object detection tasks:</p><p>· <strong>GIoU</strong> is the Generalized Intersection over Union which tells how close to the ground truth our bounding box is.</p><p>· <strong>Objectness</strong> shows the probability that an object exists in an image. Here it is used as loss function.</p><p>· <strong>mAP </strong>is the mean Average Precision telling how correct are our bounding box predictions on average. It is area under curve of precision-recall curve.</p><p>It is seen that Generalized Intersection over Union (GIoU) loss and objectness loss decrease both for training and validation. Mean Average Precision (mAP) however is at 0.7 for bounding box IoU threshold of 0.5. Recall stands at 0.8 as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*40Q8cbTIzEqjRgco4_huWQ.png" /><figcaption>Fig 1.5: Different evaluation parameters observed for YOLOv5 model training</figcaption></figure><p>Now comes the part where we check how our model is doing on test set images using the following code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/76819f6b4084acd78d97d154524c10a1/href">https://medium.com/media/76819f6b4084acd78d97d154524c10a1/href</a></iframe><h3>Results</h3><p>Following images show the result of our YOLOv5 algorithm trained to draw bounding boxes on objects. The results are pretty good.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*8LG8dnQoYiqR9w0CXXKoow.jpeg" /><figcaption>Fig 1.6: Original test set image (on left) and bounding boxes drawn images by YOLOv5 (on right)</figcaption></figure><p>The inference time was just 0.009seconds and the weights file turned out to be just 13.9MB.</p><h3>Link To Repository</h3><p>Following link contains the repository for the project. Please make sure you copy the code from jupyter notebook in Google Colab as it was originally written there.</p><p><a href="https://github.com/shayanalibhatti/Retail-Store-Item-Detection-using-YOLOv5">https://github.com/shayanalibhatti/Retail-Store-Item-Detection-using-YOLOv5</a></p><p>The utils.py and detect.py files in the repository are tweaked to remove object labels and make green thin bounding boxes.</p><h3>Conclusion</h3><p>Naming controversies aside, YOLOv5 performs well and can be customized to suit our needs. However, training the model can take significant GPU power and time. It is recommended to use atleast Google Colab with 16GB GPU or preferably a TPU to speed up the process for training the large dataset.</p><p>This retail object detector application can be used to keep track of store shelf inventory or for a smart store concept where people pick stuff and get automatically charged for it. YOLOv5’s small weight size and good frame rate will pave its way to be first choice for embedded-system based real-time object detection tasks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ba3ddd71b0c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/retail-store-item-detection-using-yolov5-7ba3ddd71b0c">Retail Store Item Detection using YOLOv5</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[This Is How AI And Machine Learning Relate To Human Learning]]></title>
            <link>https://medium.com/analytics-vidhya/this-is-how-ai-and-machine-learning-relate-to-human-learning-b14d8dfbab7c?source=rss-be3073cc7349------2</link>
            <guid isPermaLink="false">https://medium.com/p/b14d8dfbab7c</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Shayan Ali Bhatti]]></dc:creator>
            <pubDate>Sat, 30 May 2020 16:55:14 GMT</pubDate>
            <atom:updated>2021-06-04T15:43:45.853Z</atom:updated>
            <content:encoded><![CDATA[<h3>Machine Learning vs Human Learning</h3><p>You must have heard that this is the age of Artificial Intelligence (AI). AI is being used to detect diseases, in driving autonomous vehicles, automated business decisions and so on. But what is AI and Machine Learning and how some of the concepts in these are actually derived from the way humans learn?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ab-MUvWrAsy7HyDnj8b8Qg.jpeg" /><figcaption>Picture by Gerd Leonhard taken from <a href="https://www.flickr.com/photos/gleonhard/33661762360">https://www.flickr.com/photos/gleonhard/33661762360</a> shared under Creative Commons 2.0 License.</figcaption></figure><h3><strong>Artificial Intelligence vs Human Intelligence</strong></h3><p>In simple words, if a machine/software is using some sensor to “<strong>sense</strong>” data and take decisions based on them, then we call this <strong>Artificial Intelligence</strong> because humans do the same. We perceive and “<strong>sense</strong>” changes in surrounding and act according to them, acting as intelligent beings. Since machines do this task the artificial way, using sensors or some other means to detect change in data, thus we call this process “<strong>Artificial Intelligence</strong>”; humans being “<strong>naturally intelligent</strong>”.</p><p>The above definition of AI is very narrow. AI, however, is a very broad field and includes fields like Machine Learning and Deep Learning, which themselves include numerous algorithms that help the machines take decisions “<strong>artificially</strong>” and “<strong>intelligently</strong>”. The following picture is a description of relation between AI, Machine Learning and Deep Learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vdHyRQfjt9__LKGgJsC2Kg.png" /><figcaption>Relation between AI, Machine Learning and Deep Learning. Image taken from NVIDIA blog <a href="https://blogs.nvidia.com/blog/2016/07/29/whats-difference-artificial-intelligence-machine-learning-deep-learning-ai/">https://blogs.nvidia.com/blog/2016/07/29/whats-difference-artificial-intelligence-machine-learning-deep-learning-ai/</a></figcaption></figure><p>It can be seen in picture above that AI is the umbrella in which Machine Learning and Deep Learning exist.</p><h3><strong>Machine Learning</strong></h3><p>Machine Learning is simply defined as,</p><blockquote><strong>“A software made to learn by making mistakes without being explicitly programmed”.</strong></blockquote><p>Machine learning has 2 major types:</p><ol><li><strong>Supervised Learning.</strong> In supervised learning, our software is first “<strong>trained</strong>” on “<strong>known</strong>” data, that is, the machine learning model tries to learn to classify the data, for which the model already knows the solutions. It can be cats / dogs images or any complicated task. After the “<strong>training</strong>” is done, then we expect our model to classify / predict the “<strong>unseen</strong>” data of the same type correctly.</li><li><strong>Unsupervised Learning</strong>. In unsupervised learning, the data does not come with “<strong>known solution</strong>”, as was the case in supervised learning. In unsupervised learning, from a lot of data, that us humans cannot possibly analyze one by one, we use “<strong>Clustering</strong>” to cluster the similar data with each other in clusters, based on some criteria e.g. distance or density etc. thus making it easier for humans to then analyze what similarity the data in those clusters have. An example can be that from millions of chemical compounds, if scientists want to see which compounds have properties similar to each other, then they might use clustering.</li></ol><h3><strong>Supervised Machine Learning in Human Learning Terms</strong></h3><p>The way humans learn is that they are trained to solve problems in school. Our teacher solves a problem, gives us solution for the problem, then we learn how to solve it, we make mistakes, we learn, and in the end we are supposed to do well in final <strong>test</strong> and ultimately in life when something related to those problems comes. Thus, we are <strong>trained</strong> to solve those kinds of problems.</p><p><a href="https://www.datadriveninvestor.com/2020/02/19/cognitive-computing-a-skill-set-widely-considered-to-be-the-most-vital-manifestation-of-artificial-intelligence/">Cognitive computing - a skill-set widely considered to be the most vital manifestation of artificial intelligence. | Data Driven Investor</a></p><p>Same goes for supervised Machine Learning in which the Machine Learning model is first “<strong>trained</strong>” on examples with <strong>“known solutions”</strong>. This data is called “<strong>training set / training data</strong>”. Then the model learns by making mistakes and improving on them gradually. After it is “<strong>trained</strong>”<strong>, </strong>we expect the machine learning model to do well, when an unseen relevant problem comes known as “<strong>test data</strong>”, and ultimately in real life when Machine Learning model is deployed in production environment.</p><p>There are, however, 2 more terms in Machine Learning that are very common and tell how our Machine Learning model is doing. They are:</p><ol><li>Underfitting.</li><li>Overfitting.</li></ol><p>Let us see what these terms mean and how they are related to human learning.</p><p><strong>Underfitting</strong></p><p>Underfitting, in simple terms, means that our Machine Learning model did not do well in being trained on training data. Technically, our model’s predictions had high bias (error), it could not even predict the training data with known solutions correctly. This is depicted in following figure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*tHiCL65-VqL65nQDl2MHOw.jpeg" /></figure><p>Since, it did not do well on training data, it is definitely not going to do well on test data either. Thus, it is undesirable.</p><p><strong>Underfitting in Human Learning Terms</strong></p><p>In human terms, underfitting means that a student was given homework with known solutions and the student could not even get the answers for those questions right. So obviously it can be predicted that that student will not be able to do well in final test and real life either, if relevant problems come.</p><p><strong>Overfitting</strong></p><p>Overfitting, in simple terms, means that our data has a lot of variance so our model just memorized the training data’s pattern, as depicted in the picture below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*STdT2e0rRhUiFS-lvrvMqw.jpeg" /></figure><p>When a model totally memorizes the training data, then our model gives <strong>very</strong> <strong>good</strong> performance on training data, but <strong>very poor</strong> performance on test data and thus fails to work properly when deployed to solve real-world problems. Because even though the test data was similar to the training data, it might not necessarily follow the same pattern of training data, causing the model that memorized training data<strong>,</strong> to perform poorly.</p><p><strong>Overfitting in Human Learning Terms</strong></p><p>In human terms, it means that the student memorized all homework questions and their answers. But when the teacher twisted the wording of same questions in the final test, then student did poorly because the student thought that they were different questions.</p><p>In practice though, in Machine Learning, we try to be between under and over fitting. This is called the bias-variance tradeoff. Underfitting means we have high bias in data, overfitting means we have high variance in data. Practically, we must have a model whose performance strives for a balance between them.</p><h3>Neural Networks in Brain</h3><p>Brain’s nervous system is comprised of Neural Networks whose building block is a neuron. A Neural Network has neurons receive signals via the <strong>dendrites</strong> to the <strong>soma</strong> and sends out signals down the <strong>axon</strong>. A single biological neuron can be seen below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*H_PIKM_HYVc7__fl1SZ7pg.png" /><figcaption>Illustration of a neuron by David Baillot taken from <a href="https://scx2.b-cdn.net/gfx/news/hires/2018/2-whyareneuron.jpg">https://scx2.b-cdn.net/gfx/news/hires/2018/2-whyareneuron.jpg</a></figcaption></figure><h3>Neural Networks in Machine Learning</h3><p>In Machine Learning, the concept of Neural Networks is derived from the Neural Networks in brain. As, each neuron receives data from previous one and then processes signal and sends processed output to next neuron. The detailed working of a Neural Network is explained in detail in my article with practical coding implementation at “<a href="https://medium.com/analytics-vidhya/coding-a-neural-network-for-xor-logic-classifier-from-scratch-b90543648e8a">https://medium.com/analytics-vidhya/coding-a-neural-network-for-xor-logic-classifier-from-scratch-b90543648e8a</a>”.</p><p>However, the major difference between brain’s and Machine Learning’s Neural Network is that brain’s Neural Network has around 100 billion neurons and in our Machine Learning Neural Network model, we might not even have a million neurons.</p><h3>Conclusion</h3><p>AI and Machine Learning are based on the way humans learn, that is, by making mistakes and improving on them. I hope that this article teaches few Machine Learning terminologies and their relation with human thinking, to the newbies trying to learn Machine Learning.</p><p><strong>Gain Access to Expert View — </strong><a href="https://datadriveninvestor.com/ddi-intel"><strong>Subscribe to DDI Intel</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b14d8dfbab7c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/this-is-how-ai-and-machine-learning-relate-to-human-learning-b14d8dfbab7c">This Is How AI And Machine Learning Relate To Human 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[Frustrations Of The Jobless]]></title>
            <link>https://medium.com/age-of-awareness/frustrations-of-the-jobless-6e9d2b2e146b?source=rss-be3073cc7349------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e9d2b2e146b</guid>
            <category><![CDATA[jobless]]></category>
            <category><![CDATA[hr]]></category>
            <category><![CDATA[work]]></category>
            <category><![CDATA[corporate-culture]]></category>
            <category><![CDATA[frustration]]></category>
            <dc:creator><![CDATA[Shayan Ali Bhatti]]></dc:creator>
            <pubDate>Mon, 25 May 2020 18:44:13 GMT</pubDate>
            <atom:updated>2021-05-06T02:29:10.324Z</atom:updated>
            <content:encoded><![CDATA[<p>When you are jobless, every day hurts, sending you in depression, making you doubt yourself. Even impostor syndrome doesn’t feel like impostor syndrome. It feels that you really don’t know anything because you are not getting a job. Your high GPA feels useless. Your family will be looking at you with high hopes. You will see people who weren’t as hardworking as you in college, getting great jobs with high salary, settled with family. And then there will be you, stuck in this vicious cycle of joblessness with all your dreams dependent on getting a job.</p><p>Since childhood, our parents and teachers start motivating us by saying, <br><strong>“Just study hard for 10 years and life will be easy”</strong>. <br>Then after 10 years we go to college and hear the same thing, study hard for few more years, you will get a good job and then life will be easier.</p><p>After you finish your degree, you are ready to reap the rewards of the hard work you did in college. Then you start applying for jobs but the real struggle begins now and you are are sometimes thrown in a world of bitter realities. Here are the common ones:</p><h3><strong>The vicious cycle of inexperience</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FLo9rYXjcRxbgWwE.jpg" /></figure><p>You keep applying for jobs but are stuck in this frustrating vicious cycle that you don’t have experience because you never had a job, you are fresh graduate. You are aching to get an opportunity to learn and offer your skills but the employer doesn’t want inexperienced people. You will see jobs for Junior Developer with 3–5 year experience required further increasing your frustration.</p><p>Now you might be taking online certifications and increasing your skills but what to do about inexperience ? If it is an automatic resume tracker then you will be automatically rejected because of not having experience. You will not even reach interview round to show what you have to offer.</p><p>Almost every job has a learning curve, you cannot possibly know everything then why not trust the next generation and groom them for the job ?</p><h3><strong>No reason for rejection or generic response</strong></h3><p>You keep applying and automatic resume parsing software like ATS will automatically reject your resume probably because your formatting wasn’t right or maybe you didn’t have experience or maybe you were international and company wasn’t taking internationals but you will never get the “real” reason making you doubt yourself and your skills. You will get only an automated reply saying,<br><strong>“Thanks for applying. While we liked your profile, we decided to go with candidates that more closely fit our requirements”.</strong></p><p>The candidates should at least be given a valid reason for rejection so that they can improve on it. But that never happens.</p><h3><strong>Ghosting</strong></h3><p>You applied at hundreds of jobs with no reply and suddenly you get a call from HR saying they really liked your profile and want to talk to you. The call goes well, you are through to next round and do well too. This gives you a lot of hope that finally something good will happen and you might get a job. The hiring manager tells you that HR will be in touch and then … a long silence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*LeSQA_uFUsGHyBjKMwOtOw.jpeg" /></figure><p>So you send a follow-up email and you get no response. Then another email and again HR gives no response. Congrats, in corporate term, you have been ghosted. Now you had interviews going for around 1–3 months and this is how you are treated…. by giving no response even by big companies. How frustrating is that ?</p><h3><strong>Can you do this task so we really know that you are good candidate?</strong></h3><p>These days before a technical interview for software or data science job, a candidate is given a task in which it is written that the task should be accompanied with a working code and a report explaining the results. Also, the code should be modular and organized. And the candidates are told not to spend more than 2–3 hours on the task. And for submitting the task candidate would be given 3–4 days.</p><p>Now, this task as you can imagine will never be a straightforward one. It would have complicated things and then you, as a candidate, who might have gotten an opportunity in probably months will spend as much time as you can, making sure you dont leave flaws or anything that can get you rejected.</p><p>Finally, you will submit that task spending probably a day or two and then even if you achieved the right results, you will be rejected or with some luck you will go to next round. I have had a company reject me after HR interview, a whole big task with report, and a technical interview on the excuse that <strong>“You don’t have big enterprise experience”</strong>. Like that was not already evident in my resume :(</p><h3><strong>Wow, we really love you, HR will be in touch</strong></h3><p>You might have had experience in which HR acted as they had fallen in love with you or maybe the technical interview with hiring manager went so well that he actually said that, <br><strong>“You did really good and HR will be in touch with you”. </strong><br>You will get excited thinking that wow you have nabbed the job. The hiring manager said himself that he liked you.</p><p>But then next week you are sent rejection without proper reasoning. And you will realize that Leonardo DiCaprio never convinced you with his acting as much as the hiring manager did, making you think that you got the job.</p><h3><strong>People getting hired on fake experience</strong></h3><p>You might have high qualifications and still be having a hard time getting a job and then on LinkedIn you will see an HR person posting that,</p><p><strong>“A candidate lied on their resume but we hired that candidate. That candidate turned out to be a great employee”.</strong></p><p>Now that makes you wonder two things. First, what kind of culture is being promoted ? To lie about yourself ? What is next ? The following ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/0*KSY-gSNqFotQdPJB" /></figure><p>Shouldn’t fake guy hiring be discouraged ? Second, does that LinkedIn HR motivator really wants you to believe that an incompetent or a liar can get hired at their company, when you, with all your skills and certifications would still be rejected by that company ?</p><h3><strong>Visa Status?</strong></h3><p>It is definitely employer’s right to hire whoever they want as hiring an international requires sponsoring work visa in USA which costs some money. I once had a company HR tell me that they really liked my profile and then asked me my visa status. Upon hearing i am international, she said they dont sponsor visas, which is totally fine by me. BUT then I received a rejection email from the HR saying, <br><strong>“Your skills are not a good fit for us. Thanks for applying”.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*fzQuBmESmKgdf3COvcB-tA.jpeg" /></figure><p>Now if you said yourself that problem is visa then why would you discourage the candidate by saying their skills don’t match when the real reason is nationality !!</p><h3><strong>Nepotism and inside hiring</strong></h3><p>There used to be a time when <strong>“recommendation”</strong> was considered bad, as it tarnishes the honest way of applying for jobs and brings a candidate skip the long line of candidates. But not anymore. These days, a right candidate recommendation can make a person from $100–$3000, even in big companies. Then why would companies look at other candidates ? It is a fact that most companies favor some sort of nepotism, hiring children of old employees or otherwise hire on the inside, without job posting ever making its way in the public. So you gotta have connections.</p><h3><strong>Incompetents can work but you can’t</strong></h3><p>Have you seen a person who only goes to work for enjoyment, gossip and does literally nothing most of the time? Yet that person has a job and when you will apply at that company, you will not get a job because, <br><strong>“Your skills don’t match the employer’s high standards”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*ZhlENzcIIxN_ssoA.jpg" /></figure><h3>Solution?</h3><p>HR, technical managers and job applicants can do the following to make life easier for each other without hurting anyone.</p><p><strong>HR and Technical Managers</strong></p><ol><li>Don’t ghost people !! Please do follow-up even if you are rejecting a candidate. Give them advice on how to improve their profile.</li><li>Do not make false promises when you know you are going to reject people. Sometimes it feels like HR will ask for marriage they loved you so much, only to reject in the end.</li><li>Why would you assign tasks that are actually the job description and take long hours and what if the candidate still gets rejected after successful task completion ? What about their time and effort ?</li></ol><p><strong>Candidates</strong></p><ol><li>Candidates should definitely consider engaging themselves in courses to learn things so they are not killing themselves mentally for not having a job.</li><li>Consider developing something and have a startup. Joblessness can eat up years of people who get stuck in cycle of joblessness and inexperience and a lot of times indulge in crimes due to frustration towards the system. Minds of people must be engaged in healthy activities at all times or else it is going to be trouble for society.</li><li>Make connections, as most companies hire on inside.</li></ol><p>I hope these advice are helpful for employers as well as candidates in these tough times of economic uncertainty.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e9d2b2e146b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/age-of-awareness/frustrations-of-the-jobless-6e9d2b2e146b">Frustrations Of The Jobless</a> was originally published in <a href="https://medium.com/age-of-awareness">Age of Awareness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Here Is How Absence Of Freedom Of Speech Is Killing The Societies]]></title>
            <link>https://bhatt226.medium.com/here-is-how-absence-of-freedom-of-speech-is-killing-the-societies-49c730a38f7?source=rss-be3073cc7349------2</link>
            <guid isPermaLink="false">https://medium.com/p/49c730a38f7</guid>
            <category><![CDATA[democracy]]></category>
            <category><![CDATA[dictatorship]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[freedom-of-speech]]></category>
            <category><![CDATA[politics]]></category>
            <dc:creator><![CDATA[Shayan Ali Bhatti]]></dc:creator>
            <pubDate>Wed, 13 May 2020 19:38:33 GMT</pubDate>
            <atom:updated>2020-05-14T16:44:55.147Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*f6-GxmRFe_VORQFZuVqCHw.jpeg" /></figure><p>Without freedom of speech, a society cannot grow. It will not have accountability. It will not have justice. It will only be a society of bullies, feudals and dictators. This is what you will see, even if the country is “<strong>apparently</strong>” not ruled by a uniformed dictator.</p><p>So, if you grew up in an Asian society, you might have heard the following if you tried to reason with someone:<br>“<strong>Dont argue with me!! Just do what I said</strong>”<br>“<strong>Didnt your parents teach you any manners? Dont talk back to me. I am your elder. I dont have to give you any reason.</strong>”</p><p>These sentences can be heard at various situations, most common are if someone in your apartment wanted you to unreasonably go away and not play in the neighborhood or if someone tried to bully you in to doing something and when you tried to reason with them, they played the “elder card”. While we must respect our elders but it should not come at the cost of reasoning and accountability.</p><p>This nature of people comes with grave consequences that a lot of countries are dealing with these days. Let us discuss these consequences one by one.</p><h3>1. Dictatorship</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*h_QSrK6CrF7vikFxhs0ZFA.jpeg" /></figure><p>“<strong>Just do what I said. I dont have to give you any reason</strong>”. This sentence represents dictation. And if I were to talk about my country Pakistan, then it was ruled heavily by uniformed dictators. Some people liked the dictatorship rule. And some specially journalists and democratic minded people did not like this rule because you cannot criticize or reason with a dictator or else you will face jail / death. But people forget that it is not the dictator that is to be blamed but the prevalent undemocratic nature of people who are unwilling to reason with one another. It is this habit of majority of people in society that makes a dictator, a “natural ruler” of such society. So if you want a “natural” end of dictatorship be it uniformed or non-uniformed, then be democratic with everyone, be up for reasoning with everyone, be it children, poor or rich and dictatorship might die its “natural” death.</p><h3>2. No Accountability</h3><p>Asian countries are marred by the plague called “corruption”. It has been hurting them since their birth. Money laundering, corruption lies deep within people. Politicians are corrupt, Policemen are corrupt, judges and prominent journalists are alleged of corruption, in fact anyone with a little bit of authority is corrupt. But why ???</p><p>When someone says “<strong>Dont argue with me. Just do what I said</strong>”, it means that, that person is not up for accountability. You cannot question that person or he/she will threaten you. Result ? A society filled with injustice, corruption and non-accountability because people will not have the habit of questioning neither in family, nor in politics or society. People will lose hope in system. This non-accountability weakens and kills a society, as without justice we are no better than animals.</p><h3>3. Bullying / Feudalism</h3><p>A lot of societies have to deal with gangs, crimes and bullying. I feel that bullying comes from this very fact that the society is non-democratic. Because the bully knows that he/she wont be questioned due to their age or authority or status, hence they will keep bullying and suppressing people. Same goes for feudalism. A feudal lord cannot have people questioning his foul policies because it puts his feudalism and control under threat. And yet, it is feudal lords who will be chanting for “democracy” to fool people into giving them votes.</p><p>Land grabbing, extortion, kidnapping, feudalism and street crimes are one big demon haunting societies which I feel has some connection to the absence of democracy and accountability.</p><h3>4. Religious Extremism</h3><p>Pakistan in particular is constantly under threat from religious fanaticism. We have had so many incidents when a person is killed on “allegation” of blasphemy. If a religious cleric gets a whiff of blasphemy, then without any evidence, he would order a mob to kill the alleged person without any evidence. In 2017, in Peshawar, a student Mashal Khan, was beaten to death by a mob on “allegation” of blasphemy. And when the mob was questioned about it. Most of them said that they did not know if he actually committed blasphemy or not. They just heard it somewhere and killed the student with sticks.</p><p>This whole notion of religious fanaticism grows from the fact that our society is non-democratic. If a religious leader says something, most of the people would trust him without any investigation or question. If someone tries to question, then instead of getting polite guidance, he/she fears allegation of blasphemy and the fatwa of “death due to blasphemy”. Due to this fear, people stopped questioning religious leaders, hence, the religious extremism. A religious misconception in such an environment will never go checked as people will fear the religious cleric.</p><p>So if we want to end it, we must encourage polite argument and reasoning and then everyone will know that they cant just do anything and get away with it, instead, they will be questioned by people.</p><h3>My Point ?</h3><p>I will sum this up with a true analogy. Ever wondered how do pharmaceuticals or food industries ensure quality and taste in billions and trillions of their products ? They make product using a <strong>formula</strong> BUT they have probabilistic measures to test the product. For example, if in a batch of 100 jellies, take a sample of 5 jellies if they are good, pass the batch. But if half of them are bad, then sample 10 more and check them and if those are also bad then discard the batch and see what is wrong with the <strong>formula</strong>.</p><p>Similarly, elections in countries are a <strong>sampling</strong> of a nation. If after every election, a corrupt batch of politicians and bureaucracy comes into power, then people must change the <strong>formula</strong> from which the society is made. They have to be just and leaders will be just, be democratic and the dictator will not dare dictate the society, be up for reasoning and the society will have accountability.</p><p>I hope that this read will help people understand the consequences of being non-democratic and help us create a society based on justice, freedom of speech and accountability. If our next generation is brought up with these facts in mind, then we will create a fair democratic society.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49c730a38f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Consequences of Being a Non-democratic Society]]></title>
            <link>https://bhatt226.medium.com/the-consequences-of-being-a-non-democratic-society-dc3a5e65639c?source=rss-be3073cc7349------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc3a5e65639c</guid>
            <category><![CDATA[democracy]]></category>
            <category><![CDATA[dictatorship]]></category>
            <category><![CDATA[accountability]]></category>
            <category><![CDATA[society]]></category>
            <dc:creator><![CDATA[Shayan Ali Bhatti]]></dc:creator>
            <pubDate>Sun, 10 May 2020 17:57:18 GMT</pubDate>
            <atom:updated>2020-05-14T16:46:15.590Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Horrors of a Non-Democratic Society</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*h_QSrK6CrF7vikFxhs0ZFA.jpeg" /></figure><p>Without democracy, a society cannot grow. It will not have accountability. It will not have justice. It will only be a society of bullies, feudals and dictators. And that is what you will see even if the country is “<strong>apparently</strong>” not ruled by a uniformed dictator.</p><p>So, if you grew up in an Asian society, you might have heard the following if you tried to reason with someone:<br>“<strong>Dont argue with me!! Just do what I said</strong>”<br>“<strong>Didnt your parents teach you any manners? Dont talk back to me. I am your elder. I dont have to give you any reason.</strong>”</p><p>These sentences can be heard at various situations, most common are if someone in your apartment wanted you to unreasonably go away and not play in the neighborhood or if someone tried to bully you in to doing something and when you tried to reason with them, they played the “elder card”. While we must respect our elders but it should not come at the cost of reasoning and accountability.</p><p>This undemocratic nature of people comes with grave consequences that a lot of countries are dealing with these days. Let us discuss these consequences one by one.</p><h3>1. Dictatorship</h3><p>“<strong>Just do what I said. I dont have to give you any reason</strong>”. This sentence represents dictation. And if I were to talk about my country Pakistan, then it was ruled heavily by uniformed dictators. Some people liked the dictatorship rule. And some specially journalists and democratic minded people did not like this rule because you cannot criticize or reason with a dictator or else you will face jail / death. But people forget that it is not the dictator that is to be blamed but the prevalent undemocratic nature of people who are unwilling to reason with one another. It is this habit of majority of people in society that makes a dictator, a “natural ruler” of such society. So if you want a “natural” end of dictatorship be it uniformed or non-uniformed, then be democratic with everyone, be up for reasoning with everyone, be it children, poor or rich and dictatorship might die its “natural” death.</p><h3>2. No Accountability</h3><p>Asian countries are marred by the plague called “corruption”. It has been hurting them since their birth. Money laundering, corruption lies deep within people. Politicians are corrupt, Policemen are corrupt, judges and prominent journalists are alleged of corruption, in fact anyone with a little bit of authority is corrupt. But why ???</p><p>When someone says “<strong>Dont argue with me. Just do what I said</strong>”, it means that, that person is not up for accountability. You cannot question that person or he/she will threaten you. Result ? A society filled with injustice, corruption and non-accountability because people will not have the habit of questioning neither in family, nor in politics or society. People will lose hope in the system. Non-accountability will weaken and kill a society, as without justice we are no better than animals.</p><h3>3. Bullying / Feudalism</h3><p>A lot of societies have to deal with gangs, crimes and bullying. I feel that bullying comes from this very fact that the society is non-democratic. Because the bully knows that he/she wont be questioned due to their age or authority or status, hence they will keep bullying and suppressing people. Same goes for feudalism. A feudal lord cannot have people questioning his foul policies because it puts his feudalism and control under threat. And yet, it is feudal lords who will be chanting for “democracy” to fool people into giving them votes.</p><p>Land grabbing, extortion, kidnapping, feudalism and street crimes are one big demon haunting societies which I feel has some connection to the absence of democracy and accountability.</p><h3>4. Religious Extremism</h3><p>Pakistan in particular is constantly under threat from religious fanaticism. We have had so many incidents when a person is killed on “allegation” of blasphemy. If a religious cleric gets a whiff of blasphemy, then without any evidence, he would order a mob to kill the alleged person without any evidence. In 2017, in Peshawar, a student Mashal Khan, was beaten to death by a mob on “allegation” of blasphemy. And when the mob was questioned about it. Most of them said that they did not know if he actually committed blasphemy or not. They just heard it somewhere and killed the student with sticks.</p><p>This whole notion of religious fanaticism grows from the fact that our society is non-democratic. If a religious leader says something, most of the people would trust him without any investigation or question. If someone tries to question, then instead of getting polite guidance, he/she fears allegation of blasphemy and the fatwa of “death due to blasphemy”. Due to this fear, people stopped questioning religious leaders, hence, the religious extremism. A religious misconception in such an environment will never go checked as people will fear the religious cleric.</p><p>So if we want to end it, we must encourage polite argument and reasoning and then everyone will know that they cant just do anything and get away with it, instead, they will be questioned by people.</p><h3>My Point ?</h3><p>I will sum this up with a true analogy. Ever wondered how do pharmaceuticals or food industries ensure quality and taste in billions and trillions of their products ? They make product using a <strong>formula</strong> BUT they have probabilistic measures to test the product. For example, if in a batch of 100 jellies, take a sample of 5 jellies if they are good, pass the batch. But if half of them are bad, then sample 10 more and check them and if those are also bad then discard the batch and see what is wrong with the <strong>formula</strong>.</p><p>Similarly, elections in countries are a <strong>sampling</strong> of a nation. If after every election, a corrupt batch of politicians and bureaucracy comes into power, then people must change the <strong>formula</strong> from which the society is made. They have to be just and leaders will be just, be democratic and the dictator will not dare dictate the society, be up for reasoning and the society will have accountability.</p><p>I hope that this read will help people understand the consequences of being non-democratic and help us create a society based on justice, freedom of speech and accountability. If our next generation is brought up with these facts in mind, then we will create a fair democratic society.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc3a5e65639c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing an Audiobook using Python]]></title>
            <link>https://medium.com/analytics-vidhya/designing-an-audiobook-using-python-cfa03b5f0759?source=rss-be3073cc7349------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfa03b5f0759</guid>
            <category><![CDATA[pdf-to-audio]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[text-to-speech]]></category>
            <category><![CDATA[audiobooks]]></category>
            <category><![CDATA[tesseract]]></category>
            <dc:creator><![CDATA[Shayan Ali Bhatti]]></dc:creator>
            <pubDate>Mon, 30 Mar 2020 12:39:37 GMT</pubDate>
            <atom:updated>2020-03-30T17:19:40.448Z</atom:updated>
            <content:encoded><![CDATA[<p>In this project, I present a simple way to combine different Python libraries for creating an Audiobook that takes PDF file path as input and reads the text in the PDF file to the user via audio. Python programming language was used to create this project.</p><h3><strong>Introduction</strong></h3><p>Reading stories or essays or any text can be arduous, however an audio reading of the text is convenient and doesnt require as much concentration as reading requires. In this project, I implemented a simple PDF to audio converter. This code scans page(s) of PDF and reads it using audio, to the user. While this project is good for simple text reading, it does not perform good if a scientific paper with equations is given to it because equations are not supported to be read in Pytesseract OCR library which I used to convert image to text.</p><h3><strong>Project Flow</strong></h3><p>Here is the project flow diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*rH_qMC_XJT7TQRji" /></figure><ol><li>First, I take the PDF file and convert each page into image using PyMuPDF library.</li><li>Then I take the image(s) and scan the text in the image using Pytesseract OCR (Optical Character Recognition) library.</li><li>Then I use Google Text to Speech (gTTS) library to convert text to audio file.</li><li>Lastly I get the Pygame mixer library to play the audio file on computer.</li></ol><h3><strong>Prerequisites</strong></h3><p>The software libraries required to run this code can be installed using:</p><ol><li>pip install Pillow — — — —- image reader library</li><li>pip install PyMuPDF — — — library to convert PDF page to image</li><li>pip install pytesseract — —- Image to text converting Optical Character Recognition library</li><li>pip install pygame — — —-pygame to play audio</li><li>pip install gTTS — — — —- Google’s library for converting Text To Speech</li></ol><h3><strong>Working</strong></h3><p>Following code shows how to use PyMuPDF (formerly Fitz) to save images from PDF pages.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d229627403dbe1139def19b49bd980a/href">https://medium.com/media/3d229627403dbe1139def19b49bd980a/href</a></iframe><p>Following code shows how to use Pytesseract Optical Character Recognition (OCR) library to convert text written in images to string.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/379ef9228761436dd2dc11bc65a0ab43/href">https://medium.com/media/379ef9228761436dd2dc11bc65a0ab43/href</a></iframe><p>Following gist shows implementation of text to speech and save it in computer.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66db2837926436c6bae3ead88b1095e0/href">https://medium.com/media/66db2837926436c6bae3ead88b1095e0/href</a></iframe><p>In the end I use Pygame library to play the PDF text converted into audio on computer.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2fc3783635fd27e0412d3678fadece76/href">https://medium.com/media/2fc3783635fd27e0412d3678fadece76/href</a></iframe><p>The full code can be viewed on Github at <a href="https://github.com/shayanalibhatti/PDF-Audiobook-using-Python">https://github.com/shayanalibhatti/PDF-Audiobook-using-Python</a>.</p><h3><strong>Conclusion</strong></h3><p>It was seen that this code performs really well in reading straightforward PDF text files. However, if complex mathematical equations are involved in the text, then this software cannot properly read the equations as a human would. Hence, the code is good for simple text but not for scientific papers as it will fumble reading the complex equations. I hope readers will find this project helpful.</p><h3>Future Work</h3><p>At this point, the code does not have pause or stop feature, I intend to add those and do more cool things with application of Machine Learning in the audiobook.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfa03b5f0759" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/designing-an-audiobook-using-python-cfa03b5f0759">Designing an Audiobook using 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[Coding a neural network for XOR logic classifier from scratch]]></title>
            <link>https://medium.com/analytics-vidhya/coding-a-neural-network-for-xor-logic-classifier-from-scratch-b90543648e8a?source=rss-be3073cc7349------2</link>
            <guid isPermaLink="false">https://medium.com/p/b90543648e8a</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[Shayan Ali Bhatti]]></dc:creator>
            <pubDate>Mon, 30 Mar 2020 08:47:21 GMT</pubDate>
            <atom:updated>2020-03-30T16:05:43.239Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understanding and Coding a neural network for XOR logic classifier from scratch</h3><p>In this project, I implemented a proof of concept of all my theoretical knowledge of neural network to code a simple neural network from scratch in Python without using any machine learning library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B5uB2VJdROs3JT10YQy87w.jpeg" /></figure><h3><strong>Introduction</strong></h3><p>Some machine learning algorithms like neural networks are already a black box, we enter input in them and expect magic to happen. Still, it is important to understand what is happening behind the scenes in a neural network. We can use libraries such as Keras to make our life easy but if we dont understand what happens inside a neural network, then we can easily get stuck in an infinite loop without understanding what is going wrong with our neural network. Coding a simple neural network from scratch acts as a Proof of Concept in this regard and further strengthens our understanding of neural networks.</p><p>In this project, a single hidden layer neural network is used, with sigmoid activation function in hidden layer units and sigmoid activation function for output layer too, since the output of XOR logic is binary i.e. 0 or 1 only one neuron is in the output layer. The maths behind neural network is explained below:</p><h3><strong>Explanation of Maths behind Neural Network:</strong></h3><p>Following work shows the maths behind a single hidden layer neural network:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B5uB2VJdROs3JT10YQy87w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*S3a8LZ0hJf1NSbuBvFvWIA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*B7jlUQwOe8vFzkVGyTpF5g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*CmQ9Zgb2wFS7iEF0evP3qA.jpeg" /></figure><h3>Code</h3><p>Following code gist shows the initialization of parameters for neural network.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f651e09473ad6c79e4a6e7c108e710f1/href">https://medium.com/media/f651e09473ad6c79e4a6e7c108e710f1/href</a></iframe><p>Following code gist shows the activation function and forward and back propagation function in Python</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dae06616bbe0bf7e0ce0aa24a4e2eb47/href">https://medium.com/media/dae06616bbe0bf7e0ce0aa24a4e2eb47/href</a></iframe><p>In the end, we run the neural network for 10000 EPOCHS and view the loss function as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/06f1a817d6ccba3af32547514730641e/href">https://medium.com/media/06f1a817d6ccba3af32547514730641e/href</a></iframe><h3><strong>Results</strong></h3><p>Following image shows the loss function for our network, it can be seen that it is decreasing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*isX4s7VoUFNvT5IVGYxGmg.jpeg" /></figure><p>Following are the predictions of neural network on test inputs:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6d98111421f792fb76d17db0de51f5bb/href">https://medium.com/media/6d98111421f792fb76d17db0de51f5bb/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*u2UkStyEy0PZgljhWRNXeg.jpeg" /></figure><p>As we know that for XOR inputs 1,0 and 0,1 will give output 1 and inputs 1,1 and 0,0 will output 0. That is exactly what the neural network is doing.</p><h3><strong>Code</strong></h3><p>Please view the full code on Github at <a href="https://github.com/shayanalibhatti/Coding-neural_network-for-XOR-logic-from-scratch">https://github.com/shayanalibhatti/Coding-neural_network-for-XOR-logic-from-scratch</a>, it has the code with comments to make it easy to understand for the readers.</p><h3><strong>Conclusion</strong></h3><p>Coding a neural network from scratch strengthened my understanding of what goes on behind the scenes in a neural network. I hope that the mathematical explanation of neural network along with its coding in Python will help other readers understand the working of a neural network.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b90543648e8a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/coding-a-neural-network-for-xor-logic-classifier-from-scratch-b90543648e8a">Coding a neural network for XOR logic classifier from scratch</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>
    </channel>
</rss>