From d7276c720d123e7497641de6dacc6408d94c9fc7 Mon Sep 17 00:00:00 2001 From: Micaela Verucchi Date: Sun, 29 Mar 2020 20:03:59 +0200 Subject: [PATCH] Update README.md --- README.md | 180 +++++++++++++++++++++++++++--------------------------- 1 file changed, 91 insertions(+), 89 deletions(-) diff --git a/README.md b/README.md index e126493..90d9f6f 100644 --- a/README.md +++ b/README.md @@ -1,120 +1,123 @@ # tkDNN -tkDNN is a Deep Neural Network library built with cuDNN primitives specifically thought to work on NVIDIA TK1(and all successive) board.
-The main scope is to do high performance inference on already trained models. +tkDNN is a Deep Neural Network library built with cuDNN and tensorRT primitives, specifically thought to work on NVIDIA Embedded Boards. It has been tested on TK1, TX1, TX2, AGX Xavier and several discrete GPU. +The main goal of this project is to exploit NVIDIA boards as much as possible to obtain the best inference performance. It does not allow training. -this branch actually work on every NVIDIA GPU that support the dependencies: +## Index +* [Dependencies](#dependencies) +* [How to compile this repo](#how-to-compile-this-repo) +* [Workflow](#workflow) +* [How to export weights](#how-to-export-weights) +* [Run the demo](#run-the-demo) +* [mAP demo](#map-demo) +* [Existing tests and supported networks](#existing-tests-and-supported-networks) +* [References](#references) + + + + +## Dependencies +This branch works on every NVIDIA GPU that supports the dependencies: * CUDA 10.0 * CUDNN 7.603 * TENSORRT 6.01 * OPENCV 4.1 * yaml-cpp 0.5.2 (sudo apt install libyaml-cpp-dev) -## Workflow -The recommended workflow follow these step: -* Build and train a model in Keras (on any PC) -* Export weights and bias -* Define the model on tkDNN -* Do inference (on TK1) - -## Compile the library -Build with cmake +## How to compile this repo +Build with cmake. If using Ubuntu 18.04 a new version of cmake is needed (1.15 or above). ``` +git clone https://github.com/ceccocats/tkDNN +git cd tkDNN +git checkout cnet mkdir build cd build -cmake .. -# use -DTEST_DATA=False to skip dataset download +cmake .. # use -DTEST_DATA=False to skip dataset download make ``` -during the cmake configuration it will be dowloaded the weights needed for running -the tests +If TEST_DATA is not set to False, weights needed to run some tests will be automatically downloaded. -## DLA34 and ResNet101 weights -To get weights and outputs needed for running the tests you can use the Python -script and the Anaconda environment included in the repository. +## Workflow +Steps needed to do inference on tkDNN with a custom neural network. +* Build and train a NN model with your favourite framework. +* Export weights and bias for each layer and save them in a binary file (one for layer). +* Export outputs for each layer and save them in a binary file (one for layer). +* Create a new test and define the network, layer by layer using the weights extracted and the output to check the results. +* Do inference. + +## How to export weights + +Weights are essential for any network to run inference. For each test a folder organized as follow is needed: +``` + test_nn + |---- test_nn.cpp (nn definition in tkDNN) + |---- layers/ (folder containing a binary file for each layer with the corresponding wieghts and bias) + |---- debug/ (folder containing a binary file for each layer with the corresponding outputs) +``` +Therefore, once the weights have been exported, the folders layers ans debug should be placed in the corresponding test. + +### 1)Export weights from darknet +To export weights for NN that are defined in darknet framework, use [this](https://github.com/ceccocats/darknet) fork of darknet and follow these step to obtain a correct debug and layers folder, ready for tkDNN. + +``` +git clone https://github.com/ceccocats/darknet +git cd darknet +make +mkdir layers debug +./darknet export layers +``` +N.b. Use compilation with CPU (leave GPU=0 in Makefile) if you also want debug. + +### 2)Export weights for DLA34 and ResNet101 +To get weights and outputs needed to run the tests dla34 and resnet101 use the Python script and the Anaconda environment included in the repository. Create Anaconda environment and activate it: ``` conda env create -f file_name.yml -source activate env_name +source activate env_name +python