Saturday, November 16, 2019

Yolo v3 on tensorflow and windows

I'm on a mission to get proficient with deploying several object detection and classification models. Then with that foundation I want to practice implementing transfer learning too. I'm even accepting the additional complexity of doing all this on windows (only from operation system convenience perspective only)

I've been able to get some basic transfer learning with a full image classifier on pytorch previously following their tutorials - i had to wrap some of the main functions in order to make it work on windows as I've been using anaconda and its conda environments to get these various frameworks working on windows.

Today I sought out to do the same thing with yolov3 and specifically with tensorflow because the books and tutorials i've been reading have been 90% on tensorflow and its already hard enough to learn. I'm confident there are real value propositions to pytorch as well - that said I just feel like its already a lot of information to absorb. Therefore I went to google to find yolov3 implemented on tensorflow, and stumbled onto this straightforward implementation:

https://github.com/YunYang1994/TensorFlow2.0-Examples/tree/master/4-Object_Detection/YOLOV3



I had to sort of manipulate my conda environment by manually using pip to install the various libraries (easydict in particular was hard to get right because i had a version mismatch from the requirements.) the quickstart guide suggested

pip3 install -r ./docs/requirements.txt

Which is kind of a neat way to auto install a bunch of libraries for a given git. I should remember that and this command when i release stuff. To finish the easydict i had to uninstall it and then reinstall it with pip3. I got it working on the CPU so frame rate is pretty bad (1fps). I was able to simply use opencv to change the video object from a local file to a webcam and here you can see it working.


import cv2

# Grab the webcamcap = cv2.VideoCapture(0)

while True:
    # Read the webcam image    
    return_value, frame = cap.read()

No comments:

Post a Comment