(Draft) Ubuntu, Jupyter Notebook, Python3, Tensorflow, OpenCV : Comptage des cyclistes

J’ai essayé un nouveau projet sur Github pour le comptage des cyclistes : https://github.com/ahmetozlu/tensorflow_object_counting_api .

J’ai du modifier le code pour utiliser TensorFlow : 2.3.1  .

 
 - tf.GraphDef => tf.compat.v1.GraphDef
 - tf.gfile.GFile => tf.compat.v2.io.gfile.GFile
 - tf.Session => tf.compat.v1.Session

Ensuite j’ai du adapter le programme à ma vidéo, j’ai adapté les programmes : vehicle_counting.py & real_time_couting_target_object.py . Le but était de positionner la ligne de comptage par rapport à la dimension de ma vidéo ( roi = 900 / 1280 ).

Avec real_time_couting_target_object.py (modifié) : ( c’est la le top quand on compte 10 cyclistes, il en compte 2 … Misère)

Avec vehicle_counting.py (modifié) , sur 120 cyclistes seulement 42 sont comptés:

Ma vidéo source fait ( GoPro ):

  • Dimenssion 1280 x 720
  • Codec H.264
  • 24 frames/sec
  • Bitrate 6810 kps
  • Durée 1min 51 sec.
  • Taille 95 Mo.

A suivre …

A noter que le modèle utilisé c’est « ssd_mobilenet_v1_coco_2018_01_28″ et ‘mscoco_label_map.pbtxt’ . ( sur http://download.tensorflow.org/models/object_detection/ ) . Je pense qu’il y a une version 2019 : https://arxiv.org/abs/1801.04381 & https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet  . Le nom doit être ssd_mobilenet_v3_small_coco_2019_08_14 .

UPDATE avec la version backbone.set_model(‘ssd_mobilenet_v3_small_coco_2019_08_14’, ‘mscoco_label_map.pbtxt’) :

J’ai du modifier dans api/object_counting_api.py

with tf.compat.v1.Session(graph=detection_graph) as sess:
# Definite input and output Tensors for detection_graph
#image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
image_tensor = 'image_tensor:0'

# Each box represents a part of the image where a particular object was detected.
#detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
detection_boxes = 'detection_boxes:0'

# Each score represent how level of confidence for each of the objects.
# Score is shown on the result image, together with the class label.
#detection_scores = detection_graph.get_tensor_by_name('detection_scores:0')
#detection_classes = detection_graph.get_tensor_by_name('detection_classes:0')
#num_detections = detection_graph.get_tensor_by_name('num_detections:0')
detection_scores = 'detection_scores:0'
detection_classes = 'detection_classes:0'
num_detections = 'num_detections:0'

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Time limit is exhausted. Please reload CAPTCHA.