# haze tutorial menu
the tutorial is about how to use yolo mark system for haze.
## environment reuqire
[opencv 4](https://www.learnopencv.com/install-opencv-4-on-windows/)
[opencv - python 串接](https://stackoverflow.com/questions/19876079/cannot-find-module-cv2-when-using-opencv)
python 3.7
cudnn > 10
cuda > 10
pytorch
nvidia driver
## Introdce
YOLOV3是一套基於CNN做Object detection的訓練系統,
他提供從物件標記->機器訓練->物件檢測->物件辨識率,
完整的辨識流程。在機器訓練yolov3提供的演算法,
比fast R-cnn快上100倍。
<iframe width="400" height="250" src="https://www.youtube.com/embed/MPU2HistivI" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
## Install yolo mark
see the official websit[3],whic teach you how to install
## Using yolo mark
### execute yolo tag tool
1.we need to open yolo mark software,open the cmd
and type the path like below:
cd /home/hugo168/Job/UMC_ESI/esi_solution/darknet_pg2/data/mark/
then execute command:
yolo_mark img train.txt obj.names
the interface like below:

### parameter explain
here has three document in
yolo_mark img train.txt obj.names
img - save training image
train.txt - save train images file path,which you want. see the below image

obj.names - number of tag type

### CNN config
we need to editor training config,the file path is
cd /home/hugo168/Job/UMC_ESI/esi_solution/darknet_pg2/cfg/
open the file is
gedit yolov3_umc.cfg
you can see config

here has some key point,
batch : a group of training image data.
max_batches : number of epcho

classes: defining number of type
## Weight detector
### make detect haze image
we finish training data and get weight file before we want detected haze image,go to path:
cd /home/hugo168/Job/UMC_ESI/esi_solution/darknet_pg2
and execute command:
./cal_map.sh
you ca see run result like below.

the valid image will detect with eigh class,and show the rate with any class.
### cal_map config

obj.data : setting number of classes,train img,valid img,classes name,backup,see below.

## Yolo cnn training
### data training
when you finish tag image,who can training data.
1. go to file path
cd /home/hugo168/Job/UMC_ESI/esi_solution/darknet_pg2/
2.execute command
if you first training
./first_train.sh
if not
./train.sh
when you run training,which was show below

until final file name is yolov3_umc_final.weight.
## Backup
final we want to see the detect result.
cd /home/hugo168/Job/UMC_ESI/esi_solution/darknet_pg2/data/results/
## file define
folder path : /home/hugo168/Job/UMC_ESI/esi_solution/darknet_pg2/
first_train.sh : first traning data file
train.sh : training data
run_result_folder.py :it is add predicted tag on image,and save to result folder
[reference]
1.[YOLO!!!如何簡單使用YOLO訓練出自己的物件偵測!!!](https://medium.com/%E9%9B%9E%E9%9B%9E%E8%88%87%E5%85%94%E5%85%94%E7%9A%84%E5%B7%A5%E7%A8%8B%E4%B8%96%E7%95%8C/%E6%A9%9F%E5%99%A8%E5%AD%B8%E7%BF%92-ml-note-yolo-%E5%88%A9%E7%94%A8%E5%BD%B1%E5%83%8F%E8%BE%A8%E8%AD%98%E5%81%9A%E7%89%A9%E4%BB%B6%E5%81%B5%E6%B8%AC-object-detection-%E7%9A%84%E6%8A%80%E8%A1%93-3ad34a4cac70)
2.[Yolo_mark](https://github.com/AlexeyAB/Yolo_mark)
3.[YOLO OFFICIAL WEBSITE](https://pjreddie.com/darknet/yolo/)
4.[Training YOLOv3 : Deep Learning based Custom Object Detector](https://www.learnopencv.com/training-yolov3-deep-learning-based-custom-object-detector/)
5.[【YOLO】yolo.cfg檔案 原始碼必備!](https://codertw.com/%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80/542552/)
[ref algorithm]
1.[(未研究)Real-time Object Detection with YOLO, YOLOv2 and now YOLOv3](https://medium.com/@jonathan_hui/real-time-object-detection-with-yolo-yolov2-28b1b93e2088)
contact klif_hsu@gutc.com.tw