# tkDNN export weights ## Index - [How to export weights](#how-to-export-weights) - [1)Export weights from darknet](#1export-weights-from-darknet) - [2)Export weights for DLA34 and ResNet101](#2export-weights-for-dla34-and-resnet101) - [3)Export weights for CenterNet](#3export-weights-for-centernet) - [4)Export weights for MobileNetSSD](#4export-weights-for-mobilenetssd) - [5)Export weights for CenterTrack](#5export-weights-for-centertrack) - [6)Export weights for ShelfNet](#6export-weights-for-shelfnet) - [Darknet Parser](#darknet-parser) ## How to export weights Weights are essential for any network to run inference. For each test a folder organized as follow is needed (in the build folder): ``` test_nn |---- 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 and debug should be placed in the corresponding test. ### 1)Export weights from darknet To export weights for NNs that are defined in darknet framework, use [this](https://git.hipert.unimore.it/fgatti/darknet.git) fork of darknet and follow these steps to obtain a correct debug and layers folder, ready for tkDNN. ``` git clone https://git.hipert.unimore.it/fgatti/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 python