[PYTHON] I tried object detection with YOLO v3 (TensorFlow 2.1) on the GPU of windows!

environment

windows7 64bit Gefore GTX 680MX GPU anaconda

1. 1. CUDA installation

Download the CUDA Toolkit 10.1 update 2 version from the following site (TensorFlow 2.1.0 is supported because of CUDA Toolkit 10.1) https://developer.nvidia.com/cuda-toolkit-archive

Do not select Visual Studio Intergration for installation

If the installation is successful, execute nvcc -V and the following result will be displayed.

C:\Windows\System32>nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:12:52_Pacific_Daylight_Time_2019
Cuda compilation tools, release 10.1, V10.1.243

2. cuDNN installation

Select and download cuDNN for CUDA 10.1 from the following site (Requires NVIDIA account) https://developer.nvidia.com/cudnn

Unzip the zip file and Rename the cuda folder to cuda765 and Copy to the path "C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.1"

After copying 1.JPG

3. Environment variable settings

Add the following cuDNN path to PATH

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\cuda765\bin

4. Create keras_work with conda

conda create -n keras_work
activate keras_work

5. Install tensoflow

conda install tensorflow

6. Confirmation

(base) C:\Users\mac>activate keras_work

(keras_work) C:\Users\mac>python
Python 3.7.7 (default, Apr 15 2020, 05:09:04) [MSC v.1916 64 bit (AMD64)] :: Ana
conda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2020-05-06 19:46:04.480481: I tensorflow/stream_executor/platform/default/dso_lo
ader.cc:44] Successfully opened dynamic library cudart64_101.dll
>>> print(tf.__version__)
2.1.0
>>> print(tf.test.is_gpu_available())
・ ・ ・
physical GPU (device: 0, name: GeForce GTX 680MX, pci bus id: 0000:01:00.0, compute capability: 3.0)
True

7. YOLO V3 material preparation

Get source from Github

cd c:\temp
git clone https://github.com/zzh8829/yolov3-tf2.git
cd yolov3-tf2

Download yolo3.weight from pjreddie.com

wget https://pjreddie.com/media/files/yolov3.weights --no-check-certificate

Since it is slow to get yolov3.weights from the above pjreddie.com, you can also download the following URL. https://pan.baidu.com/s/1G2Qh-V8kyLOq4oDbTwK6HQ Proposal (password): vogw The file is "yolo_tf2.1 \ data \ yolov3.weights"

Move yolo3.weight file to yolov3-tf2 path Confirm that the file has been moved

(keras_work) C:\temp\yolov3-tf2>dir /B *.weights
yolov3.weights

8. Convert (convert pre-trained darknet weight)

python convert.py --weights ./yolov3.weights --output ./checkpoints/yolov3.tf

9. detection

python detect.py --image ./data/street.jpg

output.jpg

Recommended Posts

I tried object detection with YOLO v3 (TensorFlow 2.1) on the GPU of windows!
I tried object detection with YOLO v3 (TensorFlow 2.0) on a windows CPU!
I tried to find the average of the sequence with TensorFlow
[For beginners] I tried using the Tensorflow Object Detection API
I tried running YOLO v3 on Google Colab
I tried playing with the calculator on tkinter
I tried running the TensorFlow tutorial with comments (text classification of movie reviews)
I tried tensorflow's new Object Detection API on macOS Sierra
I tried to find the entropy of the image with python
I tried "gamma correction" of the image with Python + OpenCV
2020/02 Python 3.7 + TensorFlow 2.1 + Keras 2.3.1 + YOLOv3 Object detection with the latest version
I tried refactoring the CNN model of TensorFlow using TF-Slim
I tried running PIFuHD on Windows for the time being
I tried replacing the Windows 10 HDD with a smaller SSD
Until the start of the django tutorial with pycharm on Windows
I tried changing the python script from 2.7.11 to 3.6.0 on windows10
I stumbled on TensorFlow (What is Out of GPU Memory)
[For those who want to use TPU] I tried using the Tensorflow Object Detection API 2
I tried to sort out the objects from the image of the steak set meal-① Object detection
I tried a convolutional neural network (CNN) with a tutorial on TensorFlow on Cloud9-Classification of handwritten images-
Face detection with YOLO Face (Windows10, Python3.6)
I tried the TensorFlow tutorial 1st
I tried the TensorFlow tutorial 2nd
I tried face detection with MTCNN
Use Tensorflow 2.1.0 with Anaconda on Windows 10!
[Python] I tried using YOLO v3
I tried scraping the ranking of Qiita Advent Calendar with Python
I tried to automate the watering of the planter with Raspberry Pi
I tried cross-validation based on the grid search results with scikit-learn
I tried to expand the size of the logical volume with LVM
I tried running the DNN part of OpenPose with Chainer CPU
I checked the image of Science University on Twitter with Word2Vec.
I tried to improve the efficiency of daily work with Python
I tried running the TensorFlow tutorial with comments (_TensorFlow_2_0_Introduction for beginners)
I tried to make Othello AI with tensorflow without understanding the theory of machine learning ~ Introduction ~
I tried to make Othello AI with tensorflow without understanding the theory of machine learning ~ Implementation ~
I tried the TensorFlow tutorial MNIST 3rd
I tried to transform the face image using sparse_image_warp of TensorFlow Addons
I tried the asynchronous server of Django 3.0
I tried to implement Autoencoder with TensorFlow
I tried tensorflow for the first time
I was addicted to running tensorflow on GPU with NVIDIA driver 440 + CUDA 10.2
I tried to visualize AutoEncoder with TensorFlow
I installed TensorFlow (GPU version) on Ubuntu
I tried to get the authentication code of Qiita API with Python.
I tried to summarize the logical way of thinking about object orientation.
I tried with the top 100 PyPI packages> I tried to graph the packages installed on Python
I tried playing with the image with Pillow
I tried to analyze the negativeness of Nono Morikubo. [Compare with Posipa]
I tried to streamline the standard role of new employees with Python
I tried to visualize the text of the novel "Weathering with You" with WordCloud
I built a TensorFlow environment on windows10
I tried to get the movie information of TMDb API with Python
Cooking object detection with yolo + image classification
I tried to predict the behavior of the new coronavirus with the SEIR model.
I tried 3D detection of a car
I tried to make Othello AI with tensorflow without understanding the theory of machine learning ~ Battle Edition ~
I installed Pygame with Python 3.5.1 in the environment of pyenv on OS X
I tried a TensorFlow tutorial (MNIST for beginners) on Cloud9-Classification of handwritten images-
I tried to easily visualize the tweets of JAWS DAYS 2017 with Python + ELK
I tried running an object detection tutorial using the latest deep learning algorithm