Another post starts with you beautiful people!
Last year I had shared a post about installing and compiling Darknet YOLOv3 in your Windows machine and also how to detect an object using YOLOv3 with Keras. This year on April' 2020 the fourth generation of YOLO has arrived and since then I was curious to use this as soon as possible. Due to my project (built on YOLOv3 :)) work I could not find a chance to check this latest release. Today I got some relief and successfully able to install and compile YOLOv4 in my machine. In this post I am going to share a single shot way to do the same in your Windows 10 machine. If your machine does not have GPU then you can follow my previous post by just replacing YOLOv3 related files with YOLOv4 files. For GPU having Windows machine, follow my steps to avoid any issue while building the Darknet repository.
My machine has following configurations:
Windows 10 64 bit Intel Core i7
16 GB RAM
NVIDIA GeForce GTX 1660 Ti Version 445.87
CUDA 10.1, cuDNN 7.6
Visual Studio 2017
Before proceeding please make sure that you have installed CUDA, cuDNN as per your GPU drivers and Visual Studio 2017 is installed with C++ distributions. An invalid CUDA/cuDNN version will show unnecessary errors while installing. Once you check and assure all setup is up to date; disable your antivirus settings till the end of this process. For building the Darknet code I am here using Vcpkg instead of Darknet repo's build.ps1 file since with this build.ps1 file I was not able to build the code with GPU settings. Let's start the process-
1. Download Vcpkg from this link. It is a C++ library manager and will be used to install and compile the Darknet code.
2. Open Windows PowerShell with admin rights and go to the root directory of the Vcpkg folder you have downloaded from step 1 and run following two commands one by one:
- .\bootstrap-vcpkg.bat
- .\vcpkg integrate install
Please note if you are using Windows PowerShell first time, run Set-ExecutionPolicy RemoteSigned and press A when asked and then press Enter.3. Next, run following command: .\vcpkg install darknet[full]:x64-windows
Above command will download the opencv with cuda, other required libraries and Darknet code. After downloading it will install the all libraries and then it will compile the Darknet code with GPU enable settings automatically. This process will take some time so have patience and wait to complete. Once this process is completed, you will see logs in your PowerShell and some green lines with done status. Make sure all green lines have done status. Once you see done status in all it means Darknet code is successfully compiled with GPU enable settings in your Windows machine. You can check it by going into the darknet directory: <Your_System_dir>\vcpkg-master\installed\x64-windows\tools\darknet
4. Download the yolov4.weights file from this link and put it into the darknet directory
5. Download a sample mp4 video file and put into the same darknet directory
6. In the same PowerShell window go to the path of your darknet directory and run the following command-
.\darknet.exe detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights Car_Racing.mp4 -dont_show -out_filename carRacing_result.mp4
Once you run the above command, in the starting of the running command you will see following like line-
You can see my CUDA, cuDNN and GPU count are showing in the console which confirms that my GPU is used while using the pre-trained YOLOv4 weights on a sample video file. Once this run is completed you can go to your darknet directory and found a output file carRacing_result.mp4 or your sample video output file. Open that file in a media player and you will see bounding boxes around the detected object names like person, car, truck on them. Inspite of fast moving objects in my video file, YOLOv4 is able to detect objects accurate. You can see my output video from this link . In my machine the average FPS with GPU was 6.7 for this video and with CPU it was 0.4. True power of using a real time object detector like YOLO is with GPU only :)
You can also test the detector with an image by running the same command but replacing video file with image file like below-
.\darknet.exe detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights <IMAGE_FiLE> -dont_show -out_filename
Once you open the saved image (predictions.jpg), the image will show the detection result as below-
You can see pre-trained weights of YOLOv4 is able to detect person, cup, spoon, wine glass, fork, bowl, chair, backpack and knife in the above picture.
That's it for today. With this installation we have a real time object detector. Using it's pre-trained weights only we are able to detect many objects. I am using 2 custom YOLOv3 based models in my project and both are successfully running in production. Soon I will replace both models with the 4th generation YOLO. In my next post I will share you how I prepared my custom objects and trained them with YOLOv4. Till then Go chase your dreams, have an awesome day, make every second count and see you later in my next post.
Thanks very much for this guide, it worked for me. For people who are going to use this guide: be sure to have the english language package installed in Visual Studio, otherwise it does not completely install all libraries and compilation won't be complete when executing .\vcpkg install darknet[full]:x64-windows.
ReplyDeleteI am glad that this post helped you. Keep learning :)
DeleteWhen I use the picture detection command, it works. But when it comes to the video command I get the following:
ReplyDeleteGPU isn't used
Used AVX
Used FMA & AVX2
OpenCV isn't used - data augmentation will be slow
Demo needs OpenCV for webcam images.
Its annoying, I hope someone can help me fix it.
When you see GPU isn't used while running darknet command, it means your OpenCV is not compiled with GPU settings. Have you used this command: .\vcpkg install darknet[full]:x64-windows? If yes, there must be some error in red color otherwise you must check also your CUDA related settings.
DeleteI am really happy with your blog because your article is very unique and powerful for new.
ReplyDeleteData Science
Selenium
ETL Testing
AWS
Python Classes in Pune
ETL Testing
I got error using this command
ReplyDelete.\vcpkg install darknet[full]:x64-windows
ERROR:
Error: Building package cuda:x64-windows failed with: BUILD_FAILED
Please help. Thanks in advance
It seems you have not installed Cuda properly. Please recheck the cuda and cudnn installation in your system.
Deletehey! can I use jupyter notenook instead of google colab here??
ReplyDeleteIn this post I have not used colab or jupyter notebook. This post is only about building and compiling the Darknet with GPU settings in Windows 10 system.
DeleteI have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! data warehouse,
ReplyDeleteWhen I run the command all I get is:
ReplyDelete"
CUDA-version: 10020 (11020), cuDNN: 7.6.5, CUDNN_HALF=1, GPU count: 1
CUDNN_HALF=1
OpenCV version: 4.1.0
Demo
0 : compute_capability = 860, cudnn_half = 1, GPU: GeForce RTX 3090
net.optimized_memory = 0
mini_batch = 1, batch = 8, time_steps = 1, train = 0
layer filters size/strd(dil) input output
0"
Then it just hangs there indefinitely. any ideas?
You are using RTX 3090 and till March few people have faced the same issue. Please retry with a fresh start on new folders and I hope you will not face the same issue.
Deleteits stuck.....and in task manager it dosnt show and cpu usage ar anything by power shell
ReplyDeletestuck in building x64 windows-dbg
ReplyDeleteWhile building and compiling the Darknet with GPU in my system it took 3 hours. If you are facing more time then I suggest please retry on a new folder as a fresh start. Make sure you have opened the cmd/powershell with admin rights and you have internet on during this process.
DeleteGreat Work but i see the same error, i try it twice:
ReplyDelete-- Downloading https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.weights -> darknet-cache/yolov4-tiny.weights...
CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:105 (message):
File does not have expected hash:
File path: [ D:/vcpkg-master3/vcpkg-master/downloads/temp/darknet-cache/yolov4-tiny.weights ]
Expected hash: [ 804ca2ab8e3699d31c95bf773d22f901f186703487c7945f30dc2dbb808094793362cb6f5da5cd0b4b83f820c8565a3cba22fafa069ee6ca2a925677137d95f4 ]
Actual hash: [ 7d4d9fe150f9fe3ea7d2310f1445fe983b31fbf06d301c70ecfe00e8559e6f1bf940198c2dd55db772238f23ea0092fb6553558e5414f3ee173b8b28e53c5b54 ]
The file may have been corrupted in transit. This can be caused by
proxies. If you use a proxy, please set the HTTPS_PROXY and HTTP_PROXY
environment variables to
"https://user:password@your-proxy-ip-address:port/".
Call Stack (most recent call first):
scripts/cmake/vcpkg_download_distfile.cmake:195 (test_hash)
ports/darknet/portfile.cmake:28 (vcpkg_download_distfile)
scripts/ports.cmake:142 (include)
Error: Building package darknet:x64-windows failed with: BUILD_FAILED
To solve this go to ports/darknet/portfile.cmake and change the hash of the line that threw the error. You might have to this multiple times
DeleteTo solve this issue, please follow this link: https://github.com/microsoft/vcpkg/issues/15256
DeleteThanks this article gives more information on data science fundamentals. Visit us: Data Science Course in bhubaneshwar
ReplyDeleteVisit us: Data Science Course in bhubaneshwar
Visit us: Data Science Course in dehradun
Visit us: Data Science Course in dombivli
Visit us: Data Science Course in durgapur
Nice Article.Thank you for sharing useful information.
ReplyDeleteFor Online MBA check below.
Innomatics Research Labs is collaborated with JAIN (Deemed-to-be University) and offering the Online MBA in Business Intelligence,Business Analytics Program. This two-year program from JAIN (deemed-to-be) University offers foundation courses, core courses, Specialization courses, and a comprehensive master thesis intermediary, apart from an option to pursue a cross-functional and open elective.
Online MBA in Business Analytics
Online MBA in Business Intelligence
"RTX 3090 in UAE,EVGA GeForce RTX 3090 XC3 in UAE,Ultra Gaming 24GB in UAE"
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteExcellent post with valuable info. Share more updates
ReplyDeleteService Cloud
Salesforce
Thanks for sharing this amazing post this is the content i really looking for, it's very helpful i hope you will continue your blogging anyway if anyone looking for Advance excel training institute in delhi contact us +91-9311002620 visit-https://www.htsindia.com/Courses/business-analytics/adv-excel-training-course
ReplyDeleteGreat post I would like to thank you for the efforts you have made in writing this interesting and knowledgeable article.
ReplyDeletedata scientist training in malaysia
This comment has been removed by the author.
ReplyDeleteit’s very helpful useful thanks for your valuable information follow us
ReplyDeleteBest Data Science Online Training in Hyderabad
Looking for top-notch MCSE 2012 Training in Delhi? Look no further than APTRON, your premier destination for comprehensive and industry-oriented IT training. With a track record of excellence and a commitment to delivering exceptional results, APTRON Delhi stands out as the go-to institute for aspiring IT professionals.
ReplyDeleteyalova
ReplyDeleteyozgat
elazığ
van
sakarya
AV855
APTRON Solution takes pride in its hands-on training approach, making us the premier choice for Industrial Automation Training in Noida. Our dedicated faculty comprises experienced professionals who bring real-world insights to the classroom. We combine theoretical knowledge with practical application, ensuring that you gain the skills required for success in the industrial automation field.
ReplyDeletehttps://istanbulolala.biz/
ReplyDeletePCER
66CC4
ReplyDeleteAfyon Şehirler Arası Nakliyat
Isparta Parça Eşya Taşıma
Karaman Şehir İçi Nakliyat
Batman Evden Eve Nakliyat
Tunceli Parça Eşya Taşıma
Hotbit Güvenilir mi
Yozgat Evden Eve Nakliyat
Kripto Para Nedir
Mersin Parça Eşya Taşıma
126F7
ReplyDeleteLuffy Coin Hangi Borsada
Floki Coin Hangi Borsada
Elazığ Parça Eşya Taşıma
Yozgat Parça Eşya Taşıma
Urfa Lojistik
Burdur Şehirler Arası Nakliyat
Hakkari Şehirler Arası Nakliyat
Malatya Şehirler Arası Nakliyat
Samsun Parça Eşya Taşıma
2D1FB
ReplyDeleteManisa Evden Eve Nakliyat
Arbitrum Coin Hangi Borsada
Silivri Boya Ustası
Batman Evden Eve Nakliyat
Amasya Şehirler Arası Nakliyat
Rize Evden Eve Nakliyat
Denizli Şehirler Arası Nakliyat
Mercatox Güvenilir mi
Ordu Evden Eve Nakliyat
DEC32
ReplyDeletetestosterone enanthate for sale
order peptides
for sale dianabol methandienone
winstrol stanozolol for sale
peptides
turinabol
order trenbolone enanthate
clenbuterol
primobolan for sale
Global Degrees, established in 2005, has become a leading provider of overseas education advisory and consulting services, renowned for its performance-driven approach. Specializing in student recruitment for foreign universities, fostering university partnerships, and facilitating business growth in the education sector, the company operates primarily in South India through 8 company-owned branches, prioritizing excellence and consistency. With a strong focus on marketing strategies and industry relations, Global Degrees offers unparalleled support to universities worldwide, aiding in student enrollment and providing access to quality educational opportunities across 8 countries. They eagerly anticipate serving as your trusted consulting partner in the realm of overseas education.
ReplyDeleteThanks for sharing the valuable information.
ReplyDeleteHome Nursing Services in Hyderabad
nursing services at your door step
Home Physiotherapy Services
نفخ المجاري بالاحساء UOMKRwbbwm
ReplyDelete