Outils pour utilisateurs

Outils du site


yolo_darknet_avec_un_vrai_semaphore

Ceci est une ancienne révision du document !


Yolo Darknet avec un vrai sémaphore

C'est quoi un sémaphore ?

chappe.jpeg



Reconnaissance d'un vrai sémaphore avec YOLO Darknet

Ce sémaphore est une image virtuelle, mais c'est copie conforme du vrai !

Suite et fin

Apprentissage

cfg

Relire tout le readme pour bien configurer en particulier:

  • for training for both small and large objects use modified models: yolov3-tiny_3l.cfg
  • If you train the model to distinguish Left and Right objects as separate classes (left/right hand, left/right-turn on road signs, …) then for disabling flip data augmentation - add flip=0

Apprentissage

 export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
./darknet detector train blend/obj.data blend/yolov3-obj_3l_blend.cfg darknet53.conv.74 -map

3 calcul

Calcul 1 sur 1060 GTX

  • jpg 90, faible variation d'angle, faible variation de couleur et lumière
  • 9 000 itérations
  • Les fichiers:

 calculation mAP (mean average precision)...
6000
 detections_count = 17645, unique_truth_count = 5987  
class_id = 0, name = a, ap = 97.74%   	 (TP = 220, FP = 46) 
class_id = 1, name = space, ap = 91.95%   	 (TP = 205, FP = 75) 
class_id = 2, name = b, ap = 99.55%   	 (TP = 220, FP = 0) 
class_id = 3, name = c, ap = 97.65%   	 (TP = 214, FP = 14) 
class_id = 4, name = d, ap = 100.00%   	 (TP = 218, FP = 0) 
class_id = 5, name = e, ap = 95.70%   	 (TP = 210, FP = 8) 
class_id = 6, name = f, ap = 100.00%   	 (TP = 212, FP = 0) 
class_id = 7, name = g, ap = 97.59%   	 (TP = 209, FP = 25) 
class_id = 8, name = h, ap = 100.00%   	 (TP = 219, FP = 0) 
class_id = 9, name = i, ap = 97.34%   	 (TP = 209, FP = 60) 
class_id = 10, name = j, ap = 100.00%   	 (TP = 228, FP = 0) 
class_id = 11, name = k, ap = 100.00%   	 (TP = 241, FP = 26) 
class_id = 12, name = l, ap = 98.39%   	 (TP = 199, FP = 50) 
class_id = 13, name = m, ap = 98.64%   	 (TP = 218, FP = 0) 
class_id = 14, name = n, ap = 97.77%   	 (TP = 204, FP = 41) 
class_id = 15, name = o, ap = 99.58%   	 (TP = 237, FP = 16) 
class_id = 16, name = p, ap = 98.38%   	 (TP = 213, FP = 10) 
class_id = 17, name = q, ap = 100.00%   	 (TP = 207, FP = 17) 
class_id = 18, name = r, ap = 100.00%   	 (TP = 195, FP = 0) 
class_id = 19, name = s, ap = 99.57%   	 (TP = 229, FP = 61) 
class_id = 20, name = t, ap = 86.73%   	 (TP = 216, FP = 154) 
class_id = 21, name = u, ap = 100.00%   	 (TP = 213, FP = 10) 
class_id = 22, name = v, ap = 94.88%   	 (TP = 211, FP = 89) 
class_id = 23, name = w, ap = 99.99%   	 (TP = 235, FP = 14) 
class_id = 24, name = x, ap = 93.46%   	 (TP = 199, FP = 81) 
class_id = 25, name = y, ap = 99.55%   	 (TP = 223, FP = 0) 
class_id = 26, name = z, ap = 95.30%   	 (TP = 219, FP = 96) 
 
 for thresh = 0.25, precision = 0.87, recall = 0.97, F1-score = 0.92 
 for thresh = 0.25, TP = 5823, FP = 893, FN = 164, average IoU = 77.65 % 
 
 IoU threshold = 50 %, used Area-Under-Curve for each unique Recall 
 mean average precision (mAP@0.50) = 0.977692, or 97.77 % 
 
 mean_average_precision (mAP@0.5) = 0.977692 

Calcul 2 sur 1060 GTX

Suite du calcul 1, en repartant à 12000, et avec 54 000 itérations.

 calculation mAP (mean average precision)...
6000
 detections_count = 9682, unique_truth_count = 5987  
