Abhishek Gola commited on
Commit
8cd5574
·
1 Parent(s): b6fc0e9

updated mp_persondet usage and added .gitattributes

Browse files
Files changed (4) hide show
  1. .gitattributes +26 -0
  2. .gitignore +9 -0
  3. demo.py +4 -4
  4. mp_persondet.py +0 -0
.gitattributes ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Caffe
3
+ *.caffemodel filter=lfs diff=lfs merge=lfs -text
4
+
5
+ # Tensorflow
6
+ *.pb filter=lfs diff=lfs merge=lfs -text
7
+ *.pbtxt filter=lfs diff=lfs merge=lfs -text
8
+
9
+ # Torch
10
+ *.t7 filter=lfs diff=lfs merge=lfs -text
11
+ *.net filter=lfs diff=lfs merge=lfs -text
12
+
13
+ # Darknet
14
+ *.weights filter=lfs diff=lfs merge=lfs -text
15
+
16
+ # ONNX
17
+ *.onnx filter=lfs diff=lfs merge=lfs -text
18
+
19
+ # NPY
20
+ *.npy filter=lfs diff=lfs merge=lfs -text
21
+
22
+ # Images
23
+ *.jpg filter=lfs diff=lfs merge=lfs -text
24
+ *.gif filter=lfs diff=lfs merge=lfs -text
25
+ *.png filter=lfs diff=lfs merge=lfs -text
26
+ *.webp filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ *.pyc
2
+ **/__pycache__
3
+ **/__pycache__/**
4
+
5
+ .vscode
6
+
7
+ build/
8
+ **/build
9
+ **/build/**
demo.py CHANGED
@@ -1,8 +1,8 @@
1
- import sys
2
  import argparse
3
 
4
  import numpy as np
5
  import cv2 as cv
 
6
 
7
  # Check OpenCV version
8
  opencv_python_version = lambda str_version: tuple(map(int, (str_version.split("."))))
@@ -10,10 +10,10 @@ assert opencv_python_version(cv.__version__) >= opencv_python_version("4.10.0"),
10
  "Please install latest opencv-python for benchmark: python3 -m pip install --upgrade opencv-python"
11
 
12
  from mp_pose import MPPose
13
-
14
- sys.path.append('../person_detection_mediapipe')
15
  from mp_persondet import MPPersonDet
16
 
 
 
17
  # Valid combinations of backends and targets
18
  backend_target_pairs = [
19
  [cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_TARGET_CPU],
@@ -171,7 +171,7 @@ if __name__ == '__main__':
171
  target_id = backend_target_pairs[args.backend_target][1]
172
 
173
  # person detector
174
- person_detector = MPPersonDet(modelPath='../person_detection_mediapipe/person_detection_mediapipe_2023mar.onnx',
175
  nmsThreshold=0.3,
176
  scoreThreshold=0.5,
177
  topK=5000, # usually only one person has good performance
 
 
1
  import argparse
2
 
3
  import numpy as np
4
  import cv2 as cv
5
+ from huggingface_hub import hf_hub_download
6
 
7
  # Check OpenCV version
8
  opencv_python_version = lambda str_version: tuple(map(int, (str_version.split("."))))
 
10
  "Please install latest opencv-python for benchmark: python3 -m pip install --upgrade opencv-python"
11
 
12
  from mp_pose import MPPose
 
 
13
  from mp_persondet import MPPersonDet
14
 
15
+ mp_model_path = hf_hub_download(repo_id="opencv/person_detection_mediapipe", filename="person_detection_mediapipe_2023mar.onnx")
16
+
17
  # Valid combinations of backends and targets
18
  backend_target_pairs = [
19
  [cv.dnn.DNN_BACKEND_OPENCV, cv.dnn.DNN_TARGET_CPU],
 
171
  target_id = backend_target_pairs[args.backend_target][1]
172
 
173
  # person detector
174
+ person_detector = MPPersonDet(modelPath=mp_model_path,
175
  nmsThreshold=0.3,
176
  scoreThreshold=0.5,
177
  topK=5000, # usually only one person has good performance
mp_persondet.py ADDED
The diff for this file is too large to render. See raw diff