---
# System prepended metadata

title: (Docs) Dist-YOLO
tags: [Documentation]

---

---
title: (Docs) Dist-YOLO
tags: Documentation 
---

{%hackmd theme-dark %}
{%hackmd sMV2zv-CTsuIqnpb0hZLmA %}

# [Documentation] Dist-YOLO
Code can be downloaded here 👇
[Dist-YOLO: Fast Object Detection with Distance Estimation](https://gitlab.com/EnginCZ/yolo-with-distance)  
Paper -> https://www.mdpi.com/2076-3417/12/3/1354

## Table of Contents
* ⚙️ Create Environment

## ⚙️ Create Environment
Use Anaconda to create environment.
```bash
conda create -n [ENVNAME]
```  

This repo is an extension from the [original](https://github.com/david8862/keras-YOLOv3-model-set) repo.
Follow these steps to setup your environment:
1. Install requirements for Ubuntu 16.04/18.04
```bash
conda install python=3.6
sudo apt install python3-opencv imagemagick
pip install Cython
pip install -r requirements.txt

# If you have no errors, congrats, you can skip these steps
# My installation error -> "ERROR: Failed building wheel for onnx"
# Follow article below to learn more:
# https://bobbyhadz.com/blog/python-error-could-not-build-wheels-for-onnx
# conda install -c conda-forge numpy protobuf libprotobuf
# conda install -c conda-forge onnx

# # Everything should be fine now, but test this to make sure:
# pip install -r requirements.txt
```

2. Download [Darknet](https://pjreddie.com/darknet/install/)
```bash
git clone https://github.com/pjreddie/darknet.git
cd darknet
make

# Test if darknet is correctly installed
./darknet    
# Output -> usage: ./darknet <function>
```

3. Download YOLO models
```bash=
wget -O weights/darknet53.conv.74.weights https://pjreddie.com/media/files/darknet53.conv.74
wget -O weights/darknet19_448.conv.23.weights https://pjreddie.com/media/files/darknet19_448.conv.23
wget -O weights/yolov3.weights https://pjreddie.com/media/files/yolov3.weights
wget -O weights/yolov3-tiny.weights https://pjreddie.com/media/files/yolov3-tiny.weights
wget -O weights/yolov3-spp.weights https://pjreddie.com/media/files/yolov3-spp.weights
wget -O weights/yolov2.weights http://pjreddie.com/media/files/yolo.weights
wget -O weights/yolov2-voc.weights http://pjreddie.com/media/files/yolo-voc.weights
wget -O weights/yolov2-tiny.weights https://pjreddie.com/media/files/yolov2-tiny.weights
wget -O weights/yolov2-tiny-voc.weights https://pjreddie.com/media/files/yolov2-tiny-voc.weights
wget -O weights/yolov4.weights https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights
wget -O weights/yolo-fastest.weights https://github.com/dog-qiuqiu/Yolo-Fastest/raw/master/ModelZoo/yolo-fastest-1.0_coco/yolo-fastest.weights
wget -O weights/yolo-fastest-xl.weights https://github.com/dog-qiuqiu/Yolo-Fastest/raw/master/ModelZoo/yolo-fastest-1.0_coco/yolo-fastest-xl.weights
```

4. Install tensorflow and tensorboard
```bash
pip install tensorflow==2.3.0 tensorboard==2.3.0
```

5. Convert DarkNet YOLO to Keras model
```bash=
python tools/model_converter/convert.py cfg/yolov3.cfg weights/yolov3.weights weights/yolov3.h5
python tools/model_converter/convert.py cfg/yolov3-tiny.cfg weights/yolov3-tiny.weights weights/yolov3-tiny.h5
python tools/model_converter/convert.py cfg/yolov3-spp.cfg weights/yolov3-spp.weights weights/yolov3-spp.h5
python tools/model_converter/convert.py cfg/yolov2.cfg weights/yolov2.weights weights/yolov2.h5
python tools/model_converter/convert.py cfg/yolov2-voc.cfg weights/yolov2-voc.weights weights/yolov2-voc.h5
python tools/model_converter/convert.py cfg/yolov2-tiny.cfg weights/yolov2-tiny.weights weights/yolov2-tiny.h5
python tools/model_converter/convert.py cfg/yolov2-tiny-voc.cfg weights/yolov2-tiny-voc.weights weights/yolov2-tiny-voc.h5
python tools/model_converter/convert.py cfg/darknet53.cfg weights/darknet53.conv.74.weights weights/darknet53.h5
python tools/model_converter/convert.py cfg/darknet19_448_body.cfg weights/darknet19_448.conv.23.weights weights/darknet19.h5
python tools/model_converter/convert.py --yolo4_reorder cfg/yolov4.cfg weights/yolov4.weights weights/yolov4.h5
python tools/model_converter/convert.py cfg/yolo-fastest.cfg weights/yolo-fastest.weights weights/yolo-fastest.h5
python tools/model_converter/convert.py cfg/yolo-fastest-xl.cfg weights/yolo-fastest-xl.weights weights/yolo-fastest-xl.h5
```

6. 