Skip to content

FrameWorks

Vinay Sharma edited this page Jun 28, 2018 · 6 revisions

Darknet

To use Darknet as your framework it is necessary to Install it from JdeRobot's Darknet Fork.

  • Installation

    Darknet supports both GPU and CPU builds, and GPU build is enabled by default. If your Computer doesn't have a NVIDIA Graphics card, then it is necessary to turn off GPU build in cmake by passing -DUSE_GPU=OFF as an option in cmake.

        git clone https://github.com/JdeRobot/darknet
        cd darknet
        mkdir build && cd build
    
    

    For GPU users:

    cmake -DCMAKE_INSTALL_PREFIX=<DARKNET_DIR> ..
    

    For Non-GPU users (CPU build):

    cmake -DCMAKE_INSTALL_PREFIX=<DARKNET_DIR> -DUSE_GPU=OFF ..
    

    Change <DARKNET_DIR> to your custom installation path.

    make -j4
    sudo make -j4 install

    Note:- After installing Darknet using above methods, you have to pass Darknet Installation Directory as an option in DetectionSuite's CMake like cmake -D DARKNET_PATH=<DARKNET_DIR> ... Now, this <DARKNET_DIR> is same as <DARKNET_DIR> passed above. Cmake will throw a Warning if it couldn't find Darknet Libraries, just look for that and you are all done ⚡ 💥 .

TensorFlow

First of all, you need tensorflow installed in your system, and you can get it installed by running the following commands.

  • Installation (Skip if Tensorflow is already installed)

    pip install numpy==1.14.2 six==1.11.0 protobuf==3.5.2.post1
    

    For GPU use:

    pip install tensorflow_gpu
    

    For CPU only use:

    pip install tensorflow
    

For using TensorFlow as your framework, you would need a TensorFlow Trained Network. Some sample Networks/models are available at TensorFlow model zoo.

Download one of them and untar it and place it into the weights directory.

We will be using a COCO trained model for this example, but you can choose any model. Although you would have to create a class names file for that particular dataset written in a correct order.

Sample coco.names file for COCO dataset: coco.names.
All it contains is a list of classes being used for this dataset in the correct order. Place this file in the names directory.

Now create an empty foo.cfg file and place it in the cfg directory. It is empty because tensorflow doesn't require any cfg file, just the frozen inference graph.

All done! Now you are ready to go!

Sample video using SSD MobileNet COCO on TensorFlow Framework in DetectionSuite
Link to Video
Detection Suite tensorflow inferencer

Keras

  • Installation (Skip if Keras is already installed)

pip install numpy==1.14.2 six==1.11.0 protobuf==3.5.2.post1 h5py==2.7.1
pip install Keras

For using Keras you must first have a Keras Trained Model Weights which are typically stored in an HDF5 file. No, configuration file is needed since new versions of Keras now contain architecture, weights and optimizer state all in a single HDF5 file. See docs for the same.

Some sample pre-trained models are available at our Model Zoo, on different archirectures and Datasets.

Caffe

For using Caffe, you will require OpenCV 3.4 or greater with it's dnn module built. Following are the steps to install OpenCV 3.4 from source, though we will be shipping compiled binary packages of the same in the future, so as to speed up installation.

  • Installation

    git clone https://github.com/opencv/opencv.git
    git checkout 3.4
    cmake -D WITH_QT=ON -D WITH_GTK=OFF ..
    make -j4
    sudo make install
    

Then, just build again, and just look out for a warning stating OpenCV 3.4 not Found, Caffe Support will be disabled. If that warning persists than OpenCV 3.4 or higher hasn't been installed correctly, any you may want to look into that, else you are Good to Go.

To Use Caffe you would require some pre-trained Models on Caffe, some are available at our own Model Zoo. But wait, you will also need to add custom parameters for Caffe, and our model zoo contains those parameters for each of the Inferencer, just directly use that.

All DONE !!!