<?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 Zayn Wassie on Medium]]></title>
        <description><![CDATA[Stories by Zayn Wassie on Medium]]></description>
        <link>https://medium.com/@zeynualkadir?source=rss-7ae0e27fea12------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eilwOlu12alZRIwk786oDQ@2x.jpeg</url>
            <title>Stories by Zayn Wassie on Medium</title>
            <link>https://medium.com/@zeynualkadir?source=rss-7ae0e27fea12------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 03:09:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zeynualkadir/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[AUTOMATIC LICENSE PLATE RECOGNITION FOR ETHIOPIAN ROADS USING YOLO]]></title>
            <link>https://medium.com/@zeynualkadir/automatic-license-plate-recognition-for-ethiopian-roads-using-yolo-14d9f4ada353?source=rss-7ae0e27fea12------2</link>
            <guid isPermaLink="false">https://medium.com/p/14d9f4ada353</guid>
            <category><![CDATA[numberplatedetection]]></category>
            <category><![CDATA[ethiopian-license-plate]]></category>
            <category><![CDATA[yolov3]]></category>
            <category><![CDATA[license-plate-recognition]]></category>
            <category><![CDATA[yolov4]]></category>
            <dc:creator><![CDATA[Zayn Wassie]]></dc:creator>
            <pubDate>Sun, 20 Nov 2022 15:40:53 GMT</pubDate>
            <atom:updated>2024-07-13T22:14:26.740Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*MMNIufu-QOIu5VdbqlBLrg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*DumN09zFh7tii7D1t75AuQ.jpeg" /><figcaption>Ethiopian Car images with license plate detection</figcaption></figure><h3><strong>Introduction</strong></h3><p>In the event that a traffic issue arises, it has grown more and more difficult to monitor these cars and practically impossible to determine who the owners are. This has caused significant traffic jams and other issues. On a daily basis, several incidents of kidnapping, smuggling, robbery, and on-road accidents are reported. By utilizing the technology known as smart transport system, these incidents may be reduced, and the overall issue can be controlled. Automatic number plate recognition is a process that automatically extracts and identifies the letters on license plates of moving vehicles from an image.</p><p>multiple academics have studied ALPNR, and numerous methods have been proposed, the ALPNR problem has not yet been resolved because of innumerable issues with image processing, including changes in perspective, illumination, occlusion, scaling, and intra-class variance. Additionally, each nation has its own requirements for license plates such as plate dimensions, material, usage of alphabetic letters, the language of the characters, etc. Because of this variety and This type of system is in its early stages in Ethiopia; developing this type of system can assist a human operator and increase the overall quality of service. To do so a study of Ethiopian license plates is required. We conducted several studies to apply <strong>ALPNR</strong> on Ethiopian license plate numbers. I write these articles to help other students and other scholars who want to research more on ALPNR in Ethiopian license plates.</p><p>This article will cover the use case of detecting and recognizing the License Plates of Ethiopian Cars using yolo v3 and yolo v4.</p><p>Google Colab is used for model training. You can know more about Google Colab from <a href="https://www.tutorialspoint.com/google_colab/what_is_google_colab.htm">here</a>.</p><p>we use yolo v3 and yolo v4 for training our model</p><p>YOLO is one of the most popular and a state-of-the-art object detector, you can find more about yolov3 and yolov4 <a href="https://github.com/AlexeyAB/darknet">here</a>.</p><p>To train our model we compare two yolo versions such as yolo v3 and yolo v4 Training the object detector for my own dataset was a challenging task, and through this article I hope to make it easier for others who want to do the same.</p><p><strong>Step 1: Prepare the dataset</strong></p><p>A, after obtaining the necessary datasets, which include the majority of License plate kinds with the number plate, taking pictures of Ethiopian license plates in Addis Street where most cars are parked such as Enkulale Fabricka and 4 Kilo areas. Create two folders called “test” and “train,” and move 20% of the images into test and 80% of the images into train, accordingly.</p><p>Alternately, you can use the test and training data that I used. The test and train folders with annotation files can be accessed by visiting my <a href="https://github.com/ZaynAlk">GitHub Repository</a>.</p><p>B, Using <a href="https://github.com/heartexlabs/labelImg/releases">LabelImg</a> and <a href="https://www.cloudfactory.com/data-labeling-guide">make sense</a> online tool annotate the license plates for detection and recognition on each image in the corresponding test and training folders and create the annotated.xml file for the images contained inside. you may learn more about LabelImg <a href="https://www.edge-ai-vision.com/2022/04/exploring-data-labeling-and-the-6-different-types-of-image-annotation/#:~:text=YOLO%3A%20In%20the%20YOLO%20labeling,coordinates%2C%20height%2C%20and%20width.">here</a>.</p><p>It’s important to note that LabelImg enables you to create annotations in two different formats. PascalVOC format for the first one (.xml), yolo(.txt) format for the second.</p><p>A particular.txt file with labeled bounding box information is required by YOLO. Therefore, you have two options: create YOLO compatible.txt files from LabelImg or create.xml files compatible with PascalVOC and convert them to YOLO compatible format afterwards, however I recommend make sense tool due to high flexibility and easy to use <a href="https://www.makesense.ai/">Make Sense</a></p><p><strong>Step 2: Installing the base darknet system</strong></p><p>Mount the Google Drive</p><pre>from google.colab import drive<br>drive.mount(&#39;/content/gdrive&#39;)%cd /content/gdrive/MyDrive</pre><p>Download YOLOv3 and YOLOv4project</p><pre>! !wget https://github.com/AlexeyAB/darknet</pre><p>Open darknet/Makefile and put 1 in front of GPU, CUDNN, and OPENCV instead of 0. These changes are required if you wanted to use GPU on google colab.</p><pre>GPU=1<br>CUDNN=1<br>CUDNN_HALF=0<br>OPENCV=1</pre><p>Install the base darknet framework with the below commands.</p><pre>%cd darknet<br>! make</pre><p><strong>Step 3: Upload images in Google Colab and generate YOLO compatible annotation files</strong></p><p>Unzip test.zip and train.zip files from my <a href="https://github.com/ZaynAlk">GitHub repository</a> and upload them in the darknet directory or manually upload your annotated images in the test and train folder within the darknet directory along with the convert.py file.</p><p>You can use the below code if you have .xml file and to Convert the bounding box coordinates from the .xml file to the .txt file (YOLO compatible format).</p><pre>! python convert.py</pre><p>In the same test and train directories, this step will take the coordinates from each.xml file and place them in a.txt file that is compatible with YOLO. Additionally, files called train.txt and test.txt are created in the darknet subdirectory and contain the locations of the images.</p><p>But if you have already a.txt file like I used already you can skip this.</p><p><strong>Step 4: Prepare custom ‘my_data’ folder</strong></p><p>Run the below command to make a custom folder named ‘my_data’</p><pre>! mkdir my_data</pre><p>Move the train.txt and test.txt files from the darknet directory to the my_data directory.</p><pre>! mv train.txt my_data/<br>! mv test.txt my_data/</pre><p>Create classes.names file within my_data directory with class name as “LP”.</p><pre>! touch /content/gdrive/MyDrive/darknet/my_data/classes.names! echo LP &gt;<br> /content/gdrive/MyDrive/darknet/my_data/classes.names</pre><p>Create weights directory within the my_data directory.</p><pre>! mkdir my_data/weights</pre><p>Create file darknet.data within my_data directory to provide the configuration details.</p><pre>! touch /content/gdrive/MyDrive/darknet/my_data/darknet.data</pre><p>Paste the below details in darknet.data file.</p><ul><li>classes = 1</li><li>train = my_data/train.txt</li><li>valid = my_data/test.txt</li><li>names = my_data/classes.names</li><li>backup = my_data/weights/</li></ul><p>Copy and paste the cfg file from darknet/cfg/yolov3.cfg to darknet/my_data directory.</p><pre>! cp /content/gdrive/MyDrive/darknet/cfg/yolov3.cfg /content/gdrive/MyDrive/darknet/my_data</pre><p><strong>Note: for plate recognition the classes should be change to 62 since we use 62 classes for plate recognition</strong></p><p>Make the following changes in yolov3.cfg and yolov4.cfg in my_data directory.</p><p>For plate detection</p><ul><li>Line 603, 693, and 780 change the filters to 18. (filters = (classes + 5) * 3). In our case we are detecting only 1 class, so the number of filters will be equal to 18.</li><li>Line 783, change the number of classes to 1</li></ul><p>For plate recognition</p><ul><li>Line 603, 693, and 780 change the filters to 201. (filters = (classes + 5) * 3). In our case we are detecting 32 characters so our class will be 32, so the number of filters will be equal to 201.</li><li>Line 783, change the number of classes to 62</li></ul><p><strong>Step 5: Download the initial yolo weights for training the custom data</strong></p><p>Run the following command from the darknet directory.</p><p>For YOLOv3</p><pre>! wget https://pjreddie.com/media/files/darknet53.conv.74</pre><p>For YOLOv4</p><pre>!wget https://pjreddie.com/media/files/yolov4.conv.137</pre><p><strong>Step 6: Set criteria to save the weights file in the weights directory</strong></p><p>Change line number 138 as indicated below by opening the detector.c file in the darknet/examples directory.</p><pre>if(i%1000==0 || (i &lt; 1000 &amp;&amp; i%200 == 0))</pre><p>This modification stores the weight for every 200nd iteration up to 1000 iterations, and then for every 1000th iteration, in my_data/weights directory.</p><p><strong>Step 7: Now start the training</strong></p><p>Run the following command from the darknet directory.</p><p>This is for YOLOv3</p><pre>!./darknet detector train data/obj.data cfg/yolov3_training.cfg darknet53.conv.74 -dont_show -map</pre><p>This is for YOLOv4</p><pre>!./darknet detector train data/obj.data cfg/yolov4_training.cfg yolov4.conv.137 -dont_show -map</pre><p>Note: In case you get “/bin/bash: ./darknet: Permission denied” error then run the below command and then run the above command.</p><pre>! chmod +x darknet</pre><p>Note: Due to limitations in Google Colab, you might not be able to train the model all at once. Verify the most recent weight in my data/weights folder before retraining the model with the new weights. Run the command below to retrain the model with fresh weights, for instance, if your weights folder contains the file yolov3 8000.weights.</p><pre>!./darknet detector train data/obj.data cfg/yolov4_training.cfg /content<br>/gdrive/MyDrive/yolov3/yolov4_training_last.weights -dont_show -map</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*sgR49TirlFemHhAqQxTiMw.jpeg" /><figcaption>start of model training</figcaption></figure><p>The output of the model is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*XzGj1speWgTluRKD50655w.jpeg" /><figcaption>model training output</figcaption></figure><p><strong>Step 8: Detect and recognize the License Plate from the image</strong></p><p>By running the below codes, we can test the training weights to detect Ethiopian license plates</p><pre>import cv2<br>import matplotlib.pyplot as plt<br>%matplotlib inline<br>def imShow(path):<br>image = cv2.imread(path)<br>height, width = image.shape[:2]<br>resized_image = cv2.resize(image,(3*width, 3*height), interpolation = cv2.INTER_CUBIC)<br>fig = plt.gcf()<br>fig.set_size_inches(18, 10)<br>plt.axis(&quot;off&quot;)<br>plt.imshow(cv2.cvtColor(resized_image, cv2.COLOR_BGR2RGB))<br>plt.show()<br></pre><p>After running the above code then run the below code to detect and see the detected license plate</p><pre>!./darknet detector test data/obj.data cfg/yolov3_training.cfg data<br>/yolov3_training_last.weights data/iphone3.jpg<br>imShow(&#39;predictions.jpg&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*Xa7tv7pyGalE9yqrBRNcrg.jpeg" /><figcaption>The model detects Ethiopian license plate successfully</figcaption></figure><p>to recognize the characters on the license plate you can use the below code or go to the GitHub file and follow the steps to get more understanding how the recognition works.</p><pre>!./darknet detector test data/obj.data cfg/yolov4_training.cfg data/yolov4_training_last.weights recog31.jpg </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*ku5C9Z62xwIAAIfcNGsehw.jpeg" /><figcaption>The model recognized Ethiopian license plate characters successfully</figcaption></figure><p><strong>Step 9: Evaluating performance</strong></p><p>To evaluate the model’s performance over the test set, run either of the following commands:</p><p>For YOLOv3</p><pre>!./darknet detector map data/obj.data cfg/yolov3_training.cfg data<br>/yolov3_training_last.weights</pre><p>For YOLOv4</p><pre>!./darknet detector map data/obj.data cfg/yolov4_training.cfg data<br>/yolov4_training_last.weights</pre><p>To test the LP detector’s performance, we applied standard object detection metrics such as precision, recall, F1-score, average precision and mAP, Edit distance (Levenstein distance)</p><ul><li><strong>For plate detection: </strong>YOLOv4 has a better mAP and F1 score than YOLOv3 this shows that it can detect objects more reliably than yolov3 algorithms in our custom dataset, and We can also show in this experiment that YOLOv4 is extremely faster than YOLOv3.</li><li><strong>For character recognition:</strong> The license plate recognition detector recognizes 62 classes, including the digits 0 to 9, the English alphabet, and 36 Ethiopian characters. And the final result shows that it achieves better mAP, F1 on yolov4. However due to not included some of the regional license plates datasets, like those from the Tigray and Amhara regions because of geographical location. This affects the accuracy of the recognition model.</li><li>The final result achieved high accuracy on YOLOV4, which is 85 percent for plate detection and 80 percent for character recognition.</li></ul><p><strong>Conclusion</strong></p><p>We trained the reliable end-to-end real-time ANPR system using the YOLO approach. we have prepared a mass dataset for vehicle ANPR that includes over 1200 Ethiopian license plates with fully annotated images. In order to imitate number plates, we used a data augmentation approach, which increases the number of characters even when there aren’t many images available in the training set.</p><p>We chose YOLOv3 and YOLOv4 because of their high detection speed and accuracy in real-time applications, and we compared their accuracy and speed to see which algorithm performs the best for license plate detection and recognition. Based on the result we get the proposed approach successfully detect the license plate and recognize Ethiopian license plate characters (Amharic characters) our system tested on real-time video.</p><p>we choose the algorithm with the highest accuracy, and that is YOLOv4. Hence, we can confirm the feasibility of using YOLOv4 to detect and recognizing with sufficient speed and accuracy. We conclude that the YOLOv4 algorithm is the best option among the two algorithms that can help with detecting and recognizing Ethiopian license plate in real-time.</p><p>I want to write this article because of to help others for further research in detecting and recognizing Ethiopian characters using yolo because of the time when I did the research there wasn’t enough datasets and research in Ethiopian license plate detection and recognition. I hope this article helps and gives a motivation to do another research and increase the state of the art in license plate recognition in case of Ethiopian license plates.</p><p>You can get all the codes for license plate detection and recognition of Ethiopian license plates and all datasets on my <a href="https://github.com/ZaynAlk">GitHub repository</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14d9f4ada353" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>