class_id = 0, name = a, ap = 97.65%   	 (TP = 232, FP = 118) 
class_id = 1, name = space, ap = 91.08%   	 (TP = 152, FP = 0) 
class_id = 2, name = b, ap = 99.55%   	 (TP = 220, FP = 0) 
class_id = 3, name = c, ap = 97.35%   	 (TP = 227, FP = 40) 
class_id = 4, name = d, ap = 100.00%   	 (TP = 218, FP = 0) 
class_id = 5, name = e, ap = 94.33%   	 (TP = 215, FP = 0) 
class_id = 6, name = f, ap = 100.00%   	 (TP = 212, FP = 0) 
class_id = 7, name = g, ap = 96.39%   	 (TP = 207, FP = 0) 
class_id = 8, name = h, ap = 100.00%   	 (TP = 219, FP = 0) 
class_id = 9, name = i, ap = 97.12%   	 (TP = 205, FP = 61) 
class_id = 10, name = j, ap = 100.00%   	 (TP = 228, FP = 0) 
class_id = 11, name = k, ap = 100.00%   	 (TP = 241, FP = 0) 
class_id = 12, name = l, ap = 99.25%   	 (TP = 180, FP = 3) 
class_id = 13, name = m, ap = 98.64%   	 (TP = 218, FP = 0) 
class_id = 14, name = n, ap = 98.89%   	 (TP = 218, FP = 96) 
class_id = 15, name = o, ap = 99.58%   	 (TP = 237, FP = 18) 
class_id = 16, name = p, ap = 97.62%   	 (TP = 220, FP = 58) 
class_id = 17, name = q, ap = 100.00%   	 (TP = 207, FP = 35) 
class_id = 18, name = r, ap = 100.00%   	 (TP = 195, FP = 0) 
class_id = 19, name = s, ap = 99.57%   	 (TP = 229, FP = 57) 
class_id = 20, name = t, ap = 91.33%   	 (TP = 215, FP = 138) 
class_id = 21, name = u, ap = 99.99%   	 (TP = 213, FP = 6) 
class_id = 22, name = v, ap = 97.73%   	 (TP = 180, FP = 0) 
class_id = 23, name = w, ap = 99.99%   	 (TP = 235, FP = 15) 
class_id = 24, name = x, ap = 97.32%   	 (TP = 177, FP = 0) 
class_id = 25, name = y, ap = 99.55%   	 (TP = 223, FP = 0) 
class_id = 26, name = z, ap = 97.29%   	 (TP = 199, FP = 10) 
 
 for thresh = 0.25, precision = 0.90, recall = 0.96, F1-score = 0.93 
 for thresh = 0.25, TP = 5722, FP = 655, FN = 265, average IoU = 83.17 % 
 
 mean_average_precision (mAP@0.5) = 0.981556 

L'efficacité est quasi la même qu'avec 9 000 itérations:

9000  --> 0.977692
54000 --> 0.981556
pour 2 jours de calcul de plus!

Calcul 3 sur 765 GTX

  • jpg 100, forte variation d'angle, forte variation de couleur et lumière, grand mât
  • 12 000 itérations sur carte 765 GTX et subdivision=32 pour palier à la trop faible RAM du GPU.

 calculation mAP (mean average precision)...
6000
 detections_count = 17161, unique_truth_count = 5987  
class_id = 0, name = a,  17161   ap = 82.72 % 
class_id = 1, name = space, 	 ap = 80.00 % 
class_id = 2, name = b, 	 ap = 100.00 % 
class_id = 3, name = c, 	 ap = 94.55 % 
class_id = 4, name = d, 	 ap = 100.00 % 
class_id = 5, name = e, 	 ap = 79.73 % 
class_id = 6, name = f, 	 ap = 100.00 % 
class_id = 7, name = g, 	 ap = 88.52 % 
class_id = 8, name = h, 	 ap = 99.72 % 
class_id = 9, name = i, 	 ap = 94.52 % 
class_id = 10, name = j, 	 ap = 99.88 % 
class_id = 11, name = k, 	 ap = 97.39 % 
class_id = 12, name = l, 	 ap = 96.58 % 
class_id = 13, name = m, 	 ap = 100.00 % 
class_id = 14, name = n, 	 ap = 93.39 % 
class_id = 15, name = o, 	 ap = 98.15 % 
class_id = 16, name = p, 	 ap = 94.77 % 
class_id = 17, name = q, 	 ap = 97.96 % 
class_id = 18, name = r, 	 ap = 100.00 % 
class_id = 19, name = s, 	 ap = 97.23 % 
class_id = 20, name = t, 	 ap = 81.34 % 
class_id = 21, name = u, 	 ap = 98.94 % 
class_id = 22, name = v, 	 ap = 65.49 % 
class_id = 23, name = w, 	 ap = 98.84 % 
class_id = 24, name = x, 	 ap = 88.67 % 
class_id = 25, name = y, 	 ap = 99.96 % 
class_id = 26, name = z, 	 ap = 81.75 % 
 for thresh = 0.25, precision = 0.94, recall = 0.86, F1-score = 0.90 
 for thresh = 0.25, TP = 5175, FP = 343, FN = 812, average IoU = 82.32 % 
 
 IoU threshold = 50 % 
 mean average precision (mAP@0.50) = 0.929660, or 92.97 % 
 
 mean_average_precision (mAP@0.5) = 0.929660 

Comparaison

Reconnaissance dans le monde réel

La partie reconnaissance est dans le dossier semaphore_blend_yolo/darknet

Installation

Préparation

Créer un lien de libdarknet.so du dossier semaphore_blend_yolo/darknet

vers

libdarknet.so du dossier darknet, des sources compilées de darknet.

Exécution de la reconnaissance

Ouvrir un terminal dans semaphore_blend_yolo/darknet

./semaphore.sh

Le script fait l'export avant de lancer le python3 get_semaphore_message.py

Les sources sur GitHub

Bonus: Réglage d'une webcam en cours d'utilisation par un programme

sudo apt install v4l2ucp
v4l2ucp

Reporter dans un fichier de configuration.

yolo_darknet_avec_un_vrai_semaphore.1558891053.txt.gz · Dernière modification: 2019/05/26 19:17 par serge