Last active
April 17, 2020 07:54
-
-
Save pra-dan/70944415aae7e6b3dc41d5ada1feb3e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install TensorFlow 1.0 | |
!pip install tensorflow==1.0 | |
# Install dependencies of the DarkFlow | |
!apt-get update | |
!pip3 install numpy | |
!apt-get install python-opencv -y | |
!pip install cython | |
# Clean up the directory | |
%cd /content/ | |
%rm -rf darkflow | |
# Clone the darkflow repository | |
!git clone https://github.com/thtrieu/darkflow | |
# Change into the darkflow dir and install darkflow with pip | |
%cd darkflow | |
!python setup.py build_ext --inplace | |
# Setup directories | |
%cd /content/darkflow | |
%rm -rf weights | |
%mkdir weights | |
%cd weights | |
%mkdir built_graph | |
# Fix the assertation issue by modifying the loader.py. | |
%cd /content/darkflow | |
!sed -i "s/self.offset = 16/self.offset = 20/g" ./darkflow/utils/loader.py | |
# Get the weigths and .cfg file | |
!wget -O "cfg/yolo-v2-tiny.cfg" "https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov2-tiny-voc.cfg" | |
!wget -O "weights/yolo-v2-tiny.weights" "https://pjreddie.com/media/files/yolov2-tiny-voc.weights" | |
# IMPORTANT: Replace content of lable.txt file, as specified above. ONLY then proceed | |
print("\nREMOVE ME IF YOU FOLLOWED THE ABOVE STEP :)") | |
# Convert | |
!./flow --model cfg/yolo-v2-tiny.cfg --load weights/yolo-v2-tiny.weights --savepb | |
## You'll find the converted file (.pb) in "content/darkflow/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment