Official YOLO v7 COMPLETE Object Detection Tutorial | Windows & Linux

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone and welcome back to the channel yolo v7 just came out and it is backed by a research paper it is the fastest and state of the art object detection model at the time of recording this video yolo v7 has seven variants and we can see that it is 1200 times faster than previous state of the art while also maintaining a higher performance in this video we are going to run pre-trained yolo v7 object detection model on our local machine the code is generic enough to run all seven variants and works for windows and linux alike so let's get started let's start by cloning or downloading this yolo v7 official repository which is made available by wong kinu so all credits to the original author i am going to download it as a zip file and save it in a folder on the desktop here we have this zip file that i'm going to extract we can see a bunch of files and folders that are extracted i'm going to move them to another folder called yolo v7 there we go and just delete this folder we will keep this zip file as a backup for now all right now let's set up the python environment to run yolo v7 i am using anaconda python distribution so i will open up anaconda prompt but if you are using native python installation you can use command prompt on windows or terminal on linux to set up the virtual environment i will move to the folder that we just downloaded and create a virtual environment by command conda create minus n yellow v7 which is the name of the environment and python equals 3.9 i will include the command for native python in the description below type y and hit enter and once the process is complete activate the environment conda activate yellow v7 the base environment is now changed to yolo v7 that we just created now we are going to install the required libraries it's really easy there is a file called requirements.txt and if we open it we can see all the libraries that are required to run yolo v7 we can install all of these by a single command pip install minus r requirements dot txt and hit enter it's going to take some time so i will get back once the process is done all right now if you want to run yolo v7 on cpu you are all set but if you have an nvidia gpu and you want to utilize it we need to do one additional step that is replacement of by torch version let me show you real quick how to do it go to official pi watch website on get started page click on previous spy watch versions go to version 1.11.0 and just copy this pip command with cuda 11.3 then paste it in the terminal and hit enter it's going to take some time to download pi torch with cuda support and it will uninstall cpu based version of pi torch and install pi torch with coda once it is installed let's verify if torch is able to detect cuda open up python import torch then torch dot cuda dot is underscore available and hit enter it returns true which means it will utilize gpu let's exit python and we are all set to run yolo v7 to run object detection on image i have this 0.jpg and for video i have street two dot mp4 these are the same files that we used in our tensorflow object detection video now we need to download yolo v7 model that we want to use there are six models given on the main page of the github repository that you can download directly or you can click on releases and expand assets to see all available models we are interested in the models that are not ending with dot trt or dot on nx or have training in their file names let's download tiny yolo v7 and base yolo v7 from here and save it in the yolo v7 folder on our local machine i'm just going to use these two models for demonstration but you can use any other model that is available in this repository each model has a trade-off in terms of fps and performance and every model is trained on different resolution of the images you need to note this resolution as it will be used later as we are using yolo v7 dot pt so it uses 640 as image size now let's run object detection by command python detect dot pi minus minus weights yolo v7 dot pt that is the file that we just downloaded minus minus conf which is confidence for bounding box 0.4 minus minus img dash size that is 640 as we noted from the repository minus minus source zero dot jpg and hit enter it detects our gpu which is good and the result is stored in runs slash detect slash exp so let's open this result file and it is able to detect person bicycle and backpack successfully the phone is too big we are going to take care of that in a moment now let's run yolo v7 on video it's exactly same command the only difference is that now source is going to be street 2 dot mp4 once it is done we can see the time it took to run object detection which is almost 56 seconds the output video is again stored in runs slash detect in a separate subfolder so everything works as intended now let's run the tiny version of the same video and see how much time it takes so it completes in just 21 seconds and if we go to the output folder and run the video we can see that the detections are not that stable especially this street light we can use the same tiny version of yolo v7 on xero.jpg let's see the result and it fails to detect backpacks so the base yolo v7 model was able to detect both backpacks so it is a trade-off between performance and computational cost you can try any other versions for yourself now if you want to use it on webcams just replace the source with webcam number which in my case is zero and it will start detections on webcam so the font size was too big for the bounding boxes you can change it by opening detect dot pi and change the parameter line underscore thickness from three to maybe one so save this file and let's run the model again [Music] now the bounding boxes and fonts look much nicer so let's also try it on street 2.4 video once again and it looks way better so that's it for this tutorial if you have learned something of value today hit like and subscribe to the channel i will see you next time [Music] [Music]
Info
Channel: TheCodingBug
Views: 45,282
Rating: undefined out of 5
Keywords: yolo v7, yolov7, yolo, yolo object detection, object detection python, object detection, YOLOv7, Official YOLOv7, Object Detection, train yolo in cloud, object detection classifier, deep learning, yolov5, yolov7 tutorial, install yolov7, train yolov7, yolo v7 tutorial, yolo v7 object detection, yolo v7 windows, yolo v7 linux, yolov7 windows, yolov7 linux, yolov7 python, yolo v7 python, yolov7 object detection, yolo7, yolo v7 official, official yolov7, official yolo v7
Id: n2mupnfIuFY
Channel Id: undefined
Length: 8min 25sec (505 seconds)
Published: Fri Jul 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.