Object detection using YOLO v4 and pre trained model | Deep Learning Tutorial 32 (Tensorflow)
Key Takeaways
This video demonstrates object detection using YOLO v4 and pre-trained models with Tensorflow, utilizing the COCO dataset and pre-trained weights for detection.
Full Transcript
in the last video we looked at some theory behind yolo algorithm in this video we will do real object detection using yolo now we'll go over some history behind yellow the different versions version one two three four as of january 2021 there are total five versions of yellow so we'll go over that whole history and then we will use pre-trained weights for doing object detection so we are not taking any custom object image data set and then doing object detection in that instead we are using cocoa data set using pre-trained weights and doing object detection for those cocoa data set labels in future we'll have a separate video on how you can train your own classifier or not not the classifier but the object detector you know and run yolo on the custom data set in 2016 the first version of yolo was invented by joseph redman santos diwala rose gershik and ali farhadi i'm going to provide a link of this research paper in the video description below you can just google it and you can find what they proposed in this particular research paper then in 2017 they came up with yellow version 2 mainly josef and ali for hadi where they improved the speed you you see that they have speeds which supports the rate of 67 frame per second so this algorithm detects the objects at a very very fast rate so if you have a video playing at certain of frame rate it can detect the objects really fast and this could be useful in lesser autonomous cars in 2018 a yolo version 3 was created and again joseph and ellie was the pioneer in in this incremental improvement so they kept on improving the original yolo framework tell version 3 and then at some point joseph redman stopped working on it because of some concern some conflict that he had with his personal values and the use of this in military in 2020 yolo version 4 was created now the reason i have this in different color was because joseph redwater redmond was not part of it alexei boko waski created a fork of uh his github repository and he created this separate uh branch of this version 4 algorithm now nowadays there is yolo version 5 as well but there is some controversy going on with it so i'm not going to cover that we will be doing coding using yolo version 4. you need to go to google and search for yolo v4 github lxcab and you will find a repository by alex ab that has yolo v4 core and this is the repo name is dark knight it is four prom pj ready so this this one is if you look at this repository this is the original repository by joe redman and he stopped development of yolo after version three so then alex cab forked his repository and he built this yolo version for now yolo is not available as like you can't do like paper install your something like that you have to get clone this repository and follow certain steps in order to use it now once you are on this repository you will find this particular section where it says how to compile this on windows if you are on linux there are instruction on doing this linux so this was built originally for linux so building this on linux is straightforward on windows you have to follow certain steps it's not very very straightforward so first what you need to do is git clone this vc package and vc package is needed to compile the dark net project so what i have done is here open a powershell so when you open a powershell windows powershot click on this and you get this windows command prompt this is like powershell is a new version of old windows command prompt and here i made a temporary directory okay so if i do cd tmp and see this is an empty directory which i made so now i need to do git clone and you can copy and if you mouse right click it will copy that so this will copy the vc package microsoft project once it is copied see you're just doing copy paste so you go to that directory you set some environment variable this is just setting some windows environment variable and then you are compiling your bootstrapping that vc package will might take time okay so after a few seconds this step is done now i'm just see this will install the whole darknet version i want to install only the one for x64 windows so this will save you a lot of time if you try to install the whole version it will take hours and hours so here uh i think i did not copy the whole thing so okay so what you need to do is this install darknet opencv cnn okay so now again it will take some time for this tip to finish so it is installing the cu dn and all these dependencies i forgot to mention one thing is before you do all these steps you need to perform these three steps where you need to install either visual studio 2017 or 2019 the community edition okay community edition is free so that is microsoft ide and we need that for compilation process you might be wondering why are we installing visual studio well it is needed for the compilation process so install that then you install cuda kuda is nvidia's library for gpu and machine learning so install that make sure you enable vs integration okay so cuda is not really machine learning it is gpu library you know it allows you to access gpu for faster computation but when you're installing that make sure you are doing vs integration so see when you do cuda installation so basically when you do put installation just go to custom step and make sure you install everything they will have express tab but don't use express tab go to custom and install everything including vs integration when i was following these steps i was facing horrible issues with coda because i had cuda 11 point some 11.0 or 11.1 and it was giving me a lot of trouble because it was not compatible with the rest of the software i have on my machine so i had to install cuda 10.2 okay so if you are facing any errors at any step let's say at this step when you're compiling darknet if you face the error make sure that you look at the error properly if it is saying that the error is in this particular file path open that file and try to see the error most likely it might be incompatible cuda version so try to resolve that again following these steps it might be easier or it might not be easier based on what kind of system software you have so you have to have a patience look at errors carefully do google search and try to install the things which are needed this still downloading looks like this is slow now that step is done without any errors so we are ready to move on to the next step which is go out of this directory so you'll see that right now this so c code damn directory so if you see code temp this has only vc package so see this is vc package now you're coming out and you're doing git clone the dark net repository so once you do git clone you will have that particular directory here so if you do dir see you have now darknet repository here and then you do 3d darknet and then now this command doesn't quite work well like we can try it so see some authorization issue it is giving so we will be running a different command which i have given in the video description below so this is the command that will run again it's available in the video description below so check it out so now this is building the dark net repository and it will take some time for it to build it took me long time around 40 minutes for this to finish so make sure you have enough patience this process the compilation of darknet is going to take long time now when i look at my tmp directory here in the dark net folder i will see a thing called darknet.exe using this you can do object detection and also here there are a couple of files for example there will be this image yellow v4 dot asset so if you open that here this has a command to detect the uh objects basically so if you look at data directory here data directory dog.jpg so see there is this image where there is dock bicycle car and so on and we want to do object detection on that so it draws the boundaries around this so when you do this command here just copy paste this command okay so this will run the detection and now see here it says the yolo v4 dot weights couldn't find so we missed one step which was to download yellow weights from this particular folder so let's go back to the directory here and if you do yolo dot yolo for or just do weights see use this link when you use this link you will be able to download those weights so when i do this see it is downloading this now so i copied that file into darknet directory so yolo v4 waits that you just downloaded copy it in this dark net directory and then run the same command again see now it detected those objects you see that so there's a truck there is a bicycle this these are like scores you know 0.96 percent this is matching with a dog bicycle truck so you can see that when you have driverless car type of application this kind of object detection can be really useful i have one more image where i'm trying to break my computer okay so let's detect objects in this particular image so the name of the image is laptop.jpg you can put any of your image so here i will just say laptop dot jpg see it is detecting some of the images right but for this hammer it is saying toothbrush the reason is that the cocoa data set probably doesn't have this hammer as a label or maybe or maybe it did not detect it fine so let's look at our cocoa data set labels so in the previous video i talked about different data sets such as cocoa image net so what that video if you don't know what coco data set is but it's an image data set which with all the annotations pixel segmentation and so on and this uh and the weights that we will be downloaded where train on that cocoa data set and if you look at this website this has all the labels of cocoa data set so the link of this website is in the video description below you can see that it has around let's see around 91 labels and like 91 classes which it can detect so whatever output you get will be one of these classes and this probably doesn't have a hammer so you know but it has toothbrush so it is trying to do detect toothbrush so any image you take which has any of these objects uh it will do the object detection all right so this was on the coco data set if you want to train yolo on your own images there are instructions here we are not going to go into those details in today's video maybe in future we'll cover that but just follow these instructions uh to train your own custom object detection model uh in the future video i want to cover a recurrent neural network and that's the reason uh we don't want to spend too much time in these videos so we will be starting a recurrent neural network and nlp tutorials pretty soon i hope you like this video if you do please give it a thumbs up check video description it has all the necessary information and the links that you need thank you
Original Description
In this video we will use YOLO V4 and use pretrained weights to detect object boundaries in an image. The model was trained on COCO dataset using YOLO V4.
Watch this to understand how yolo algorithm works: https://www.youtube.com/watch?v=ag3DLKsl2vk
Windows setup instructions: https://github.com/AlexeyAB/darknet#how-to-compile-on-windows-using-cmake
Above, I was getting errors when I used .\build.ps1 command but using following command instead worked:
powershell -ExecutionPolicy Bypass -File .\build.ps1
Make sure you are installing a compatible version of CUDA. For me it was CUDA 10.1, when I installed 11.x version I was getting all kind of errors so had to downgrade it to 10.1 Based on your system you might have to use a different version
download yolov4.weights from https://github.com/AlexeyAB/darknet#how-to-evaluate-ap-of-yolov4-on-the-ms-coco-evaluation-server
COCO labels:
https://tech.amikelive.com/node-718/what-object-categories-labels-are-in-coco-dataset/
YOLO research papers
YOLO v1: https://arxiv.org/abs/1506.02640
YOLO v2: https://arxiv.org/abs/1612.08242
YOLO v3: https://arxiv.org/abs/1804.02767
Do you want to learn technology from me? Check https://codebasics.io/?utm_source=description&utm_medium=yt&utm_campaign=description&utm_id=description for my affordable video courses.
#objectdetectionusingyolo #yoloobjectdetection #yolov4objectdetection #yoloalgorithm #yolov4 #yolodeeplearning
🌎 My Website For Video Courses: https://codebasics.io/?utm_source=description&utm_medium=yt&utm_campaign=description&utm_id=description
Need help building software or data analytics and AI solutions? My company https://www.atliq.com/ can help. Click on the Contact button on that website.
#️⃣ Social Media #️⃣
🔗 Discord: https://discord.gg/r42Kbuk
📸 Dhaval's Personal Instagram: https://www.instagram.com/dhavalsays/
📸 Instagram: https://www.instagram.com/codebasicshub/
🔊 Facebook: https://www.facebook.com/codebasicshub
📱 Twitter: https://twitter.com/codebas
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from codebasics · codebasics · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Python Tutorial - 1. Install python on windows
codebasics
Python Tutorial - 2. Variables
codebasics
Python Tutorial - 3. Numbers
codebasics
Python Tutorial - 4. Strings
codebasics
Python Tutorial - 5. Lists
codebasics
Python Tutorial - 6. Install PyCharm on Windows
codebasics
PyCharm Tutorial - 7. Debug python code using PyCharm
codebasics
Python Tutorial - 8. If Statement
codebasics
Python Tutorial - 9. For loop
codebasics
Python Tutorial - 10. Functions
codebasics
Python Tutorial - 11. Dictionaries and Tuples
codebasics
Python Tutorial - 12. Modules
codebasics
Python Tutorial - 13. Reading/Writing Files
codebasics
How to install Julia on Windows
codebasics
Python Tutorial - 14. Working With JSON
codebasics
Julia Tutorial - 1. Variables
codebasics
Julia Tutorial - 2. Numbers
codebasics
Python Tutorial - 15. if __name__ == "__main__"
codebasics
Julia Tutorial - Why Should I Learn Julia Programming Language
codebasics
Python Tutorial - 16. Exception Handling
codebasics
Julia Tutorial - 3. Complex and Rational Numbers
codebasics
Julia Tutorial - 4. Strings
codebasics
Python Tutorial - 17. Class and Objects
codebasics
Julia Tutorial - 5. Functions
codebasics
Julia Tutorial - 6. If Statement and Ternary Operator
codebasics
Julia Tutorial - 7. For While Loop
codebasics
Python Tutorial - 18. Inheritance
codebasics
Julia Tutorial - 8. begin and (;) Compound Expressions
codebasics
Python Tutorial - 12.1 - Install Python Module (using pip)
codebasics
Julia Tutorial - 9. Tasks (a.k.a. Generators or Coroutines)
codebasics
Julia Tutorial - 10. Exception Handling
codebasics
Python Tutorial - 19. Multiple Inheritance
codebasics
Python Tutorial - 20. Raise Exception And Finally
codebasics
Python Tutorial - 21. Iterators
codebasics
Python Tutorial - 22. Generators
codebasics
Python Tutorial - 23. List Set Dict Comprehensions
codebasics
Python Tutorial - 24. Sets and Frozen Sets
codebasics
Python Tutorial - 25. Command line argument processing using argparse
codebasics
Debugging Tips - What is bug and debugging?
codebasics
Debugging Tips - Conditional Breakpoint
codebasics
Debugging Tips - Watches and Call Stack
codebasics
Python Tutorial - 26. Multithreading - Introduction
codebasics
Git Tutorial 3: How To Install Git
codebasics
Git Tutorial 1: What is git / What is version control system?
codebasics
Git Tutorial 2 : What is Github? | github tutorial
codebasics
Git Tutorial 4: Basic Commands: add, commit, push
codebasics
Git Tutorial 5: Undoing/Reverting/Resetting code changes
codebasics
Git Tutorial 6: Branches (Create, Merge, Delete a branch)
codebasics
Git Github Tutorial 10: What is Pull Request?
codebasics
Git Tutorial 7: What is HEAD?
codebasics
Git Tutorial 9: Diff and Merge using meld
codebasics
Difference between Multiprocessing and Multithreading
codebasics
Python Tutorial - 27. Multiprocessing Introduction
codebasics
Python Tutorial - 28. Sharing Data Between Processes Using Array and Value
codebasics
Git Tutorial 8 - .gitignore file
codebasics
Python Tutorial - 29. Sharing Data Between Processes Using Multiprocessing Queue
codebasics
Python Tutorial - 30. Multiprocessing Lock
codebasics
Python Tutorial - 31. Multiprocessing Pool (Map Reduce)
codebasics
What is code?
codebasics
Python unit testing - pytest introduction
codebasics
More on: CV Basics
View skill →Related Reads
📰
📰
📰
📰
What Is YOLOv8? An Introduction to the YOLOv8 Model Family
Medium · AI
What Is YOLOv8? An Introduction to the YOLOv8 Model Family
Medium · Data Science
Mistral's 8B Robostral Navigate outperforms multi-sensor robots
Dev.to · ironbyte-rgb
How Computer Vision Allows Machines to See the World
Medium · Machine Learning
🎓
Tutor Explanation
DeepCamp AI