<?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 Umer Shehzad on Medium]]></title>
        <description><![CDATA[Stories by Umer Shehzad on Medium]]></description>
        <link>https://medium.com/@umer.shehzad1006?source=rss-eceb3131800b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Aa5g07Pnke5XcoGy</url>
            <title>Stories by Umer Shehzad on Medium</title>
            <link>https://medium.com/@umer.shehzad1006?source=rss-eceb3131800b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 00:12:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@umer.shehzad1006/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[AUTONOMOUS WRAPPED 2024]]></title>
            <link>https://medium.com/@umer.shehzad1006/autonomous-wrapped-2024-ce689d99062b?source=rss-eceb3131800b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce689d99062b</guid>
            <category><![CDATA[autonomous-vehicles]]></category>
            <category><![CDATA[tesla]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[automotive]]></category>
            <category><![CDATA[waymo]]></category>
            <dc:creator><![CDATA[Umer Shehzad]]></dc:creator>
            <pubDate>Sat, 25 Jan 2025 22:50:21 GMT</pubDate>
            <atom:updated>2025-01-25T22:50:21.641Z</atom:updated>
            <content:encoded><![CDATA[<p>IM BAAAAACCCCKKKKK!!!!</p><p>IT HAS BEEN 2 WHOLE YEARS SINCE I WROTE AN ARTICLE HERE AND I AM FINALLY BACK WOHOOOO🥳🥳🥳</p><p>So a few things before I start…</p><p>I am in my first year studying automotive engineering at McMaster (yep, I’m living the <em>Car Nerd’s Dream</em>). The reason I went MIA last year was that Grade 12 was a full-on <strong>battle</strong>, and I needed to lock in to get into university. But hey, it all paid off, so here I am!</p><p>OK enough about me — let’s get into the real reason you all are here. Buckle up (literally, because safety first), and let me give you the ultimate 2024 recap of the autonomous vehicle (AV) industry and a peek at what’s zooming our way in 2025.</p><p>To start off hot of course we got to talk about Tesla and Mr Elon Musk himself with the start of Tesla’s new …</p><h3>ROBOTAXIS!!!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dOI-TQO6RLi88M0q.jpg" /><figcaption>Tesla ROBOTAXIS</figcaption></figure><p>Yep this ugly “futuristic” looking car is what Elon proposed to the world near the end of 2024. I mean idk abt everyone else but I don&#39;t mess with the designs idk why but you won’t catch me in that cab.</p><p>The Robotaxi, also known as Cybercab, is a two-seater which will eventually cost around $30,000. Jeez Elon what are you making this car out of gold or diamond????? The Cybercab will use wireless inductive charging rather than the Tesla NACS connector. Individuals will be able to buy them and operate fleets to make income, but no details on this were provided.</p><p>Musk promised the vehicles would run on vision and their new AI5 processor, and get into production in 2026. Keep in mind Elon can’t keep his promises just a heads up. They would run an eventual non-supervised version of FSD which Musk, for the 8th year in a row, said would be working next year, though only in California and Texas if regulators allow. (Tesla at present has no self-driving test permits or applications for them). See I told you so Elon and promises don&#39;t mix.</p><p>Speaking of robotaxis Waymo has been doing this since 2016 in California so it really took Musk a solid 8 years to catch up to them. The Tesla FSD (full self-driving) is still in very primitive shape. It’s at about the same safety level that Waymo was back in 2016, and Waymo is only now starting to scale 8 years after that. While Tesla may progress faster than Waymo did, it suggests they have a long way to go in making working Robotaxi software and associated infrastructure.</p><p>The other things Elon spoke of are important, though. The ability to deliver ride service at very low prices, cheaper than bus service with a better experience can change how people see transportation. The big shame is that Tesla is trying to do this with computer vision <strong>ONLY</strong>, to save money. That will probably work one day, when you may ask. No clue. Tesla has been extremely slow about making it work, and nobody knows the day that this will change. Other companies have real working robotaxis because they have taken a “Tesla Master Plan” approach of starting with more expensive and superior equipment(ex: lidar), planning to make it cheaper later. *COUGH* *COUGH* Waymo</p><p>Wireless charging does have a huge advantage for a robotaxi, as it can charge itself. That’s important for the future of charging since you no longer need to install charging stations everywhere. Ok, now <em>this</em> is what I like to see Elon and Tesla are cooking with this feature! Anywhere you park, a robocar can zoom off while not being used and recharge itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kqmlYR8d0LjIs0Xn.jpg" /></figure><p>However, as amazing as the idea sounds, there are quite a few challenges to overcome:</p><ol><li><strong>Efficiency Loss</strong>: Wireless charging isn’t as efficient as plugging in directly. Some energy gets lost during the transfer, which could lead to higher electricity usage and longer charging times.</li><li><strong>Alignment Issues</strong>: For wireless charging to work, the car needs to perfectly align with the charging pad. Autonomous vehicles are getting better at precision, but even a slight misalignment can reduce efficiency.</li><li><strong>Infrastructure Costs</strong>: Installing wireless charging pads everywhere in parking lots, streets, and garages won’t be cheap. And retrofitting older spaces could be even pricier.</li><li><strong>Durability and Maintenance</strong>: These pads have to withstand weather, wear and tear, and potentially heavy use. Keeping them functional long-term could be a logistical headache.</li><li><strong>Standardization</strong>: Not every EV manufacturer agrees on the same wireless charging standard. Imagine having different pads for different cars like needing a specific phone charger all over again.</li></ol><p>Despite these hurdles, the potential is too exciting to ignore. If Tesla or anyone else can crack these problems, it could completely change how we think about EV charging.</p><h3>TESLA FSD LOVE IT OR HATE IT???</h3><p>Next on the list, since we’re already talking about Tesla, let’s dive into their FSD (Full Self-Driving) system. You know I’ve had my moments making fun of Tesla’s autonomous features and hyping up Lidar like it’s the next big thing. But hey, credit where credit is due!</p><p>It’s time we give Tesla’s FSD some love because, let me tell you, their latest updates? Pretty impressive. They’ve come a long way from where they started, and even I have to admit, the strides they’re making are worth talking about.</p><p>Let’s break it down. Tesla has been cooking up some serious upgrades in their FSD software, and the newest version, V13.2, has a lot of people buzzing. With features like Park Seek finally making their debut and more natural driving behaviours being fine-tuned, this is a level-up that can’t be ignored.</p><p>Let&#39;s run through all the new features and explain the importance of each one of them.</p><h4>1. Emergency Vehicles and School Buses</h4><ul><li><strong>Enhanced Emergency Vehicle Handling</strong>:<br>Tesla’s FSD system now uses advanced vision and audio recognition to detect emergency vehicle lights and sirens from greater distances. The car autonomously slows down, changes lanes if needed, and yields properly to ensure safe passage. It also adheres to local traffic laws regarding stationary emergency vehicles.</li><li><strong>Improved School Bus Recognition</strong>:<br>The system reliably identifies school buses, even with partial obstructions, and reacts to stop signs and flashing lights. It ensures that the vehicle halts at a safe distance and does not proceed until the bus resumes motion or signals are off.</li></ul><h4>2. Speed Zone Management</h4><ul><li><strong>Dynamic Speed Adjustments</strong>:<br>Speed adjustments are now smoother and more intuitive. For example, the vehicle begins decelerating gradually when approaching lower speed zones to avoid abrupt braking. It also integrates GPS data to pre-emptively adjust for speed changes in complex areas like school zones and construction sites.</li></ul><h4>3. Camera Cleaning Technology</h4><ul><li><strong>Heated Camera Elements</strong>:<br>Cameras now feature intelligent heating that activates automatically based on temperature and weather conditions. This ensures cameras remain operational in scenarios where visibility might otherwise be compromised, such as during freezing rain or heavy snowfall.</li></ul><h4>4. 2024 Holiday Little Update Features</h4><ul><li><strong>Apple Watch Support</strong>:<br>In addition to basic lock and climate controls, users can summon the vehicle or activate Homelink directly from the Apple Watch, providing convenience for daily use.</li><li><strong>Dashcam and Sentry Mode Viewer</strong>:<br>Recorded footage is now easier to search with improved timestamps and categorization, such as “impact detected” or “motion near vehicle,” helping users quickly review critical events.</li><li><strong>Ambient Light Shows</strong>:<br>Features like Cyber Santa Mode include synchronized external and internal lighting patterns with music. This creates a festive and engaging experience for holiday gatherings.</li><li><strong>Navigation Enhancements</strong>:<br>The “Search Along Route” feature highlights live updates for EV chargers, restaurants, and lodging options based on preferences. It also includes energy-efficient routing to minimize charging stops.</li></ul><h4>5. FSD V12.6 Updates for HW3 Owners</h4><ul><li><strong>Anticipated Features</strong>:<br>HW3 vehicles will receive adaptive cruise control improvements, lane-centering optimizations, and highway-specific stacks, creating a smoother and more reliable driving experience.</li><li><strong>Hurry Mode</strong>:<br>Designed for time-sensitive trips, this feature calculates safe but faster routes, prioritizing highway driving and optimal lane usage to reduce travel times without compromising legal limits.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FBQFFmFuepCM%3Fstart%3D4%26feature%3Doembed%26start%3D4&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBQFFmFuepCM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FBQFFmFuepCM%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d90a1f20f5edb6b7904e753e6c56810/href">https://medium.com/media/3d90a1f20f5edb6b7904e753e6c56810/href</a></iframe><p>Safe to say Tesla is for sure making some incredible improvements with their autonomous features.</p><p>However… There are a few challenges still in their way</p><p>Here are three key challenges Tesla’s autonomous driving technology is facing</p><h4>1. Safety and Reliability in Complex Scenarios</h4><p>Tesla’s FSD system struggles in highly dynamic environments such as crowded urban areas, construction zones, and intersections with unclear signals. These situations require decision-making, where the system might hesitate or make risky maneuvers. Additionally, Tesla relies heavily on cameras and neural networks, which can be less effective in adverse weather conditions (e.g., heavy rain or fog), potentially compromising safety however there have been some successes in these complex scenarios.</p><h4>2. Driver Misuse and Overconfidence</h4><p>Despite being marketed as “Full Self-Driving,” Tesla’s FSD requires active driver supervision. Many drivers misunderstand this and misuse the system, leading to dangerous situations. Accidents have happened with previous versions of FSD and there could still be some bugs and issues in the new system however it&#39;s improved. Incidents of drivers sleeping or engaging in risky behaviour while using FSD highlight the challenge of enforcing proper usage. Tesla has implemented driver monitoring systems, but ensuring compliance remains a significant issue.</p><h4>3. Regulatory and Legal Challenges</h4><p>Tesla faces delays in getting regulatory approval for FSD to be classified as fully autonomous. Most jurisdictions only recognize Tesla’s system as a Level 2 driver-assistance technology, far from the Level 4 or 5 autonomy needed for true self-driving. Additionally, accidents involving FSD raise legal questions about liability whether the driver or Tesla is at fault which complicates adoption and public trust.</p><p>As Tesla continues to refine its Full Self-Driving (FSD) technology with the release of V13.2.2, the latest update underscores the significant strides the company is making toward achieving more reliable autonomous driving capabilities. With the inclusion of new features and notable improvements in handling emergency vehicles, school buses, and speed zones, this iteration serves as both an enhancement and a nod to Tesla’s innovative spirit aitey continues to battle the challenges faces.</p><p>OK, I think that&#39;s enough talking about Tesla let&#39;s see what else is happening in this industry.y</p><h3>Waymo Waymo Waymo</h3><p>Waymo continues its success and dominance in this industry as it has made significant strides in 2024, completing over 5 <strong>MILLION </strong>autonomous trips, with 4 <strong>MILLION</strong> of those being paid rides. The service is now operating in Phoenix, San Francisco, and Los Angeles, covering over 500 square miles. This year, Waymo opened its robotaxi service to the public in San Francisco through the Waymo One app, proving that its fleet can handle urban traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BMOlxrRn7Hmyfov2" /></figure><p>In 2024, Waymo secured a $5.6 billion investment from Alphabet, fueling its expansion plans. The company aims to extend its service to more cities, with launches planned for Austin and Atlanta in 2025, and testing starting in Miami. Additionally, Waymo plans to partner with Uber for rides in Austin and Atlanta through the Uber app, further expanding its reach. Waymo is also looking to go international, with testing set to begin in Tokyo in 2025.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NIL2O_02Ab8RcNxj.jpg" /></figure><p>For the future, Waymo is partnering with Geely and Hyundai to integrate new vehicles like the Zeekr SUV and Ioniq 5 into its fleet. These partnerships aim to enhance its autonomous capabilities, with new vehicles set to be tested in 2025.</p><p>While Waymo has made significant progress, it has also faced challenges similar to the one with Tesla. Some incidents, including safety concerns and public reactions, have stirred controversy, but Waymo is working on maintaining trust by focusing on safety, publishing detailed reports, and collaborating with authorities to continue their success and path to self-driving.</p><h4>CRUISE SHUTTING DOWN (for a bit)</h4><p>In December 2024, General Motors announced that it would no longer fund its Cruise robotaxi service, opting to focus its resources on developing autonomous technology for personally owned vehicles. GM decided to merge Cruise’s team with its internal teams working on advanced driver-assist systems, like Super Cruise, which is already available in over 20 GM vehicles. The company’s decision comes after Cruise lost $3.48 billion in 2023 and faced increasing competition in the robotaxi market. Cruise’s commercial robotaxi service was already on hiatus after a serious incident in San Francisco in October 2023.</p><p>While Cruise’s robotaxi ambitions are being scrapped, GM will continue developing autonomous and assisted driving technologies for its consumer vehicles. The restructuring aims to save GM about $1 billion annually, but it likely means layoffs for Cruise employees as the company figures out its next steps. This shift reflects the challenges that many autonomous vehicle projects are facing, including high operational costs and unclear profitability. Cruise’s decision follows a similar pattern seen in other failed autonomous vehicle projects like Argo AI, which shut down after losing support from Ford and Volkswagen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hrBGCH61sOggSz6D.jpg" /></figure><p>To end it off recently, on the day I’m writing this, which was the 7th, NVIDIA and Toyota are teaming up to make self-driving cars.</p><p>Ladies and Gentlemen, we have a new company joining the race!!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Hla9e7hxK9yzlbhjQr4wA.png" /></figure><p>Now this is 2024 wrapped not 2025 so can I include this important breaking news and talk about it… NOPE</p><p>Therefore we will see this next year and hopefully, I can publish this thing on time instead of 3 weeks into January.</p><p>This concludes the 2024 autonomous industry wrap, I hope everyone enjoys reading this as much as I enjoyed making it. If there were things that I missed out that you believe should&#39;ve been here let me know, obvi I didn&#39;t want to talk about everything otherwise we would&#39;ve been here for ages.</p><p>I will also try to make articles and publish them more often with Uni started back up my schedule getting busy with school work, finding a summer co-op/intern, and finding a house next year… But we will try our very best to make some fun and entertaining articles.</p><p><em>Thanks for reading this article. If you enjoyed it, feel free to add me on </em><a href="http://www.linkedin.com/in/umer-shehzad-112702238"><em>LinkedIn</em></a><em> and follow this page for more articles on autonomous vehicles :)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce689d99062b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ultimate Guide to Real-Time Lane Detection Using OpenCV — Windows]]></title>
            <link>https://medium.com/@umer.shehzad1006/the-ultimate-guide-to-real-time-lane-detection-using-opencv-windows-8ca313da6886?source=rss-eceb3131800b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ca313da6886</guid>
            <category><![CDATA[tesla]]></category>
            <category><![CDATA[lane-detection]]></category>
            <category><![CDATA[opencv]]></category>
            <category><![CDATA[autonomous-vehicles]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Umer Shehzad]]></dc:creator>
            <pubDate>Sat, 25 Mar 2023 00:45:57 GMT</pubDate>
            <atom:updated>2023-03-30T21:10:44.739Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Ultimate Guide to Real-Time Lane Detection Using OpenCV — Windows</h3><p>Yes, I’m back again with another cool tutorial but as same as last time we are using windows since it makes our life easy. 😎😎😎</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lL8-FxvVxiO8StAz.jpg" /></figure><p>In this tutorial, we will go through the entire process, step by step, of how to detect lanes on a road in real-time using the OpenCV computer vision library and Python. By the end of this tutorial, you will know how to build (from scratch) an application that can automatically detect lanes in a video stream from a front-facing camera mounted on a car. You’ll be able to generate this video below.</p><p>Our goal is to create a program that can read a video stream and output an annotated video that shows the following:</p><ol><li>The current lane</li><li>The radius of curvature of the lane</li><li>The position of the vehicle relative to the middle of the lane</li></ol><p>Real-World Applications</p><ul><li>Self-Driving Cars</li></ul><h3>Prerequisites</h3><ul><li>Python 3.7 or higher with OpenCV installed</li></ul><h3>Helpful Tip</h3><p>As you work through this tutorial, focus on the end goals I listed in the beginning. Don’t get bogged down in trying to understand every last detail of the math and the OpenCV operations we’ll use in our code (e.g. bitwise AND, Sobel edge detection algorithm etc.). Trust the developers at Intel who manages the OpenCV computer vision package.</p><p><strong>We are trying to build products not publish research papers</strong>. Focus on the inputs, the outputs, and what the algorithm is supposed to do at a high level.</p><p>Get a working lane detection application up and running; and, at some later date when you want to add more complexity to your project or write a research paper, you can dive deeper under the hood to understand all the details.</p><p>Trying to understand every last detail is like trying to build your own database from scratch in order to start a website or taking a course on internal combustion engines to learn how to drive a car.</p><p>Let’s get started!</p><h3>Find Some Videos and an Image</h3><p>We first need to find some videos and an image to serve as our test cases.</p><p>We want to download videos and an image that show a road with lanes from the perspective of a person driving a car.</p><p>I found some good candidates on <a href="https://pixabay.com/">Pixabay.com</a>. Type “driving” or “lanes” in the video search on that website.</p><p>Here is an example of what a frame from one of your videos should look like. This frame is 600 pixels in width and 338 pixels in height:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*aatA4odTBF9J7fxb.jpg" /></figure><h3>Installation and Setup</h3><p>We now need to make sure we have all the software packages installed. Check to see if you have <strong>OpenCV</strong> installed on your machine. If you are using Anaconda, you can type:</p><pre>pip install opencv-python</pre><p>Python Code for Detection of Lane Lines in an Image</p><p>Before we get started, I’ll share with you the entire code you need to perform lane detection in an image. The two programs below are all you need to detect lane lines in a pic.</p><p>You need to make sure that you save both programs below, <strong>edge_detection.py</strong> and<strong> lane.py</strong> in the same directory as the image.</p><p><strong>edge_detection.py</strong> will be a collection of methods that helps isolate lane line edges and lane lines.</p><p><strong>lane.py</strong> is where we will implement a Lane class that represents a lane on a road or highway.</p><p><strong>Don’t be scared at how long the code appears</strong>. I always include a lot of comments in my code since I have the tendency to forget why I did what I did. I always want to be able to revisit my code at a later date and have a clear understanding of what I did and why:</p><p>Here is <strong>edge_detection.py</strong>. Don’t worry, I’ll explain the code later in this article.</p><p>Also I highly recommend to put as much comments as possible I know it can get annoying but <strong>TRUST ME</strong> it will help you explain your code and for others to understand it.</p><pre>import cv2 # Import the OpenCV library to enable computer vision<br>import numpy as np # Import the NumPy scientific computing library<br> <br> <br>def binary_array(array, thresh, value=0):<br>  &quot;&quot;&quot;<br>  Return a 2D binary array (mask) in which all pixels are either 0 or 1<br>     <br>  :param array: NumPy 2D array that we want to convert to binary values<br>  :param thresh: Values used for thresholding (inclusive)<br>  :param value: Output value when between the supplied threshold<br>  :return: Binary 2D array...<br>           number of rows x number of columns = <br>           number of pixels from top to bottom x number of pixels from<br>             left to right <br>  &quot;&quot;&quot;<br>  if value == 0:<br>    # Create an array of ones with the same shape and type as <br>    # the input 2D array.<br>    binary = np.ones_like(array) <br>         <br>  else:<br>    # Creates an array of zeros with the same shape and type as <br>    # the input 2D array.<br>    binary = np.zeros_like(array)  <br>    value = 1<br> <br>  # If value == 0, make all values in binary equal to 0 if the <br>  # corresponding value in the input array is between the threshold <br>  # (inclusive). Otherwise, the value remains as 1. Therefore, the pixels <br>  # with the high Sobel derivative values (i.e. sharp pixel intensity <br>  # discontinuities) will have 0 in the corresponding cell of binary.<br>  binary[(array &gt;= thresh[0]) &amp; (array &lt;= thresh[1])] = value<br> <br>  return binary<br> <br>def blur_gaussian(channel, ksize=3):<br>  &quot;&quot;&quot;<br>  Implementation for Gaussian blur to reduce noise and detail in the image<br>     <br>  :param image: 2D or 3D array to be blurred<br>  :param ksize: Size of the small matrix (i.e. kernel) used to blur<br>                i.e. number of rows and number of columns<br>  :return: Blurred 2D image<br>  &quot;&quot;&quot;<br>  return cv2.GaussianBlur(channel, (ksize, ksize), 0)<br>         <br>def mag_thresh(image, sobel_kernel=3, thresh=(0, 255)):<br>  &quot;&quot;&quot;<br>  Implementation of Sobel edge detection<br> <br>  :param image: 2D or 3D array to be blurred<br>  :param sobel_kernel: Size of the small matrix (i.e. kernel) <br>                       i.e. number of rows and columns<br>  :return: Binary (black and white) 2D mask image<br>  &quot;&quot;&quot;<br>  # Get the magnitude of the edges that are vertically aligned on the image<br>  sobelx = np.absolute(sobel(image, orient=&#39;x&#39;, sobel_kernel=sobel_kernel))<br>         <br>  # Get the magnitude of the edges that are horizontally aligned on the image<br>  sobely = np.absolute(sobel(image, orient=&#39;y&#39;, sobel_kernel=sobel_kernel))<br> <br>  # Find areas of the image that have the strongest pixel intensity changes<br>  # in both the x and y directions. These have the strongest gradients and <br>  # represent the strongest edges in the image (i.e. potential lane lines)<br>  # mag is a 2D array .. number of rows x number of columns = number of pixels<br>  # from top to bottom x number of pixels from left to right<br>  mag = np.sqrt(sobelx ** 2 + sobely ** 2)<br> <br>  # Return a 2D array that contains 0s and 1s   <br>  return binary_array(mag, thresh)<br> <br>def sobel(img_channel, orient=&#39;x&#39;, sobel_kernel=3):<br>  &quot;&quot;&quot;<br>  Find edges that are aligned vertically and horizontally on the image<br>     <br>  :param img_channel: Channel from an image<br>  :param orient: Across which axis of the image are we detecting edges?<br>  :sobel_kernel: No. of rows and columns of the kernel (i.e. 3x3 small matrix)<br>  :return: Image with Sobel edge detection applied<br>  &quot;&quot;&quot;<br>  # cv2.Sobel(input image, data type, prder of the derivative x, order of the<br>  # derivative y, small matrix used to calculate the derivative)<br>  if orient == &#39;x&#39;:<br>    # Will detect differences in pixel intensities going from <br>        # left to right on the image (i.e. edges that are vertically aligned)<br>    sobel = cv2.Sobel(img_channel, cv2.CV_64F, 1, 0, sobel_kernel)<br>  if orient == &#39;y&#39;:<br>    # Will detect differences in pixel intensities going from <br>    # top to bottom on the image (i.e. edges that are horizontally aligned)<br>    sobel = cv2.Sobel(img_channel, cv2.CV_64F, 0, 1, sobel_kernel)<br> <br>  return sobel<br> <br>def threshold(channel, thresh=(128,255), thresh_type=cv2.THRESH_BINARY):<br>  &quot;&quot;&quot;<br>  Apply a threshold to the input channel<br>     <br>  :param channel: 2D array of the channel data of an image/video frame<br>  :param thresh: 2D tuple of min and max threshold values<br>  :param thresh_type: The technique of the threshold to apply<br>  :return: Two outputs are returned:<br>             ret: Threshold that was used<br>             thresholded_image: 2D thresholded data.<br>  &quot;&quot;&quot;<br>  # If pixel intensity is greater than thresh[0], make that value<br>  # white (255), else set it to black (0)<br>  return cv2.threshold(channel, thresh[0], thresh[1], thresh_type)</pre><p>Here is <strong>lane.py</strong></p><pre>import cv2 # Import the OpenCV library to enable computer vision<br>import numpy as np # Import the NumPy scientific computing library<br>import edge_detection as edge # Handles the detection of lane lines<br>import matplotlib.pyplot as plt # Used for plotting and error checking<br> <br> <br>filename = &#39;original_lane_detection_5.jpg&#39;<br> <br>class Lane:<br>  &quot;&quot;&quot;<br>  Represents a lane on a road.<br>  &quot;&quot;&quot;<br>  def __init__(self, orig_frame):<br>    &quot;&quot;&quot;<br>      Default constructor<br>         <br>    :param orig_frame: Original camera image (i.e. frame)<br>    &quot;&quot;&quot;<br>    self.orig_frame = orig_frame<br> <br>    # This will hold an image with the lane lines       <br>    self.lane_line_markings = None<br> <br>    # This will hold the image after perspective transformation<br>    self.warped_frame = None<br>    self.transformation_matrix = None<br>    self.inv_transformation_matrix = None<br> <br>    # (Width, Height) of the original video frame (or image)<br>    self.orig_image_size = self.orig_frame.shape[::-1][1:]<br> <br>    width = self.orig_image_size[0]<br>    height = self.orig_image_size[1]<br>    self.width = width<br>    self.height = height<br>     <br>    # Four corners of the trapezoid-shaped region of interest<br>    # You need to find these corners manually.<br>    self.roi_points = np.float32([<br>      (274,184), # Top-left corner<br>      (0, 337), # Bottom-left corner            <br>      (575,337), # Bottom-right corner<br>      (371,184) # Top-right corner<br>    ])<br>         <br>    # The desired corner locations  of the region of interest<br>    # after we perform perspective transformation.<br>    # Assume image width of 600, padding == 150.<br>    self.padding = int(0.25 * width) # padding from side of the image in pixels<br>    self.desired_roi_points = np.float32([<br>      [self.padding, 0], # Top-left corner<br>      [self.padding, self.orig_image_size[1]], # Bottom-left corner         <br>      [self.orig_image_size[<br>        0]-self.padding, self.orig_image_size[1]], # Bottom-right corner<br>      [self.orig_image_size[0]-self.padding, 0] # Top-right corner<br>    ]) <br>         <br>    # Histogram that shows the white pixel peaks for lane line detection<br>    self.histogram = None<br>         <br>    # Sliding window parameters<br>    self.no_of_windows = 10<br>    self.margin = int((1/12) * width)  # Window width is +/- margin<br>    self.minpix = int((1/24) * width)  # Min no. of pixels to recenter window<br>         <br>    # Best fit polynomial lines for left line and right line of the lane<br>    self.left_fit = None<br>    self.right_fit = None<br>    self.left_lane_inds = None<br>    self.right_lane_inds = None<br>    self.ploty = None<br>    self.left_fitx = None<br>    self.right_fitx = None<br>    self.leftx = None<br>    self.rightx = None<br>    self.lefty = None<br>    self.righty = None<br>         <br>    # Pixel parameters for x and y dimensions<br>    self.YM_PER_PIX = 10.0 / 1000 # meters per pixel in y dimension<br>    self.XM_PER_PIX = 3.7 / 781 # meters per pixel in x dimension<br>         <br>    # Radii of curvature and offset<br>    self.left_curvem = None<br>    self.right_curvem = None<br>    self.center_offset = None<br> <br>  def calculate_car_position(self, print_to_terminal=False):<br>    &quot;&quot;&quot;<br>    Calculate the position of the car relative to the center<br>         <br>    :param: print_to_terminal Display data to console if True       <br>    :return: Offset from the center of the lane<br>    &quot;&quot;&quot;<br>    # Assume the camera is centered in the image.<br>    # Get position of car in centimeters<br>    car_location = self.orig_frame.shape[1] / 2<br> <br>    # Fine the x coordinate of the lane line bottom<br>    height = self.orig_frame.shape[0]<br>    bottom_left = self.left_fit[0]*height**2 + self.left_fit[<br>      1]*height + self.left_fit[2]<br>    bottom_right = self.right_fit[0]*height**2 + self.right_fit[<br>      1]*height + self.right_fit[2]<br> <br>    center_lane = (bottom_right - bottom_left)/2 + bottom_left <br>    center_offset = (np.abs(car_location) - np.abs(<br>      center_lane)) * self.XM_PER_PIX * 100<br> <br>    if print_to_terminal == True:<br>      print(str(center_offset) + &#39;cm&#39;)<br>             <br>    self.center_offset = center_offset<br>       <br>    return center_offset<br> <br>  def calculate_curvature(self, print_to_terminal=False):<br>    &quot;&quot;&quot;<br>    Calculate the road curvature in meters.<br> <br>    :param: print_to_terminal Display data to console if True<br>    :return: Radii of curvature<br>    &quot;&quot;&quot;<br>    # Set the y-value where we want to calculate the road curvature.<br>    # Select the maximum y-value, which is the bottom of the frame.<br>    y_eval = np.max(self.ploty)    <br> <br>    # Fit polynomial curves to the real world environment<br>    left_fit_cr = np.polyfit(self.lefty * self.YM_PER_PIX, self.leftx * (<br>      self.XM_PER_PIX), 2)<br>    right_fit_cr = np.polyfit(self.righty * self.YM_PER_PIX, self.rightx * (<br>      self.XM_PER_PIX), 2)<br>             <br>    # Calculate the radii of curvature<br>    left_curvem = ((1 + (2*left_fit_cr[0]*y_eval*self.YM_PER_PIX + left_fit_cr[<br>                    1])**2)**1.5) / np.absolute(2*left_fit_cr[0])<br>    right_curvem = ((1 + (2*right_fit_cr[<br>                    0]*y_eval*self.YM_PER_PIX + right_fit_cr[<br>                    1])**2)**1.5) / np.absolute(2*right_fit_cr[0])<br>     <br>    # Display on terminal window<br>    if print_to_terminal == True:<br>      print(left_curvem, &#39;m&#39;, right_curvem, &#39;m&#39;)<br>             <br>    self.left_curvem = left_curvem<br>    self.right_curvem = right_curvem<br> <br>    return left_curvem, right_curvem        <br>         <br>  def calculate_histogram(self,frame=None,plot=True):<br>    &quot;&quot;&quot;<br>    Calculate the image histogram to find peaks in white pixel count<br>         <br>    :param frame: The warped image<br>    :param plot: Create a plot if True<br>    &quot;&quot;&quot;<br>    if frame is None:<br>      frame = self.warped_frame<br>             <br>    # Generate the histogram<br>    self.histogram = np.sum(frame[int(<br>              frame.shape[0]/2):,:], axis=0)<br> <br>    if plot == True:<br>         <br>      # Draw both the image and the histogram<br>      figure, (ax1, ax2) = plt.subplots(2,1) # 2 row, 1 columns<br>      figure.set_size_inches(10, 5)<br>      ax1.imshow(frame, cmap=&#39;gray&#39;)<br>      ax1.set_title(&quot;Warped Binary Frame&quot;)<br>      ax2.plot(self.histogram)<br>      ax2.set_title(&quot;Histogram Peaks&quot;)<br>      plt.show()<br>             <br>    return self.histogram<br> <br>  def display_curvature_offset(self, frame=None, plot=False):<br>    &quot;&quot;&quot;<br>    Display curvature and offset statistics on the image<br>         <br>    :param: plot Display the plot if True<br>    :return: Image with lane lines and curvature<br>    &quot;&quot;&quot;<br>    image_copy = None<br>    if frame is None:<br>      image_copy = self.orig_frame.copy()<br>    else:<br>      image_copy = frame<br> <br>    cv2.putText(image_copy,&#39;Curve Radius: &#39;+str((<br>      self.left_curvem+self.right_curvem)/2)[:7]+&#39; m&#39;, (int((<br>      5/600)*self.width), int((<br>      20/338)*self.height)), cv2.FONT_HERSHEY_SIMPLEX, (float((<br>      0.5/600)*self.width)),(<br>      255,255,255),2,cv2.LINE_AA)<br>    cv2.putText(image_copy,&#39;Center Offset: &#39;+str(<br>      self.center_offset)[:7]+&#39; cm&#39;, (int((<br>      5/600)*self.width), int((<br>      40/338)*self.height)), cv2.FONT_HERSHEY_SIMPLEX, (float((<br>      0.5/600)*self.width)),(<br>      255,255,255),2,cv2.LINE_AA)<br>             <br>    if plot==True:       <br>      cv2.imshow(&quot;Image with Curvature and Offset&quot;, image_copy)<br> <br>    return image_copy<br>     <br>  def get_lane_line_previous_window(self, left_fit, right_fit, plot=False):<br>    &quot;&quot;&quot;<br>    Use the lane line from the previous sliding window to get the parameters<br>    for the polynomial line for filling in the lane line<br>    :param: left_fit Polynomial function of the left lane line<br>    :param: right_fit Polynomial function of the right lane line<br>    :param: plot To display an image or not<br>    &quot;&quot;&quot;<br>    # margin is a sliding window parameter<br>    margin = self.margin<br> <br>    # Find the x and y coordinates of all the nonzero <br>    # (i.e. white) pixels in the frame.         <br>    nonzero = self.warped_frame.nonzero()  <br>    nonzeroy = np.array(nonzero[0])<br>    nonzerox = np.array(nonzero[1])<br>         <br>    # Store left and right lane pixel indices<br>    left_lane_inds = ((nonzerox &gt; (left_fit[0]*(<br>      nonzeroy**2) + left_fit[1]*nonzeroy + left_fit[2] - margin)) &amp; (<br>      nonzerox &lt; (left_fit[0]*(<br>      nonzeroy**2) + left_fit[1]*nonzeroy + left_fit[2] + margin))) <br>    right_lane_inds = ((nonzerox &gt; (right_fit[0]*(<br>      nonzeroy**2) + right_fit[1]*nonzeroy + right_fit[2] - margin)) &amp; (<br>      nonzerox &lt; (right_fit[0]*(<br>      nonzeroy**2) + right_fit[1]*nonzeroy + right_fit[2] + margin)))           <br>    self.left_lane_inds = left_lane_inds<br>    self.right_lane_inds = right_lane_inds<br> <br>    # Get the left and right lane line pixel locations  <br>    leftx = nonzerox[left_lane_inds]<br>    lefty = nonzeroy[left_lane_inds] <br>    rightx = nonzerox[right_lane_inds]<br>    righty = nonzeroy[right_lane_inds]  <br> <br>    self.leftx = leftx<br>    self.rightx = rightx<br>    self.lefty = lefty<br>    self.righty = righty        <br>     <br>    # Fit a second order polynomial curve to each lane line<br>    left_fit = np.polyfit(lefty, leftx, 2)<br>    right_fit = np.polyfit(righty, rightx, 2)<br>    self.left_fit = left_fit<br>    self.right_fit = right_fit<br>         <br>    # Create the x and y values to plot on the image<br>    ploty = np.linspace(<br>      0, self.warped_frame.shape[0]-1, self.warped_frame.shape[0]) <br>    left_fitx = left_fit[0]*ploty**2 + left_fit[1]*ploty + left_fit[2]<br>    right_fitx = right_fit[0]*ploty**2 + right_fit[1]*ploty + right_fit[2]<br>    self.ploty = ploty<br>    self.left_fitx = left_fitx<br>    self.right_fitx = right_fitx<br>         <br>    if plot==True:<br>         <br>      # Generate images to draw on<br>      out_img = np.dstack((self.warped_frame, self.warped_frame, (<br>                           self.warped_frame)))*255<br>      window_img = np.zeros_like(out_img)<br>             <br>      # Add color to the left and right line pixels<br>      out_img[nonzeroy[left_lane_inds], nonzerox[left_lane_inds]] = [255, 0, 0]<br>      out_img[nonzeroy[right_lane_inds], nonzerox[right_lane_inds]] = [<br>                                                                     0, 0, 255]<br>      # Create a polygon to show the search window area, and recast <br>      # the x and y points into a usable format for cv2.fillPoly()<br>      margin = self.margin<br>      left_line_window1 = np.array([np.transpose(np.vstack([<br>                                    left_fitx-margin, ploty]))])<br>      left_line_window2 = np.array([np.flipud(np.transpose(np.vstack([<br>                                    left_fitx+margin, ploty])))])<br>      left_line_pts = np.hstack((left_line_window1, left_line_window2))<br>      right_line_window1 = np.array([np.transpose(np.vstack([<br>                                     right_fitx-margin, ploty]))])<br>      right_line_window2 = np.array([np.flipud(np.transpose(np.vstack([<br>                                     right_fitx+margin, ploty])))])<br>      right_line_pts = np.hstack((right_line_window1, right_line_window2))<br>             <br>      # Draw the lane onto the warped blank image<br>      cv2.fillPoly(window_img, np.int_([left_line_pts]), (0,255, 0))<br>      cv2.fillPoly(window_img, np.int_([right_line_pts]), (0,255, 0))<br>      result = cv2.addWeighted(out_img, 1, window_img, 0.3, 0)<br>       <br>      # Plot the figures <br>      figure, (ax1, ax2, ax3) = plt.subplots(3,1) # 3 rows, 1 column<br>      figure.set_size_inches(10, 10)<br>      figure.tight_layout(pad=3.0)<br>      ax1.imshow(cv2.cvtColor(self.orig_frame, cv2.COLOR_BGR2RGB))<br>      ax2.imshow(self.warped_frame, cmap=&#39;gray&#39;)<br>      ax3.imshow(result)<br>      ax3.plot(left_fitx, ploty, color=&#39;yellow&#39;)<br>      ax3.plot(right_fitx, ploty, color=&#39;yellow&#39;)<br>      ax1.set_title(&quot;Original Frame&quot;)  <br>      ax2.set_title(&quot;Warped Frame&quot;)<br>      ax3.set_title(&quot;Warped Frame With Search Window&quot;)<br>      plt.show()<br>             <br>  def get_lane_line_indices_sliding_windows(self, plot=False):<br>    &quot;&quot;&quot;<br>    Get the indices of the lane line pixels using the <br>    sliding windows technique.<br>         <br>    :param: plot Show plot or not<br>    :return: Best fit lines for the left and right lines of the current lane <br>    &quot;&quot;&quot;<br>    # Sliding window width is +/- margin<br>    margin = self.margin<br> <br>    frame_sliding_window = self.warped_frame.copy()<br> <br>    # Set the height of the sliding windows<br>    window_height = np.int(self.warped_frame.shape[0]/self.no_of_windows)       <br> <br>    # Find the x and y coordinates of all the nonzero <br>    # (i.e. white) pixels in the frame. <br>    nonzero = self.warped_frame.nonzero()<br>    nonzeroy = np.array(nonzero[0])<br>    nonzerox = np.array(nonzero[1]) <br>         <br>    # Store the pixel indices for the left and right lane lines<br>    left_lane_inds = []<br>    right_lane_inds = []<br>         <br>    # Current positions for pixel indices for each window,<br>    # which we will continue to update<br>    leftx_base, rightx_base = self.histogram_peak()<br>    leftx_current = leftx_base<br>    rightx_current = rightx_base<br> <br>    # Go through one window at a time<br>    no_of_windows = self.no_of_windows<br>         <br>    for window in range(no_of_windows):<br>       <br>      # Identify window boundaries in x and y (and right and left)<br>      win_y_low = self.warped_frame.shape[0] - (window + 1) * window_height<br>      win_y_high = self.warped_frame.shape[0] - window * window_height<br>      win_xleft_low = leftx_current - margin<br>      win_xleft_high = leftx_current + margin<br>      win_xright_low = rightx_current - margin<br>      win_xright_high = rightx_current + margin<br>      cv2.rectangle(frame_sliding_window,(win_xleft_low,win_y_low),(<br>        win_xleft_high,win_y_high), (255,255,255), 2)<br>      cv2.rectangle(frame_sliding_window,(win_xright_low,win_y_low),(<br>        win_xright_high,win_y_high), (255,255,255), 2)<br> <br>      # Identify the nonzero pixels in x and y within the window<br>      good_left_inds = ((nonzeroy &gt;= win_y_low) &amp; (nonzeroy &lt; win_y_high) &amp; <br>                          (nonzerox &gt;= win_xleft_low) &amp; (<br>                           nonzerox &lt; win_xleft_high)).nonzero()[0]<br>      good_right_inds = ((nonzeroy &gt;= win_y_low) &amp; (nonzeroy &lt; win_y_high) &amp; <br>                           (nonzerox &gt;= win_xright_low) &amp; (<br>                            nonzerox &lt; win_xright_high)).nonzero()[0]<br>                                                         <br>      # Append these indices to the lists<br>      left_lane_inds.append(good_left_inds)<br>      right_lane_inds.append(good_right_inds)<br>         <br>      # If you found &gt; minpix pixels, recenter next window on mean position<br>      minpix = self.minpix<br>      if len(good_left_inds) &gt; minpix:<br>        leftx_current = np.int(np.mean(nonzerox[good_left_inds]))<br>      if len(good_right_inds) &gt; minpix:        <br>        rightx_current = np.int(np.mean(nonzerox[good_right_inds]))<br>                     <br>    # Concatenate the arrays of indices<br>    left_lane_inds = np.concatenate(left_lane_inds)<br>    right_lane_inds = np.concatenate(right_lane_inds)<br> <br>    # Extract the pixel coordinates for the left and right lane lines<br>    leftx = nonzerox[left_lane_inds]<br>    lefty = nonzeroy[left_lane_inds] <br>    rightx = nonzerox[right_lane_inds] <br>    righty = nonzeroy[right_lane_inds]<br> <br>    # Fit a second order polynomial curve to the pixel coordinates for<br>    # the left and right lane lines<br>    left_fit = np.polyfit(lefty, leftx, 2)<br>    right_fit = np.polyfit(righty, rightx, 2) <br>         <br>    self.left_fit = left_fit<br>    self.right_fit = right_fit<br> <br>    if plot==True:<br>         <br>      # Create the x and y values to plot on the image  <br>      ploty = np.linspace(<br>        0, frame_sliding_window.shape[0]-1, frame_sliding_window.shape[0])<br>      left_fitx = left_fit[0]*ploty**2 + left_fit[1]*ploty + left_fit[2]<br>      right_fitx = right_fit[0]*ploty**2 + right_fit[1]*ploty + right_fit[2]<br> <br>      # Generate an image to visualize the result<br>      out_img = np.dstack((<br>        frame_sliding_window, frame_sliding_window, (<br>        frame_sliding_window))) * 255<br>             <br>      # Add color to the left line pixels and right line pixels<br>      out_img[nonzeroy[left_lane_inds], nonzerox[left_lane_inds]] = [255, 0, 0]<br>      out_img[nonzeroy[right_lane_inds], nonzerox[right_lane_inds]] = [<br>        0, 0, 255]<br>                 <br>      # Plot the figure with the sliding windows<br>      figure, (ax1, ax2, ax3) = plt.subplots(3,1) # 3 rows, 1 column<br>      figure.set_size_inches(10, 10)<br>      figure.tight_layout(pad=3.0)<br>      ax1.imshow(cv2.cvtColor(self.orig_frame, cv2.COLOR_BGR2RGB))<br>      ax2.imshow(frame_sliding_window, cmap=&#39;gray&#39;)<br>      ax3.imshow(out_img)<br>      ax3.plot(left_fitx, ploty, color=&#39;yellow&#39;)<br>      ax3.plot(right_fitx, ploty, color=&#39;yellow&#39;)<br>      ax1.set_title(&quot;Original Frame&quot;)  <br>      ax2.set_title(&quot;Warped Frame with Sliding Windows&quot;)<br>      ax3.set_title(&quot;Detected Lane Lines with Sliding Windows&quot;)<br>      plt.show()        <br>             <br>    return self.left_fit, self.right_fit<br> <br>  def get_line_markings(self, frame=None):<br>    &quot;&quot;&quot;<br>    Isolates lane lines.<br>   <br>      :param frame: The camera frame that contains the lanes we want to detect<br>    :return: Binary (i.e. black and white) image containing the lane lines.<br>    &quot;&quot;&quot;<br>    if frame is None:<br>      frame = self.orig_frame<br>             <br>    # Convert the video frame from BGR (blue, green, red) <br>    # color space to HLS (hue, saturation, lightness).<br>    hls = cv2.cvtColor(frame, cv2.COLOR_BGR2HLS)<br> <br>    ################### Isolate possible lane line edges ######################<br>         <br>    # Perform Sobel edge detection on the L (lightness) channel of <br>    # the image to detect sharp discontinuities in the pixel intensities <br>    # along the x and y axis of the video frame.             <br>    # sxbinary is a matrix full of 0s (black) and 255 (white) intensity values<br>    # Relatively light pixels get made white. Dark pixels get made black.<br>    _, sxbinary = edge.threshold(hls[:, :, 1], thresh=(120, 255))<br>    sxbinary = edge.blur_gaussian(sxbinary, ksize=3) # Reduce noise<br>         <br>    # 1s will be in the cells with the highest Sobel derivative values<br>    # (i.e. strongest lane line edges)<br>    sxbinary = edge.mag_thresh(sxbinary, sobel_kernel=3, thresh=(110, 255))<br> <br>    ######################## Isolate possible lane lines ######################<br>   <br>    # Perform binary thresholding on the S (saturation) channel <br>    # of the video frame. A high saturation value means the hue color is pure.<br>    # We expect lane lines to be nice, pure colors (i.e. solid white, yellow)<br>    # and have high saturation channel values.<br>    # s_binary is matrix full of 0s (black) and 255 (white) intensity values<br>    # White in the regions with the purest hue colors (e.g. &gt;80...play with<br>    # this value for best results).<br>    s_channel = hls[:, :, 2] # use only the saturation channel data<br>    _, s_binary = edge.threshold(s_channel, (80, 255))<br>     <br>    # Perform binary thresholding on the R (red) channel of the <br>        # original BGR video frame. <br>    # r_thresh is a matrix full of 0s (black) and 255 (white) intensity values<br>    # White in the regions with the richest red channel values (e.g. &gt;120).<br>    # Remember, pure white is bgr(255, 255, 255).<br>    # Pure yellow is bgr(0, 255, 255). Both have high red channel values.<br>    _, r_thresh = edge.threshold(frame[:, :, 2], thresh=(120, 255))<br> <br>    # Lane lines should be pure in color and have high red channel values <br>    # Bitwise AND operation to reduce noise and black-out any pixels that<br>    # don&#39;t appear to be nice, pure, solid colors (like white or yellow lane <br>    # lines.)       <br>    rs_binary = cv2.bitwise_and(s_binary, r_thresh)<br> <br>    ### Combine the possible lane lines with the possible lane line edges ##### <br>    # If you show rs_binary visually, you&#39;ll see that it is not that different <br>    # from this return value. The edges of lane lines are thin lines of pixels.<br>    self.lane_line_markings = cv2.bitwise_or(rs_binary, sxbinary.astype(<br>                              np.uint8))    <br>    return self.lane_line_markings<br>         <br>  def histogram_peak(self):<br>    &quot;&quot;&quot;<br>    Get the left and right peak of the histogram<br> <br>    Return the x coordinate of the left histogram peak and the right histogram<br>    peak.<br>    &quot;&quot;&quot;<br>    midpoint = np.int(self.histogram.shape[0]/2)<br>    leftx_base = np.argmax(self.histogram[:midpoint])<br>    rightx_base = np.argmax(self.histogram[midpoint:]) + midpoint<br> <br>    # (x coordinate of left peak, x coordinate of right peak)<br>    return leftx_base, rightx_base<br>         <br>  def overlay_lane_lines(self, plot=False):<br>    &quot;&quot;&quot;<br>    Overlay lane lines on the original frame<br>    :param: Plot the lane lines if True<br>    :return: Lane with overlay<br>    &quot;&quot;&quot;<br>    # Generate an image to draw the lane lines on <br>    warp_zero = np.zeros_like(self.warped_frame).astype(np.uint8)<br>    color_warp = np.dstack((warp_zero, warp_zero, warp_zero))       <br>         <br>    # Recast the x and y points into usable format for cv2.fillPoly()<br>    pts_left = np.array([np.transpose(np.vstack([<br>                         self.left_fitx, self.ploty]))])<br>    pts_right = np.array([np.flipud(np.transpose(np.vstack([<br>                          self.right_fitx, self.ploty])))])<br>    pts = np.hstack((pts_left, pts_right))<br>         <br>    # Draw lane on the warped blank image<br>    cv2.fillPoly(color_warp, np.int_([pts]), (0,255, 0))<br> <br>    # Warp the blank back to original image space using inverse perspective <br>    # matrix (Minv)<br>    newwarp = cv2.warpPerspective(color_warp, self.inv_transformation_matrix, (<br>                                  self.orig_frame.shape[<br>                                  1], self.orig_frame.shape[0]))<br>     <br>    # Combine the result with the original image<br>    result = cv2.addWeighted(self.orig_frame, 1, newwarp, 0.3, 0)<br>         <br>    if plot==True:<br>      <br>      # Plot the figures <br>      figure, (ax1, ax2) = plt.subplots(2,1) # 2 rows, 1 column<br>      figure.set_size_inches(10, 10)<br>      figure.tight_layout(pad=3.0)<br>      ax1.imshow(cv2.cvtColor(self.orig_frame, cv2.COLOR_BGR2RGB))<br>      ax2.imshow(cv2.cvtColor(result, cv2.COLOR_BGR2RGB))<br>      ax1.set_title(&quot;Original Frame&quot;)  <br>      ax2.set_title(&quot;Original Frame With Lane Overlay&quot;)<br>      plt.show()   <br> <br>    return result           <br>     <br>  def perspective_transform(self, frame=None, plot=False):<br>    &quot;&quot;&quot;<br>    Perform the perspective transform.<br>    :param: frame Current frame<br>    :param: plot Plot the warped image if True<br>    :return: Bird&#39;s eye view of the current lane<br>    &quot;&quot;&quot;<br>    if frame is None:<br>      frame = self.lane_line_markings<br>             <br>    # Calculate the transformation matrix<br>    self.transformation_matrix = cv2.getPerspectiveTransform(<br>      self.roi_points, self.desired_roi_points)<br> <br>    # Calculate the inverse transformation matrix           <br>    self.inv_transformation_matrix = cv2.getPerspectiveTransform(<br>      self.desired_roi_points, self.roi_points)<br> <br>    # Perform the transform using the transformation matrix<br>    self.warped_frame = cv2.warpPerspective(<br>      frame, self.transformation_matrix, self.orig_image_size, flags=(<br>     cv2.INTER_LINEAR)) <br> <br>    # Convert image to binary<br>    (thresh, binary_warped) = cv2.threshold(<br>      self.warped_frame, 127, 255, cv2.THRESH_BINARY)           <br>    self.warped_frame = binary_warped<br> <br>    # Display the perspective transformed (i.e. warped) frame<br>    if plot == True:<br>      warped_copy = self.warped_frame.copy()<br>      warped_plot = cv2.polylines(warped_copy, np.int32([<br>                    self.desired_roi_points]), True, (147,20,255), 3)<br> <br>      # Display the image<br>      while(1):<br>        cv2.imshow(&#39;Warped Image&#39;, warped_plot)<br>             <br>        # Press any key to stop<br>        if cv2.waitKey(0):<br>          break<br> <br>      cv2.destroyAllWindows()   <br>             <br>    return self.warped_frame        <br>     <br>  def plot_roi(self, frame=None, plot=False):<br>    &quot;&quot;&quot;<br>    Plot the region of interest on an image.<br>    :param: frame The current image frame<br>    :param: plot Plot the roi image if True<br>    &quot;&quot;&quot;<br>    if plot == False:<br>      return<br>             <br>    if frame is None:<br>      frame = self.orig_frame.copy()<br> <br>    # Overlay trapezoid on the frame<br>    this_image = cv2.polylines(frame, np.int32([<br>      self.roi_points]), True, (147,20,255), 3)<br> <br>    # Display the image<br>    while(1):<br>      cv2.imshow(&#39;ROI Image&#39;, this_image)<br>             <br>      # Press any key to stop<br>      if cv2.waitKey(0):<br>        break<br> <br>    cv2.destroyAllWindows()<br>     <br>def main():<br>     <br>  # Load a frame (or image)<br>  original_frame = cv2.imread(filename)<br> <br>  # Create a Lane object<br>  lane_obj = Lane(orig_frame=original_frame)<br> <br>  # Perform thresholding to isolate lane lines<br>  lane_line_markings = lane_obj.get_line_markings()<br> <br>  # Plot the region of interest on the image<br>  lane_obj.plot_roi(plot=False)<br> <br>  # Perform the perspective transform to generate a bird&#39;s eye view<br>  # If Plot == True, show image with new region of interest<br>  warped_frame = lane_obj.perspective_transform(plot=False)<br> <br>  # Generate the image histogram to serve as a starting point<br>  # for finding lane line pixels<br>  histogram = lane_obj.calculate_histogram(plot=False)  <br>     <br>  # Find lane line pixels using the sliding window method <br>  left_fit, right_fit = lane_obj.get_lane_line_indices_sliding_windows(<br>    plot=False)<br> <br>  # Fill in the lane line<br>  lane_obj.get_lane_line_previous_window(left_fit, right_fit, plot=False)<br>     <br>  # Overlay lines on the original frame<br>  frame_with_lane_lines = lane_obj.overlay_lane_lines(plot=False)<br> <br>  # Calculate lane line curvature (left and right lane lines)<br>  lane_obj.calculate_curvature(print_to_terminal=False)<br> <br>  # Calculate center offset                                                                 <br>  lane_obj.calculate_car_position(print_to_terminal=False)<br>     <br>  # Display curvature and center offset on image<br>  frame_with_lane_lines2 = lane_obj.display_curvature_offset(<br>    frame=frame_with_lane_lines, plot=True)<br>     <br>  # Create the output file name by removing the &#39;.jpg&#39; part<br>  size = len(filename)<br>  new_filename = filename[:size - 4]<br>  new_filename = new_filename + &#39;_thresholded.jpg&#39;     <br>     <br>  # Save the new image in the working directory<br>  #cv2.imwrite(new_filename, lane_line_markings)<br> <br>  # Display the image <br>  #cv2.imshow(&quot;Image&quot;, lane_line_markings) <br>     <br>  # Display the window until any key is pressed<br>  cv2.waitKey(0) <br>     <br>  # Close all windows<br>  cv2.destroyAllWindows() <br>     <br>main()</pre><p>Now that you have all the code to detect lane lines in an image, let’s explain what each piece of the code does.</p><h3>Isolate Pixels That Could Represent Lane Lines</h3><p>The first part of the lane detection process is to apply <strong>thresholding</strong> (I’ll explain what this term means in a second) to each video frame so that we can eliminate things that make it difficult to detect lane lines. By applying thresholding, we can <strong>isolate the pixels that represent lane lines.</strong></p><p>Glare from the sun, shadows, car headlights, and road surface changes can all make it difficult to find lanes in a video frame or image.</p><p>What does thresholding mean? Basic thresholding involves replacing each pixel in a video frame with a black pixel if the intensity of that pixel is less than some constant, or a white pixel if the intensity of that pixel is greater than some constant. The end result is a binary (black and white) image of the road. A binary image is one in which each pixel is either 1 (white) or 0 (black).</p><p><strong>Before thresholding</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*BSKEw55VKG0nuvok.jpg" /></figure><p><strong>After thresholding:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*SQ0yIIGICrIp6Jm1.jpg" /></figure><h3>Thresholding Steps</h3><p><strong>1. Convert the video frame from BGR (blue, green, red) color space to HLS (hue, saturation, lightness).</strong></p><p>There are a lot of ways to represent colors in an image. If you’ve ever used a program like Microsoft Paint or Adobe Photoshop, you know that one way to represent a color is by using the RGB color space (<strong>in OpenCV it is BGR instead of RGB</strong>), where every color is a mixture of three colors, red, green, and blue. You can play around with the RGB color space <a href="https://www.rapidtables.com/web/color/RGB_Color.html">here at this website</a>.</p><p>The HLS color space is better than the BGR color space for detecting image issues due to lighting, such as shadows, glare from the sun, headlights, etc. We want to eliminate all these things to make it easier to detect lane lines. For this reason, we use the HLS color space, which divides all colors into hue, saturation, and lightness values.</p><p>If you want to play around with the HLS color space, there are a lot of HLS color picker websites to choose from if you do a Google search.</p><p><strong>2. Perform Sobel edge detection on the L (lightness) channel of the image to detect sharp discontinuities in the pixel intensities along the x and y axis of the video frame.</strong></p><p>Sharp changes in intensity from one pixel to a neighboring pixel means that an edge is likely present. We want to detect the strongest edges in the image so that we can isolate potential lane line edges.</p><p><strong>3. Perform binary thresholding on the S (saturation) channel of the video frame.</strong></p><p>Doing this helps to eliminate dull road colors.</p><p>A high saturation value means the hue color is pure. We expect lane lines to be nice, pure colors, such as solid white and solid yellow. Both solid white and solid yellow, have high saturation channel values.</p><p>Binary thresholding generates an image that is full of 0s (black) and 255 (white) intensity values. Pixels with high saturation values (e.g. &gt; 80 on a scale from 0 to 255) will be set to white, while everything else will be set to black.</p><p>Feel free to play around with that threshold value. I set it to 80, but you can set it to another number, and see if you get better results.</p><p><strong>4. Perform binary thresholding on the R (red) channel of the original BGR video frame.</strong></p><p>This step helps extract the yellow and white color values, which are the typical colors of lane lines.</p><p>Remember, pure white is bgr(255, 255, 255). Pure yellow is bgr(0, 255, 255). Both have high red channel values.</p><p>To generate our binary image at this stage, pixels that have rich red channel values (e.g. &gt; 120 on a scale from 0 to 255) will be set to white. All other pixels will be set to black.</p><p><strong>5. Perform the </strong><a href="https://en.wikipedia.org/wiki/Bitwise_operation#AND"><strong>bitwise AND operation</strong></a><strong> to reduce noise in the image caused by shadows and variations in the road color.</strong></p><p>Lane lines should be pure in color and have high red channel values. The bitwise AND operation reduces noise and blacks-out any pixels that don’t appear to be nice, pure, solid colors (like white or yellow lane lines.)</p><p>The <strong>get_line_markings(self, frame=None)</strong> method in <strong>lane.py </strong>performs all the steps I have mentioned above.</p><p>If you uncomment this line below, you will see the output:</p><pre>cv2.imshow(&quot;Image&quot;, lane_line_markings)</pre><p>To see the output, you run this command from within the directory with your test image and the lane.py and edge_detection.py program.</p><pre>python lane.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*R83FkAcwRsaTH1dN.png" /></figure><p>For best results, play around with this line on the <strong>lane.py </strong>program. Move the 80 value up or down, and see what results you get.</p><pre>_, s_binary = edge.threshold(s_channel, (80, 255))</pre><p>Now that we know how to isolate lane lines in an image, let’s continue on to the next step of the lane detection process.</p><h3>Apply Perspective Transformation to Get a Bird’s Eye View</h3><p>We now know how to isolate lane lines in an image, but we still have some problems. Remember that one of the goals of this project was to calculate the radius of curvature of the road lane. Calculating the radius of curvature will enable us to know which direction the road is turning. But we can’t do this yet at this stage due to the perspective of the camera. Let me explain.</p><h3>Why We Need to Do Perspective Transformation</h3><p>Imagine you’re a bird. You’re flying high above the road lanes below. From a birds-eye view, the lines on either side of the lane look like they are parallel.</p><p>However, from the perspective of the camera mounted on a car below, the lane lines make a trapezoid-like shape. We can’t properly calculate the radius of curvature of the lane because, from the camera’s perspective, the lane width appears to decrease the farther away you get from the car.</p><p>In fact, way out on the horizon, the lane lines appear to converge to a point (known in computer vision jargon as <strong>vanishing point</strong>). You can see this effect in the image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*BR95K_y6mLdaj1JL.jpg" /></figure><p>The camera’s perspective is therefore not an accurate representation of what is going on in the real world. We need to fix this so that we can calculate the curvature of the land and the road (which will later help us when we want to steer the car appropriately).</p><h3>How Perspective Transformation Works</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*6-s56jYI6r5ET-o7.jpg" /></figure><p>Fortunately, OpenCV has methods that help us perform perspective transformation (i.e. projective transformation or projective geometry). These methods <strong>warp</strong> the camera’s perspective into a birds-eye view (i.e. aerial view) perspective.</p><p>For the first step of perspective transformation, we need to identify a region of interest (ROI). This step helps remove parts of the image we’re not interested in. We are only interested in the lane segment that is immediately in front of the car.</p><p>You can run lane.py from the previous section. With the image displayed, hover your cursor over the image and find the four key corners of the trapezoid.</p><p>Write these corners down. These will be the roi_points (roi = region of interest) for the lane. In the code (which I’ll show below), these points appear in the __init__ constructor of the Lane class. They are stored in the <strong>self.roi_points</strong> variable.</p><p>In the following line of code in lane.py, change the parameter value from False to True so that the region of interest image will appear.</p><pre>lane_obj.plot_roi(plot=True)</pre><p>Run lane.py</p><pre>python lane.py</pre><p>Here is an example ROI output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*5lUGvR1YyCxL59LF.png" /></figure><p>You can see that the ROI is the shape of a trapezoid, with four distinct corners.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*rto5GpEne691G0Hq.png" /></figure><p>Now that we have the region of interest, we use OpenCV’s <a href="https://docs.opencv.org/master/da/d54/group__imgproc__transform.html"><strong>getPerspectiveTransform</strong> and <strong>warpPerspective</strong></a><strong> </strong>methods to transform the <strong>trapezoid-like</strong> perspective into a<strong> rectangle-like</strong> perspective.</p><p>Change the parameter value in this line of code in lane.py from False to True.</p><pre>warped_frame = lane_obj.perspective_transform(plot=True)</pre><p>Here is an example of an image after this process. You can see how the perspective is now from a birds-eye view. The ROI lines are now parallel to the sides of the image, making it easier to calculate the curvature of the road and the lane.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*RvrXvbkeeg3uC21J.png" /></figure><h3>Identify Lane Line Pixels</h3><p>We now need to identify the pixels on the warped image that make up lane lines. Looking at the warped image, we can see that white pixels represent pieces of the lane lines.</p><p>We start lane line pixel detection by generating a histogram to locate areas of the image that have high concentrations of white pixels.</p><p>Ideally, when we draw the histogram, we will have two peaks. There will be a left peak and a right peak, corresponding to the left lane line and the right lane line, respectively.</p><p>In lane.py, make sure to change the parameter value in this line of code (inside the main() method) from False to True so that the histogram will display.</p><pre>histogram = lane_obj.calculate_histogram(plot=True)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*mOOtz5aw08CQ2-J-.png" /></figure><h3>Set Sliding Windows for White Pixel Detection</h3><p>The next step is to use a sliding window technique where we start at the bottom of the image and scan all the way to the top of the image. Each time we search within a sliding window, we add potential lane line pixels to a list. If we have enough lane line pixels in a window, the mean position of these pixels becomes the center of the next sliding window.</p><p>Once we have identified the pixels that correspond to the left and right lane lines, we draw a polynomial best-fit line through the pixels. This line represents our best estimate of the lane lines.</p><p>In this line of code, change the value from False to True.</p><pre>left_fit, right_fit = lane_obj.get_lane_line_indices_sliding_windows(<br>     plot=True)</pre><p>Here is the output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/0*NHkcJ2mvooR1e6dp.jpg" /></figure><h3>Fill in the Lane Line</h3><p>Now let’s fill in the lane line. Change the parameter value on this line from False to True.</p><pre>lane_obj.get_lane_line_previous_window(left_fit, right_fit, plot=True)</pre><p>Here is the output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/0*Lq1o62eK15yU3v-k.jpg" /></figure><h3>Overlay Lane Lines on Original Image</h3><p>Now that we’ve identified the lane lines, we need to overlay that information on the original image.</p><p>Change the parameter on this line form False to True and run lane.py.</p><pre>frame_with_lane_lines = lane_obj.overlay_lane_lines(plot=True)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*w3C4IHta8q3o5HGr.jpg" /></figure><h3>Calculate Lane Line Curvature</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*4L_IddftnhCwIYo-.png" /></figure><p>Now, we need to calculate the curvature of the lane line. Change the parameter value on this line from False to True.</p><pre>lane_obj.calculate_curvature(print_to_terminal=True)</pre><p>Here is the output. You can see the radius of curvature from the left and right lane lines:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/0*QSc1-nG1BHFyUxkB.jpg" /></figure><h3>Calculate the Center Offset</h3><p>Now we need to calculate how far the center of the car is from the middle of the lane (i.e. the “center offset).</p><p>On the following line, change the parameter value from False to True.</p><pre>lane_obj.calculate_car_position(print_to_terminal=True)</pre><p>Run the program.</p><pre>python lane.py</pre><p>Here is the output. You can see the center offset in centimeters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/0*xmqwt-UHrSn6zemj.jpg" /></figure><h3>Display Final Image</h3><p>Now we will display the final image with the curvature and offset annotations as well as the highlighted lane.</p><p>In lane.py, change this line of code from False to True:</p><pre>frame_with_lane_lines2 = lane_obj.display_curvature_offset(<br>     frame=frame_with_lane_lines, plot=True)</pre><p>Run lane.py.</p><pre>python lane.py</pre><p>Here is the output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*fAWNYdKagzpruv92.png" /></figure><p>You’ll notice that the curve radius is the average of the radius of curvature for the left and right lane lines.</p><h3>Detect Lane Lines in a Video</h3><p>Now that we know how to detect lane lines in an image, let’s see how to detect lane lines in a video stream.</p><p>All we need to do is make some minor changes to the main method in <strong>lane.py</strong> to accommodate video frames as opposed to images.</p><p><a href="https://drive.google.com/file/d/1LzRB2dfXQyftIH3Z3jP2k_286B9Rjh1P/view?usp=sharing">Here is the code for lane.py</a>. It takes a video in mp4 format as input and outputs an annotated image with the lanes.</p><h3>Troubleshooting</h3><p>For best results, play around with this line on the lane.py program. Move the 80 value up or down, and see what results you get.</p><pre>_, s_binary = edge.threshold(s_channel, (80, 255))</pre><p>If you run the code on different videos, you may see a warning that says <strong>“RankWarning: Polyfit may be poorly conditioned”</strong>. If you see this warning, try playing around with the <strong>dimensions of the region of interest </strong>as well as the <strong>thresholds</strong>.</p><p>You can also play with the length of the moving averages. I used a 10-frame moving average, but you can try another value like 5 or 25:</p><pre>if len(prev_left_fit2) &gt; 10:</pre><p>Using an exponential moving average instead of a simple moving average might yield better results as well.</p><p>That’s it for lane line detection. Keep building!</p><p><em>Thanks for reading this article. If you enjoyed it, feel free to add me on </em><a href="http://www.linkedin.com/in/umer-shehzad-112702238"><em>LinkedIn</em></a><em> and follow this page for more articles on autonomous vehicles :)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ca313da6886" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Autonomous Vehicles: Everything You Need to Know in less than 10 Minutes ]]></title>
            <link>https://medium.com/@umer.shehzad1006/autonomous-vehicles-everything-you-need-to-know-in-less-than-10-minutes-1f3844453203?source=rss-eceb3131800b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f3844453203</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[lidar-technology]]></category>
            <category><![CDATA[tesla]]></category>
            <category><![CDATA[autonomous-cars]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Umer Shehzad]]></dc:creator>
            <pubDate>Sun, 19 Mar 2023 23:18:53 GMT</pubDate>
            <atom:updated>2023-03-19T23:18:53.639Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wished you could sit back and relax on your daily commute, without worrying about traffic or navigation? Are you tired of the stress and hassle of driving in heavy traffic or unfamiliar areas? Well, Autonomous vehicles are making your dreams a reality. With advanced technology and cutting-edge sensors, self-driving cars are becoming more sophisticated right this instance. From lame driver assistance to driverless driving, the world of self-driving cars is rapidly evolving. Let’s explore the exciting changes that lie ahead and how autonomous vehicles will shape the future of transportation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7zKOfLRG0Wbt0os-" /></figure><p><strong>Understanding Autonomous Vehicles: Self-Driving Cars and Their Advanced Technology.</strong></p><p>Autonomous vehicles, AKA self-driving cars, are the latest technological advancement in the automotive industry. These cars are designed to operate without <strong>HUMAN </strong>intervention and use a combination of advanced sensors, cameras, radar, and artificial intelligence (AI) to navigate the road. They are equipped with a range of sophisticated tools, including LIDAR (Light Detection and Ranging), GPS, and computer vision systems, which allow them to detect and interpret their surroundings with great accuracy. The goal of autonomous vehicles is to make driving safer, more efficient, and more convenient for everyone, reducing traffic accidents caused by human error and freeing up valuable time for passengers. This technology has the potential to revolutionize the way we live and work, changing our cities and transportation infrastructure in profound ways.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*cHNULXtqngaJHiZB" /></figure><p><strong>Levels of Autonomous Vehicles:</strong></p><p>Autonomous driving technology is progressing at a rapid pace, with different levels of autonomy being introduced for vehicles. The Society of Automotive Engineers (SAE) has defined six levels of autonomy to describe the extent to which a vehicle can operate without human intervention. In this article, we’ll take a closer look at each level of autonomy and what they mean for the future of driving.</p><p><strong>Level 0 — No Automation:</strong></p><p>This level of autonomy is the most basic and traditional form of driving, where the driver is responsible for all aspects of driving the vehicle. There are no automated features in this level of autonomy, and the driver has complete control of the car at all times.</p><p>Example: A 1967 Porsche 911</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D-1nZpdxAJwndQcQ" /></figure><p><strong>Level 1 — Driver Assistance:</strong></p><p>This level of autonomy involves some automated features, such as adaptive cruise control, lane departure warning, or automatic braking. These features help drivers with some aspects of driving, but the driver is still in control of the vehicle and responsible for all driving tasks.</p><p>Example: 2019 Toyota Camry</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6TkMt_IKf3HNLNOn" /></figure><p>The Camry comes equipped with a suite of advanced driver assistance features, including Dynamic Radar Cruise Control, Lane Departure Alert with Steering Assist, and Automatic High Beams. These features can help make driving easier and safer but do not allow the car to drive on its own. For instance, with Dynamic Radar Cruise Control, the car can maintain a set speed and distance from the car in front, but the driver still needs to control the steering. Similarly, Lane Departure Alert with Steering Assist can detect when the car is drifting out of its lane and gently steer it back into place, but the driver remains responsible for steering. Therefore, the 2019 Toyota Camry is an example of a Level 1 autonomous car as it provides some driver assistance features but still requires the driver to remain in control.</p><p><strong>Level 2 — Partial Automation:</strong></p><p>This level of autonomy involves more advanced driver assistance features, such as lane centring, automatic steering, and acceleration and braking control. The vehicle can take over some driving tasks, but the driver still needs to be alert and ready to take control of the vehicle when needed.</p><p>Example: Tesla’s Autopilot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OrYvHPsC1IuVXJh_" /></figure><p>Yeah, you’ve read it right, Tesla’s autopilot is <strong>ONLY</strong> a level 2 😱😱😱. This has created a worldwide controversial debate on whether Tesla’s autopilot is a level 2 autonomy. It may seem that they have some next-level advanced technology and it is very well-known around the world, people think that it’s a higher level of autonomy. There are a few reasons why some people might think that Tesla Autopilot is a higher level of autonomy than Level 2. One reason is that Tesla’s marketing materials and terminology can be confusing or misleading. For example, Tesla calls its Autopilot system “Full Self-Driving” (FSD), which suggests a higher level of autonomy than what is available. Another reason is that Tesla’s Autopilot system is more advanced than other Level 2 systems on the market. Tesla’s system includes features like automatic lane changing and summoning, which can make it feel like a higher level of autonomy. Additionally, Tesla’s frequent over-the-air software updates can add new features and improvements, further blurring the lines between levels of autonomy. The truth to all of this is that Tesla’s autopilot is still considered a level 2 and let me explain why. First thing first let me explain Tesla’s autopilot in 1 sentence, it’s cruise control on steroids. That’s it. Tesla’s Autopilot system is considered a level 2 autonomous system because while it has many advanced driver assistance features, it still requires the driver to be attentive and ready to take over control at any moment. Autopilot can accelerate, brake, and steer the car within its lane, but it still requires the driver to keep their hands on the steering wheel and be prepared to take control of the car if necessary. In other words, the driver still plays a critical role in operating the car, and the system does not yet provide full autonomy.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FtlThdr3O5Qo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DtlThdr3O5Qo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FtlThdr3O5Qo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/90f1325031c9c071171ccd65bb7afaa7/href">https://medium.com/media/90f1325031c9c071171ccd65bb7afaa7/href</a></iframe><p><strong>Level 3 — Conditional Automation:</strong></p><p>This level of autonomy allows the vehicle to operate autonomously under specific conditions, such as on highways or in traffic jams. The driver can take their hands off the wheel and focus on other tasks, but they still need to be ready to take over the vehicle when required.</p><p>Example: Audi A8</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*UsBGToio8V2J58hR" /></figure><p>The Audi A8 is considered a level 3 autonomous vehicle because it can take over all driving functions under specific conditions. Specifically, the car’s “Traffic Jam Pilot” system allows the car to drive itself in slow-moving traffic situations where speeds are less than 37 mph, as long as certain conditions are met. However, the driver must remain alert and ready to take over the controls when needed, and the system only works on divided highways that have a physical barrier separating the opposing lanes of traffic. Overall, while the A8’s system is advanced, it still requires driver attention and intervention in certain situations, which places it at level 3 on the autonomous driving scale.</p><p>​​</p><p><strong>Level 4 — High Automation:</strong></p><p>This level of autonomy allows the vehicle to operate autonomously in most driving scenarios, but the driver still has the option to take control of the vehicle if necessary. The vehicle can handle all driving tasks, including navigation, traffic, and obstacle detection, without requiring any human intervention.</p><p>Example: Waymo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oU_Cs_-JLQfbimH5" /></figure><p>Waymo’s self-driving technology is considered a Level 4 because it can operate without human intervention in certain conditions and environments. Specifically, Waymo’s vehicles can drive autonomously in designated geographic areas, such as parts of Phoenix, Arizona, without the need for a human driver to take over. However, the vehicles still require a human driver to take over in certain situations, such as when there are unclear or confusing signals on the road. Therefore, it is considered a Level 4 autonomy, which means that the vehicle can operate without human intervention in some situations but still requires a human driver to be present in case of emergency.</p><p><strong>Level 5 — Full Automation:</strong></p><p>This level of autonomy represents the highest level of autonomy, where the vehicle can operate autonomously without any human intervention. The vehicle can handle all driving tasks in any driving scenario, and the driver can sit back and relax, without needing to pay attention to the road.</p><p>It’s important to note that not all autonomous vehicles on the road today are capable of achieving Level 5 autonomy. Most vehicles are still at Level 2 or Level 3, with only a few being capable of Level 4 autonomy. Achieving Level 5 autonomy is a significant technical challenge, and it will require further advancements in technology and infrastructure to achieve.</p><p>Currently, on this planet, there are no cars that are fully autonomous but there are companies like Tesla and Waymo that are trying to accomplish this feat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*v6LAtYxQBR2N06aV.gif" /></figure><p><strong>Components of Autonomous Vehicles:</strong></p><p>As we delve deeper into the world of autonomous vehicles, it’s important to understand the various components and technologies that make self-driving cars possible. From sensors and cameras to advanced algorithms and computer processors, each component plays a crucial role in the overall performance and safety of these vehicles. In this section, we’ll explore some of the key components that are essential for autonomous driving and how they work together to create a seamless and efficient driving experience.</p><p><strong>Lidar: Seeing Beyond the Visible</strong></p><p>Lidar technology is essential to the success of autonomous vehicles. By using lasers to scan the environment, Lidar helps self-driving cars “see” beyond what human eyes can detect. This means they can detect and avoid obstacles, even in low-light or foggy conditions. With Lidar, autonomous cars can create a highly detailed map of their surroundings, which is constantly updated in real time as the vehicle moves.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZkDCt_awpy1lwhvc" /></figure><p><strong>Computer Vision: The Eyes of the Autonomous Car</strong></p><p>Cameras are the eyes of the autonomous car, capturing visual information from the world around it. But it’s not just about capturing images; the car’s computer vision system must also be able to process that information and make decisions based on it. This involves a combination of algorithms and machine learning techniques, allowing the car to recognize and identify objects, pedestrians, and other vehicles. With computer vision, self-driving cars can analyze the scene in real-time and make split-second decisions to avoid collisions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*hszbgZ16qZp_uNx_.jpg" /></figure><p><strong>Radar: The Trusty Backup</strong></p><p>Radar is another key component of autonomous vehicles. While cameras and Lidar are great for detecting objects and obstacles, radar provides a reliable backup system. It can detect objects even in low-visibility conditions, such as heavy rain or snow. It’s also useful for detecting objects obscured by other obstacles, such as a car hidden behind a building. With radar, autonomous cars can better understand their surroundings and make more informed decisions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*wq_hNac59Zh8gA-O" /></figure><p><strong>GPS: The Navigator</strong></p><p>GPS is a crucial component of autonomous vehicles. It allows the car to determine its location and calculate the best route to reach its destination. However, GPS can be unreliable in certain situations, such as when the vehicle is in a tunnel or surrounded by tall buildings. To overcome this, autonomous cars also use other sensors, such as accelerometers and gyroscopes, to determine their location and orientation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0oDtXAm2KrVKNhhZ.jpg" /></figure><p><strong>AI: The Brain Behind the Wheel</strong></p><p>Artificial intelligence is the heart and soul of autonomous vehicles. It’s what allows the car to make decisions and navigate the road. The AI system is responsible for interpreting data from all the car’s sensors and making decisions based on that information. It’s also constantly learning and adapting, using machine learning algorithms to improve its performance over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*qW5G_KaXK9RgXJd8.jpg" /></figure><p>In conclusion, autonomous vehicles are rapidly advancing and are set to revolutionize the way we travel. From their advanced technology and components to the various levels of autonomy, it is clear that self-driving cars have the potential to increase safety, reduce traffic congestion, and provide greater accessibility for individuals with disabilities. While there are still challenges to overcome, such as regulatory hurdles and public perception, the benefits of autonomous vehicles are undeniable. As technology continues to improve and autonomous vehicles become more commonplace, it is exciting to think about what the future of transportation will look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*zxGeA3HxAOQme_aP.jpg" /></figure><p><em>Thanks for reading this article. If you enjoyed it, feel free to add me on </em><a href="http://www.linkedin.com/in/umer-shehzad-112702238"><em>LinkedIn</em></a><em> and follow this page for more articles on autonomous vehicles :)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f3844453203" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object Detection 101 — on Windows]]></title>
            <link>https://medium.com/@umer.shehzad1006/object-detection-101-on-windows-6d5fdc7132c6?source=rss-eceb3131800b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d5fdc7132c6</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[tesla]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[autonomous-vehicles]]></category>
            <category><![CDATA[object-detection]]></category>
            <dc:creator><![CDATA[Umer Shehzad]]></dc:creator>
            <pubDate>Thu, 23 Feb 2023 23:59:29 GMT</pubDate>
            <atom:updated>2023-02-25T16:21:08.758Z</atom:updated>
            <content:encoded><![CDATA[<h3>Object Detection 101 — Windows Edition</h3><p>First thing first, I did this model on Windows instead of Mac just because it is 100x easier on Windows so if you have a Windows, I highly recommend using it. If you have a Mac it is still possible but instead of Anaconda prompt use the terminal.</p><p>Before we start, let me explain what object detection is and what role it has in the autonomous vehicle system. Object detection is the detection of objects and its very important …. 🙃 that’s it, time for the tutorial.</p><p>I’m joking there is way more to it than just that.</p><p>Object detection is a computer vision technique that allows us to identify and locate objects in an image or video. With this kind of identification and localization, object detection can be used to count objects in a scene and determine and track their precise locations, all while accurately labelling them.</p><p>How does object detection work???</p><p>Object detection is a computer vision technique that involves identifying and localizing objects within an image or a video stream. The technique involves using deep learning algorithms and convolutional neural networks (CNNs) to analyze visual data and extract features that can be used to identify specific objects within the image.</p><p>Tesla uses object detection as a critical component of its autonomous driving technology. Tesla’s Autopilot system relies on a variety of sensors, including cameras, radar, and sonar, to detect and interpret the surrounding environment. The system uses object detection algorithms to identify and track objects such as other vehicles, pedestrians, cyclists, and obstacles, which allows the vehicle to make decisions and adjust its trajectory to avoid collisions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QMEXcd4GTkQb18fD.jpeg" /><figcaption>Tesla’s object detection</figcaption></figure><p>Object detection is particularly important in the autonomous vehicle industry because it enables vehicles to perceive their environment and make decisions based on that perception. In addition to Tesla, other companies such as Waymo, Cruise, and Uber are also using object detection in their autonomous driving technology.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*9LpAzdOmHO_eyyXr" /></figure><p>The importance of object detection in autonomous driving cannot be overstated. Without the ability to accurately identify and track objects in real-time, autonomous vehicles would be unable to make informed decisions about how to navigate their environment. Object detection enables vehicles to detect and respond to potential hazards on the road, which is critical for ensuring the safety of passengers and other road users.</p><p>In addition, object detection is a key component of many advanced driver assistance systems (ADAS) that are becoming increasingly common in modern vehicles. These systems use object detection to assist drivers with tasks such as lane departure warnings, adaptive cruise control, and automatic emergency braking, all of which help to prevent accidents and improve road safety.</p><p>Overall, object detection is a critical technology that is driving the development of autonomous vehicles and improving road safety for everyone.</p><h3><strong>Setup:</strong></h3><p>Step 1:Create a new folder on your computer — make sure it isn’t in any other folder like desktop or downloads etc. I named my Object Detection so whatever you name it, remember it as you will need it in your code.</p><p>Step 2: Download Anaconda and place it in the new folder you’ve just created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*nRdOCuIkYeYpPEkGNWjfcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E6xbsVRtd4RgFd6W" /></figure><p>Step 3: Open Anaconda Prompt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GHvDbsugKIFFRu8v" /></figure><p>Step 4: cd “folder name”</p><p>This allows Jupyter to have access to your folder so whenever you download a file or picture or video it can access it easily</p><p>Step 5: Jupyter notebook</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rXtxsA9HQDDL3YU3" /></figure><p>Step 6: Create a new python notebook</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*7tPSZ8nOHw2HXftc_PVQTQ.png" /></figure><p>Step 7: Open the anaconda prompt again this time open as administrator</p><p>Step 8: Install OpenCV</p><pre>pip install opencv-python</pre><p>Step 9:As default none of the dependencies are the latest version so you got to upgrade them yourself for everything to work smoothly on anaconda prompt as an administrator</p><pre>conda update --all</pre><p>Step 10: Import OpenCV and matplotlib, the 2 main dependencies we use in this tutorial.</p><p>Step 11: Files downloads — SSD v3 2020 01 14 is the latest one.</p><p>There are a bunch of pre-trained models from TensorFlow which are going to help us with our model for object detection. The important ones that we need for this are the three links below. <a href="https://github.com/opencv/opencv/wiki/TensorFlow-Object-Detection-API">https://github.com/opencv/opencv/wiki/TensorFlow-Object-Detection-API</a> — weights</p><p>The weights are your deep learning architecture. Extract the file and you are going to find more files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3oWxIG_OoSf1YuRW" /></figure><p>The frozen inference is the one that we want so you are going to copy and paste this graph into our object detection folder.</p><p><a href="https://gist.github.com/dkurt/54a8e8b51beb3bd3f770b79e56927bd7">https://gist.github.com/dkurt/54a8e8b51beb3bd3f770b79e56927bd7</a> -config</p><p>Your configuration is 8399 lines of code that are extremely important and it is done for you so all you have to do is just download the zip and then extract the files and you are going to find the graph for the configuration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bzcdpbCrXUXz1hOz" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iSo0X9FAjgQUmu7u" /></figure><p>Copy and paste this file into our work folder</p><p><a href="https://github.com/pjreddie/darknet/blob/master/data/coco.names">https://github.com/pjreddie/darknet/blob/master/data/coco.names </a>— labels</p><p>These labels are the objects that the model could detect. So you got to create a new text document in your favourite folder and copy and paste the labels onto that document.</p><p>*** Before you write a new line of code you have to run each line of code one by one its a Jupyter. Every single time you are done with writing the code press the play button beside the number. ***</p><p>Step 12: upload those files on Jupyter — line 3 for the weights and config</p><p>Step 13: Create the model so it can detect the objects using cv2.dnn_DetectionModel</p><p>Step 14: Upload the label lists onto Jupyter — line 5 and print them to make sure we have all 80.</p><p>Step 15: Set up the frame sizes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*lmRvu0zP0eEN3T3ZIbZn-A.png" /></figure><p><strong>How to read an image:</strong></p><p>Step 1: Upload an image to the Jupyter system using cv2.Imread. This allows the system to get the image from your folder. You could use any image you want on google. If you want to use the one below just searched for a man with a tuxedo with a car</p><p>Step 2: display your image. To display the image you will need to use plt.imshow(img):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7O2le7s8o6GzKU5QSIlSbw.png" /></figure><p>Step 3: convert bgr image to rgb. As a default way, Jupyter will display your image in a bgr way which makes it look like it was from the 1800s all black and white, so for it to have the colours we see today, we have to convert it and display it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rYZl4jOeUDTqc0Hh11OcdA.png" /></figure><p>Step 4: Time to do the most important part and the fun part which is the actual object detection. To create the boxes and the correct text we need a couple of lines of codes only. The first line (12) is to detect what objects are in the pictures and for us to know if the model detected the objects correctly we print the results. In this case, the number 3 and 1 were printed which means that if we go back to the 80 labels we had in the beginning the 1st one and 3rd one is displayed in the picture(person and car). To create the boxes and the text themselves first we declare our font size and types. Then using cv2.rectangle, we can create boxes that are blue because 255,0,0 = blue. Put the text in the boxes that are the job for cv2. putText. * Using the ClassIndex to find the text and cv2.putText takes the number of the label and converts it to text for us. The text when displayed is green because 0,255,0 = green and the green text matches the blue boxes. Then to place the texts we use cv2.putText(img,classLabels which will place the text of the object from our lists. ClassInd — 1 is important because if you remember from our lists there are 80 labels/objects and when comes to calling the label we have to do -1 because it starts from zero. Then we have the placement of the text, its font type, size, color and thickness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tldVgq1-vpU-rhCXAT73BQ.png" /></figure><p>Step 5: Display the new image with the boxes and text!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A9qjbOHPomGag772kvAQ7A.png" /></figure><p><strong>Video Demo:</strong></p><p>Let me explain step by step how this model can detect objects within a video because let me tell you it’s easy but one mistake could cost you 2 weeks of pure torture. The first thing first is to upload a video on Jupyter with cv2.VideoCapture(“video name”). Here is the link to the video that I’ve used. I know it’s an hour-long video but just screen-record the first 5 minutes and you should be good. Make sure that your screen recording is in the folder where everything else is because that is the first place where Jupyter is going to look. With this line of code, Jupyter is supposed to upload the video to its platform automatically as it did with the other files we used, but there is always something that doesn’t work in life. For some reason, my video isn’t opening when I was running the code. Instead of a video with New York’s traffic, my webcam would open. I’m going to be completely honest, I didn’t know that my webcam was open for a couple of days. I even left my laptop open overnight thinking it was part of the process. I only found out when I minimized my window and saw my face in front of me. Since I had no idea what was wrong I asked one of my best friends his name is Google and Stackoverflow(Best websites when codes don’t work). I spent at least 3 days trying to figure out the solution and every solution that google gave me didn’t work. Then I went to ask a friend at school who knows how Jupyter works pretty well. He told me that maybe my dependencies were not updated to the latest and I should try that out and see if that works. That’s why I said in the beginning to update all the dependencies. So I did that and it still would open my webcam. Then I asked my new friend who is also a genius at ChatGPT to help me out. Let’s just say we also had a long chat get it😂. Yeah so chat told me to check 4 things:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*inF65l2FLki01j85IC12cw.png" /></figure><p>Now 3 out of those 4 I definitely knew were ok. The file was in the correct path, the file wasn’t damaged, and the video file was not in use by another program. The only thing that I thought could’ve been the problem was the file format <strong>needs to be</strong> supported by OpenCV. So I asked Chat what files are supported by OpenCV and it gave a list. That’s why my video is an AVI and not an MP4, but an MP4 would work so try that out before converting it. Even after converting it didn’t work and at this point I was pissed. I took a couple of days off because I couldn’t deal with this 💩. One random day I decided to come back and then I asked on chat how to upload a goddamn video on Jupyter and this is what it said.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qStGmaVchtqsJfnbxGAB2Q.png" /></figure><p>This is the smartest thing that chat has ever said in its life. I went to the home page on Jupyter and I found out that Jupyter DIDN’T UPLOAD THE GOD DAMN VIDEO BY ITSELF🤬🤬🤬🤬🤬🤬🤬🤬🤬!!!!! SO JUPYTER COULD UPLOAD EVERY SINGLE FILE BUT COULDN’T UPLOAD THIS VIDEO. Ok to upload the video manually all you have to do is click upload and find the video and upload it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OQe2Jkit9i6yXoah2IykOw.png" /></figure><p>OK, that was the only hard part of this project, the rest is going to be a breeze. We got a video checker to see if the video works or not. If the video doesn’t open then the webcam will open and that was exactly what happened.</p><p>Then we are going to put everything else in a While statement so it could go on as long as the video is. Then we are going to resize the frame because the frame is too big once you run the code so to see the whole object detection video we need to resize it. Then the rest of the code is the same as the code we did for the picture. Then we are going to display the video with those beautiful boxes and text. To stop the video all you have to do is press q as I wrote a code which is cv2.waitKey(2) &amp; 0xFF == ord(‘q’) then break which stops the video.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7HaJArMDKgI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7HaJArMDKgI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7HaJArMDKgI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1fbbb77cb502bfda851e91540b64fb4d/href">https://medium.com/media/1fbbb77cb502bfda851e91540b64fb4d/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1QDWSrW86MiOTzvI260Kzg.png" /><figcaption>Code for Video Demo</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJTPGZYGMljE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJTPGZYGMljE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJTPGZYGMljE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a838d24e67463afc3bb4698bfecfef01/href">https://medium.com/media/a838d24e67463afc3bb4698bfecfef01/href</a></iframe><p><strong>WEBCAM DEMO:</strong></p><p>So as much as the Webcam was annoying me to death, I still made a code for live object detection using your very own webcam. It is the same code as the video but instead of having cv2.VideoCapture(“video name”) all you need is cv2.VideoCapture(0) which opens the webcam. Then the same code is for the rectangle boxes and texts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6RdwfTTvUjzagWCYD_cKLg.png" /></figure><p>That&#39;s it for the tutorial, I highly recommend you to try it out as its extremely fun and the outcome is AMAZING!!!. If you have any trouble you could ask me or Chat as both of us are willing to help you out.</p><p><em>Thanks for reading this article. If you enjoyed it, feel free to add me on </em><a href="http://www.linkedin.com/in/umer-shehzad-112702238"><em>LinkedIn</em></a><em> and follow this page for more articles on autonomous vehicles :)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d5fdc7132c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Elon Musk and TESLA will NEVER use LiDAR but they should!]]></title>
            <link>https://medium.com/@umer.shehzad1006/why-elon-musk-and-tesla-will-never-use-lidar-or-will-they-5c412a0fbe86?source=rss-eceb3131800b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c412a0fbe86</guid>
            <category><![CDATA[lidar-technology]]></category>
            <category><![CDATA[autonomous-vehicles]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[elon-musk]]></category>
            <category><![CDATA[tesla]]></category>
            <dc:creator><![CDATA[Umer Shehzad]]></dc:creator>
            <pubDate>Wed, 26 Oct 2022 23:42:08 GMT</pubDate>
            <atom:updated>2022-11-04T20:17:50.276Z</atom:updated>
            <content:encoded><![CDATA[<p>Using LiDAR to get one step closer to fully automated vehicles and how Tesla is trying to accomplish the same goal but going different paths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*LQO09XR72unGPSXkZifXnw.png" /></figure><p>LiDAR, radar, and sonar all sound so similar they got to have something in common right????</p><p>That was my first thought when I first heard about LiDAR.🦻</p><p>After a quick google search💻, I found out that LiDAR, radar, and sonar are actually very similar to one another. All 3 of these have the same goal: creating an accurate 3D map of their environments. 🗺</p><p>The difference between the 3 of these is how they create that 3D map. Radar uses radar waves, sonar uses sonar waves and LiDAR uses light.</p><p>Hold up! Hold up! Hold up! I forgot to introduce you guys to LiDAR.</p><p><strong>Li</strong>ght <strong>D</strong>etection <strong>A</strong>nd <strong>R</strong>anging are what LiDAR stands for and it shoots out thousands and thousands of lasers within seconds to create that 3D map of its environment. LiDAR is used to measure the elevation of things such as trees, buildings, cars, people, and nearly anything by shooting out those lasers.</p><p>But wait, aren’t lasers used for other things such as scanning barcodes or even cooler playing laser tag😎.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cUBjdyy9-Wp2hYHXmcsrCg.jpeg" /></figure><p>Now, how exactly does this whole LiDAR system measures those trees and buildings and everything else???</p><p>Well, for LiDAR to work they need to collect data. There are 3 ways to collect the required data.</p><ol><li>From the air</li><li>From the ground</li><li>From outer space</li></ol><p>We are not going to focus deeply on how LiDAR gets its data from the air or outer space, but I would leave a couple of links at the end of the article if anyone is interested.</p><p>On the other hand, let’s dive into how LiDAR works on cars and how there are already a couple of companies using LiDAR to help accomplish autonomous vehicles. Just a reminder, there is no company on this planet that has reached fully autonomous vehicles, but there is a company that is close 👀👀👀.</p><p>First thing first, the way or process that LiDAR uses to create that 3D map of its surroundings is called <strong>Machine Learning.</strong></p><p>The whole Machine Learning is an extremely complicated process, but it is also extremely important.</p><p>Machine Learning is basically a university for robots where they are continuously tested and trying to find a robot that is 99.99999% correct. So what’s happening is for example the system wants to know the difference between cats and dogs. A bunch of robots is then created and sent to the university. At the university, they’re going to show and test the robots on pre-labelled pictures of cats and dogs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YRfDGNcmpL-R05Y9jQ-D-g.png" /><figcaption>Source: CGP Grey</figcaption></figure><p>In the beginning, these robots are really dumb and they truly don’t do good on the tests. Just like a student who first starts university and doesn’t receive those 90s and 100s they received in high school.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*adl1FKXlK8O36RmIIzQFhg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0svy3XL_YEcuZoDt62DCaA.png" /><figcaption>Source: CGP Grey</figcaption></figure><p>But just like in real life, there is always that odd one out who gets a pretty decent mark. Same thing in machine learning, where there is that one robot who magnificently for example gets a 70%. What will happen next is that they take the robot that got the 70% and creates another bunch of robots, but this time they based it on the 70% robot. All the others robots who did worse will be thrown away. R.I.P 😢.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V7SIIVzosrBEGJbYsSG4KA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EfokEZl43-ooR10rOie5Zw.png" /><figcaption>Source: CGP Grey</figcaption></figure><p>Then they do another cat vs dog test and find another robot that did better than 70%. Machine Learning repeats this cycle millions and millions of times and each time they find a better robot. The simple formula of machine learning is more data = more tests = better robots.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jYzMpa9zW7Jwv00n7aBVuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5yTLZOljsJUM9W0mJEYFsQ.png" /><figcaption>Source: CGP Grey</figcaption></figure><p>This cycle continues until they find a robot who becomes an expert at sorting pictures of cats and dogs (even better than a human🤯). Then the company crowns (not literally) that robot and the robot has graduated from the university. Trying to find the robot that receives that 99.99999999% is what companies call chasing the nines. It is not enough to be 99% accurate. It <strong>NEEDS</strong> to be 99.999999% accurate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fw47A8TPbxuT1UJjtBU4ZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WAF05cl_WmE4qWArtKnmUA.png" /><figcaption>Source: CGP Grey</figcaption></figure><p>This process of machine learning is EXACTLY how computers are going to do self-driving. The tests are going to be concentrated on different tiny pieces of driving and just run through the machine learning systems of finding the bot that’s closest to 100% and do that for every piece of driving.</p><p>Now that’s machine learning in a nutshell and it is how LiDAR collects its data in order to make that 3D map of its surrounding.</p><h4>It’s finally time for the FUN PART:</h4><p>Waymo is a software company that creates a self-driving system using LiDAR and attaches the system to a day-to-day car. Waymo has modified the Chrysler Pacifica Hybrid minivans to be autonomous.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZA3xf8L1EIYrHn_8uIvxiQ.png" /></figure><p>YES, you read that right, autonomous, meaning there is <strong>NO</strong> <strong>ONE </strong>driving the car. Cool eh? 😎😎😎.</p><p>Waymo is the company that is closest to accomplishing fully autonomous vehicles, but they are not there yet.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FkDv3dvBEkwk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkDv3dvBEkwk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FkDv3dvBEkwk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a21bfa25976d9d7c9ec5f6356a17405f/href">https://medium.com/media/a21bfa25976d9d7c9ec5f6356a17405f/href</a></iframe><p>The <strong>MAIN </strong>reason that Waymo has a fleet of autonomous vehicles is because of (you guessed it) their one-of-a-kind LiDAR systems.</p><p><strong>FASTEN YOUR SEATBELTS BECAUSE WERE GOING FULL SPEED ON THE BENEFITS OF LiDAR ON AUTONOMOUS VEHICLES.</strong></p><ol><li>One of the best features of LiDAR is able to create an <strong>EXACT</strong> 3D map of its environment. And when I say <strong>EXACT</strong>, I mean a whole 360 degrees map of its environment including the smallest of details. Radars and camera sensors aren’t able to get 360 degrees of vision of their environment and the 3D map is not as detailed as the map created by LiDAR.</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FnXlqv_k4P8Q%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DnXlqv_k4P8Q&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FnXlqv_k4P8Q%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f49e1718defb4fd7373493a188abd90f/href">https://medium.com/media/f49e1718defb4fd7373493a188abd90f/href</a></iframe><p>Since the 3D map is super accurate, it helps with the whole self-driving since the car knows where everything is. Knowing the surroundings will limit the number of accidents caused by autonomous vehicles.</p><p>2. LiDAR is able to work both during the day and during the night.</p><p>These are the only advantages of LiDAR, but it is all about the quality, not the quantity.</p><p><strong>IF LiDAR IS EXCEPTIONAL IN SELF-DRIVING CAR, WHY DOESN’T TESLA USE IT THEN??????</strong></p><p>Well, it’s because Elon Musk hates LiDAR a lot. Like a lot.</p><p>He stated this about LiDAR:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rg_BL7Q4padgycIDuIHh8w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BZnPPTeNgNE_i7fA9Q9uew.jpeg" /></figure><p>Literally, this guy got beef with LiDAR. Like DAWG what did LiDAR do to you😂.</p><p>Elon Musk also stated that he can achieve autonomous vehicles without using LiDAR by 2020</p><p>Cough* cough*, Elon we’re still waiting on that to happen 😁</p><p>There are also other reasons why Elon hates LiDAR and most of the reasons are well…. reasonable.</p><ol><li><strong>It’s EXPENSIVE VERY EXPENSIVE 🤑🤑🤑</strong></li></ol><p>It is going to costs $10,000 extra to add a LiDAR system to Tesla vehicles and I honestly don’t think that Elon wants to increase the price of Tesla because no one will buy it.</p><p><strong>2. FRAGILE EQUIPMENT</strong></p><p>This equipment is extremely FRAGILE The way that LiDAR works, physically is that mirrors are spinning extremely fast which can cause them to wear or tear and break down over time. Trust me if even the smallest piece wear or tears or worse breaks down, the WHOLE LiDAR system is going to stop working.</p><p><strong>Memorize this simple equation: Little damage = no self-driving</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/294/1*bU0_sFjH_jZATMjdRyzQwA.jpeg" /></figure><p><strong>3. NOT NECESSARY (According to Elon)</strong></p><p>The whole Tesla auto-pilot system is made by computer vision which is a type of machine learning where the computer learns how to pick out images</p><p>Elon Musk is betting his entire paycheck on computer vision in order to achieve autonomous vehicles</p><p>A fair point made by Tesla is that the road system is made for human drivers with regular vision. It wasn’t made for lasers to shoot out of our eyes and create that 3D map of the surroundings. We actually create a 3D map of our surroundings, but it’s just with our bare eyes 👀.</p><p>The way that Tesla creates their vehicles is by using reverse engineering. They reverse engineer the human visual system by using machine learning except using 2 cameras (our 2 eyes), they use 8 cameras to help see in all directions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*waa20aniqxxdCqGDXSM_1w.jpeg" /><figcaption>Tesla computer vision</figcaption></figure><p>4. <strong>IT’S UGLY LOL 😂</strong></p><p>This hasn’t been publically spoken about by Elon or any other members of Tesla, but common we all know that Tesla looks cooler than Waymo. Could y’all imagine a Tesla with LiDAR on it because I can’t?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tr-b5PVFX4F4h_wT_P8gtw.jpeg" /><figcaption>LOOK AT THIS BEAUTY 😍😍😍😍😍</figcaption></figure><p>The LiDAR system is tremendously useful in the autonomous vehicles industry and all the benefits have been demonstrated by Waymo, but I don’t see Elon Musk and Tesla using LiDAR in the near future. I’m not here to say who is going to win the race to fully autonomous vehicles between Waymo and Tesla, but I&#39;m here to say that there can be 2 ways that fully autonomous vehicles can be achieved. Both Tesla and Waymo can accomplish this objective in completely different paths which is totally OK!</p><p>Now we got to see who actually accomplish fully autonomous vehicles so grab your popcorn and enjoy the race!!!🍿🍿🍿</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WvvoIqbR1iIOGqQdcNEZfg.png" /></figure><p><em>Thanks for reading this article. If you enjoyed it, feel free to add me on </em><a href="http://www.linkedin.com/in/umer-shehzad-112702238"><em>LinkedIn</em></a><em> and follow this page for more articles on autonomous vehicles :)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c412a0fbe86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GPT-3 The newest, most improved, first class tech in the AI world. Or is it?]]></title>
            <link>https://medium.com/@umer.shehzad1006/gpt-3-the-newest-most-improved-first-class-tech-in-the-ai-world-or-is-it-7d2b82a67455?source=rss-eceb3131800b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d2b82a67455</guid>
            <category><![CDATA[gpt-3]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Umer Shehzad]]></dc:creator>
            <pubDate>Sun, 24 Apr 2022 03:32:13 GMT</pubDate>
            <atom:updated>2022-04-24T03:32:13.114Z</atom:updated>
            <content:encoded><![CDATA[<h3>GPT-3 — The newest, most improved, first class tech in the AI world. Or is it?</h3><figure><img alt="A picture representing AI technology" src="https://cdn-images-1.medium.com/max/1022/1*zeK49xv-a4-l3llvkmVPIA.png" /></figure><p><strong><em>GPT-3, the third generation Generative Pre-trained Transformer.</em></strong></p><p><em>Confused yet? 😕</em></p><p><em>Relax, I got you covered!</em></p><p>GPT-3 is a<strong> </strong><a href="https://www.ibm.com/cloud/learn/neural-networks"><strong>neural network</strong></a><strong> machine learning model </strong>which is trained to use data from the internet to generate ANY, and I mean any type of text. Developed by OpenAI, it requires only a small amount of input.</p><p>So just a few sentences is required to generate a relevant and sophisticated machine-generated text. OpenAI trained GPT-3 to write more than 175 billion parameters (functions), making this the largest language model to exist at the moment. As of the beginning of 2021, GPT-3 is the biggest neural network that has ever been produced. Therefore, GPT-3 is <strong>SUPERIOR</strong> to any previous model that produces text that is convincing enough to seem like a human has written it.</p><p><em>Still lost???</em></p><p>Well, let me explain in english. GPT-3 is taught how millions and millions of people write and it picks up writing patterns based on those people. Think of it like this. You give the ingredients and it will generate a stunning delicious meal.</p><figure><img alt="A gif of the Jetons’ Menulator machine creating a sandwich" src="https://cdn-images-1.medium.com/max/400/0*js6eSBEwNFVJx3m-" /></figure><p>So hold on a second, we are being replaced by robots?!?!?!?!? Well…. Not necessarily being replaced. We just got robots writing digital texts like normal humans, that’s all.</p><p><strong>SO HOW DOES GPT-3 WORK?</strong></p><p>GPT-3 has been taught millions of modern human conversations. It can calculate and make an intelligent and educated guess which word/character would come next in the conversation, based on the other words around it. GPT-3 has the ability to respond wisely to minimal input.</p><p>When a person provides a text input, the system will analyse the language that was given and it will use a text predictor to create the most likely output. Without much additional training, the model will generate a significant high-quality output text that a human would have given.</p><p><strong>For example</strong>, imagine you’ve analyzed thousands of poems and poets. Now, you could simply input the name of a poet, and GPT-3 can create an original poem that is similar to the author’s style. It’ll replicate the texture, rhythm, genre, vocabulary, and style of the poet’s previous works to generate a brand-new poem.</p><p>GPT-3 is also being used in the ever changing gaming world. Today, it helps to create realistic chat dialog, quizzes, and graphics based on suggested texts. GPT-3 can generate a wide variety of other text including memes, recipes and comic strips.</p><p>GPT-3 can really do a lot of pretty fascinating things.</p><p><strong>What are the benefits of GPT-3?</strong></p><p>The most obvious advantage is that GTP-3 can generate such large amounts of text. Being able to calculate a very high educated guess for the output is quite impressive.</p><p>There are many situations in the real world, where it’s not practical or efficient to have a human on hand to generate text output. Imagine a human responding to millions and millions of texts everyday. That person’s hands might turn red with all that typing. So having an automatic text generator that seems like a human would be a total dub. For example, customer service centers can use GPT-3 to answer questions and support chatbots. The company’s sales teams can use it to connect with future customers while marketing teams can create multiple advertising content using GPT-3.</p><figure><img alt="A gif of Kermit the frog frantically typing on a type writer" src="https://cdn-images-1.medium.com/max/500/1*SvhJqJfL3fKppWst7IWRIQ.gif" /></figure><p>With a big benefit like this there would clearly be no downsides of GPT-3, right?</p><p>Well …….</p><p>GPT-3 may seem like the perfect AI-communications solution, but in reality there are a few downsides to this powerful machine learning technology.</p><p><strong>Downsides of GPT-3</strong></p><p>While GPT-3 is incredibly large and powerful, it has several limitations and risks associated with its usage.</p><ul><li><strong>GPT-3 can accidentally create false, sexist, biassed and/or racist content</strong> that wouldn’t have any common sense. The model was programmed based on the language used on the internet. So, it can unfortunately use a lot of the biases that humans do while on the web. The generated pieces of text have become really high quality. Now people are starting to wonder about its usage. We might have created an AI system that’ll be used to create fake news articles.</li><li><strong>Privacy risk:</strong> It’s also unclear whether or not GPT-3 saves any part of the training data. It makes this system a potential privacy issue. This means that your information may not be in safe hands.</li><li><strong>Lack of true intelligence: </strong>GPT-3 is a profound learning AI technology that uses algorithms, but it can’t be considered intelligent. This AI uses text that has already been made to predict future outcomes — it’s not really creating anything truly original. It lacks the capability to truly understand what it’s doing, unlike something like<strong> </strong><a href="https://www.toolbox.com/tech/artificial-intelligence/articles/what-is-general-ai/#:~:text=Artificial%20general%20intelligence%20%28AGI%29%20is%20the%20intelligence%20of,behavior%20to%20solve%20any%20kind%20of%20complex%20problem.">Artificial General Intelligence (AGI)</a>.</li></ul><p><strong>OK that seems quite enough downsides, surely that’s all of it…</strong></p><figure><img alt="A gif of Bugs Bunny saying no" src="https://cdn-images-1.medium.com/max/478/0*EDeylomBuibe9NOA" /></figure><p>The biggest issue with this tech is that GPT-3 is never learning. It’s a pre-programmed tech, which means that it doesn’t learn anything new. Not the recent memes, the abbreviations, not even the SLANG!!!!!.</p><p>Since society keeps on changing, the way humans talk and text will certainly change. To keep GPT-3 current, it’ll need to be updated. How often can GPT-3 really be trained? Probably not a lot. It’ll be hard and definitely tedious to do. Additionally, GPT-3 suffers from the exact same problems as all neural networks do, which is</p><p><em>Drum roll please</em></p><figure><img alt="Gif of sticks hitting a drum to create the drumroll sound" src="https://cdn-images-1.medium.com/max/312/0*RwhQUXgzDBdJdU8L" /></figure><p><strong>Their lack of ability to explain and interpret</strong></p><p>When you input something, whether it is a word or phase, GPT-3 will only give an educated response. That’s it. Nothing after that. Just the answer. What if you don’t understand the answer? What are the reasons behind that output? Where are you going to find all of that information? Not at a local store that I could tell you.</p><p>It’s like having your teacher give the solutions to all the lessons and expecting you to understand it all without any given explanations. I mean c’mon, how are the students going to learn. It’s EXACTLY the same thing with GPT-3.</p><p>GPT-3 also suffers from problems of limited input sizes. A user is not able to provide a lot of text as input for the output. This can limit certain applications that allow GPT-3 to run. GPT-3 can only deal with input text a few sentences long. So if you input a question as long as a paragraph, the AI would go haywire. Honestly just like a human would have done. GPT-3 also suffers from slow conclusion time since it takes a very, very, very, long time for the model to generate the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*jggSrJKKE_cSOA0E" /></figure><p><strong>Impact on society: </strong>GPT-3 is trained to respond to small inputs that are given by the user. Since the AI does all the answers for us, what impact does it have on humans??? Let’s say that we ask GPT-3 to create a poem using a specific style for my English assignment. Instead of using my natural intelligence, I am going to use GPT-3 because I believe it would do a great job writing a poem for me. At the moment this technology is not available to the public so this scenario is, at the moment, impossible to occur. But the point is that if GPT-3 does all the work for us, humans will be over dependent on computers and stop using our brain and effort in life. Technology is getting advanced by the second, and the purpose of those technologies are to make human life easier. Not do the work for us.</p><p><em>Things could not get possibly worse, right?</em></p><p><em>WRONG!</em></p><p>One of the founders of OpenAI called GPT-3 overhyped 😱 😱 😱. <em>Say wHaT nOw?!?!?</em> !Sam Altman tweeted this on twitter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/0*gw8EyBW1LrHhvqfk" /></figure><p>So he does agree that what GPT-3 can do is impressive. But just like humans it has its weaknesses and can make mistakes when outputting the results. He knows himself that GPT-3 is not 100% perfect. Yet he also states that AI is going to change and impact the world and that GPT-3 is only the beginning of what is going to come. Like students hear all the time, there’s always room for improvement.</p><p>This reminds me of something else as well.</p><p>The Los Angeles Lakers.</p><p>Yes I just said a basketball team.</p><p><em>Now you may be wondering what does a basketball team have to do when an AI robot???</em></p><p>Well before the 2021–22 NBA season started, the Lakers traded for Russell Westbrook. After this <strong>BLOCKBUSTER</strong> trade, the entire basketball community thought that the Lakers were overpowered and they are going to win the NBA Championship with no problem. Well, there were tons of problems, starting with their weaknesses. Too many injuries were happening during the season. But even when the team was fully healthy, they were still not as good as people would’ve thought they were. They did not make the playoffs this year with <strong>Lebron</strong>, <strong>AD</strong> and <strong>Westbrook</strong> on the same team. They were overhyped way too much like GPT-3. But there is always room for improvement for the Lakers and for GPT-3.</p><p>We don’t know how GPT-3 will evolve. All we can do is wait and see.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9XYFPyZ286eKtsJjQxrqHg.png" /></figure><p><em>Hello! Thanks for reading this article. If you enjoyed it, feel free to add me on </em><a href="http://www.linkedin.com/in/umer-shehzad-112702238"><em>LinkedIn</em></a><em> and like this page :)</em></p><p><em>— Umer S.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d2b82a67455" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>