Outils pour utilisateurs

Outils du site


movenet

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
movenet [2021/10/13 13:32] – Tag0 Added: python,sb,skeleton,tensorflow sergemovenet [2021/12/16 09:07] (Version actuelle) – [Ressources] serge
Ligne 5: Ligne 5:
   * https://tfhub.dev/s?q=movenet   * https://tfhub.dev/s?q=movenet
  
-=====Compilation de tensorflow avec avx2 fma===== +=====Optimisation de Tensorflow ===== 
-  * https://technofob.com/2019/06/14/how-to-compile-tensorflow-2-0-with-avx2-fma-instructions-on-mac/+Movenet appelle Tensorflow Lite, qui n'est pas optimisé pour GPU. Inutile d'installer Cuda.\\ 
 +Il ne tourne que sur CPU, et demande à avoir AVX2 et FMA.\\ 
 +Pour compiler Tensorflow, voir **[[linux_compiler_tensorflow_avec_bazel|]]** 
 + 
 +Altrnatives, trouver un truc tout fait: 
 +  * https://www.intel.com/content/www/us/en/developer/articles/guide/optimization-for-tensorflow-installation-guide.html
  
 =====Exemple===== =====Exemple=====
   * https://tfhub.dev/google/lite-model/movenet/singlepose/thunder/3   * https://tfhub.dev/google/lite-model/movenet/singlepose/thunder/3
  
-<code python>+<file python movenet_test.py>
 from time import time from time import time
 import cv2 import cv2
Ligne 18: Ligne 23:
  
 def draw(frame, keypoints_with_scores): def draw(frame, keypoints_with_scores):
-    """Calcul étrange""" 
     for item in keypoints_with_scores[0][0]:     for item in keypoints_with_scores[0][0]:
-        if item[2] > 0.5:  # confiance +        if item[2] > 0.3:  # confiance 
-            x = int(item[1]*640)  # numpy array x est le 2ème +            x = int(item[1]*720)  # numpy array x est le 2ème 
-            y = int(item[0]*640- 80+            y = int(item[0]*720)
             cv2.circle(frame, (x, y), 6, color=(0,0,255), thickness=-1)             cv2.circle(frame, (x, y), 6, color=(0,0,255), thickness=-1)
     return frame     return frame
  
-interpreter tf.lite.Interpreter(model_path="lite-model_movenet_singlepose_thunder_3.tflite")+models [  "lite-model_movenet_singlepose_thunder_3.tflite", 
 +            "lite-model_movenet_singlepose_thunder_tflite_float16_4.tflite", 
 +            "lite-model_movenet_singlepose_thunder_tflite_int8_4.tflite"
 + 
 +interpreter = tf.lite.Interpreter(model_path=models[0])
 interpreter.allocate_tensors() interpreter.allocate_tensors()
  
 cv2.namedWindow('color', cv2.WND_PROP_FULLSCREEN) cv2.namedWindow('color', cv2.WND_PROP_FULLSCREEN)
-cam = cv2.VideoCapture(0)+cam = cv2.VideoCapture(2) 
 +cam.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) 
 +cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) 
 t0 = time() t0 = time()
 nbr = 0 nbr = 0
Ligne 41: Ligne 52:
     if not ret:     if not ret:
         continue         continue
 +
 +    # Extraction d'une image carrée [rows, columns]
 +    frame = frame[:, 280:1000]
  
     image = tf.expand_dims(frame, axis=0)     image = tf.expand_dims(frame, axis=0)
Ligne 72: Ligne 86:
  
 cv2.destroyAllWindows() cv2.destroyAllWindows()
-</code>+</file> 
 + 
 +=====Des essais amusants===== 
 +  * **[[https://github.com/sergeLabo/movenet|Essai de movenet par SergeLabo]]** 
 + 
 + 
 {{tag>python sb skeleton tensorflow}} {{tag>python sb skeleton tensorflow}}
movenet.1634131957.txt.gz · Dernière modification : 2021/10/13 13:32 de serge