WU Jia commited on
Commit
67acda1
·
1 Parent(s): f0eeb7f

Change the default value of topK (#271)

Browse files

* Change the default value of topK

* Change several more default values

Files changed (3) hide show
  1. demo.cpp +1 -1
  2. demo.py +1 -1
  3. mp_persondet.py +1 -1
demo.cpp CHANGED
@@ -31,7 +31,7 @@ private:
31
  Mat anchors;
32
 
33
  public:
34
- MPPersonDet(string modPath, float nmsThresh = 0.5, float scoreThresh = 0.3, int tok = 1, dnn::Backend bId = DNN_BACKEND_DEFAULT, dnn::Target tId = DNN_TARGET_CPU) :
35
  modelPath(modPath), nmsThreshold(nmsThresh),
36
  scoreThreshold(scoreThresh), topK(tok),
37
  backendId(bId), targetId(tId)
 
31
  Mat anchors;
32
 
33
  public:
34
+ MPPersonDet(string modPath, float nmsThresh = 0.3, float scoreThresh = 0.5, int tok = 5000, dnn::Backend bId = DNN_BACKEND_DEFAULT, dnn::Target tId = DNN_TARGET_CPU) :
35
  modelPath(modPath), nmsThreshold(nmsThresh),
36
  scoreThreshold(scoreThresh), topK(tok),
37
  backendId(bId), targetId(tId)
demo.py CHANGED
@@ -36,7 +36,7 @@ parser.add_argument('--score_threshold', type=float, default=0.5,
36
  help='Usage: Set the minimum needed confidence for the model to identify a person, defaults to 0.5. Smaller values may result in faster detection, but will limit accuracy. Filter out persons of confidence < conf_threshold.')
37
  parser.add_argument('--nms_threshold', type=float, default=0.3,
38
  help='Usage: Suppress bounding boxes of iou >= nms_threshold. Default = 0.3.')
39
- parser.add_argument('--top_k', type=int, default=1,
40
  help='Usage: Keep top_k bounding boxes before NMS.')
41
  parser.add_argument('--save', '-s', action='store_true',
42
  help='Usage: Specify to save file with results (i.e. bounding box, confidence level). Invalid in case of camera input.')
 
36
  help='Usage: Set the minimum needed confidence for the model to identify a person, defaults to 0.5. Smaller values may result in faster detection, but will limit accuracy. Filter out persons of confidence < conf_threshold.')
37
  parser.add_argument('--nms_threshold', type=float, default=0.3,
38
  help='Usage: Suppress bounding boxes of iou >= nms_threshold. Default = 0.3.')
39
+ parser.add_argument('--top_k', type=int, default=5000,
40
  help='Usage: Keep top_k bounding boxes before NMS.')
41
  parser.add_argument('--save', '-s', action='store_true',
42
  help='Usage: Specify to save file with results (i.e. bounding box, confidence level). Invalid in case of camera input.')
mp_persondet.py CHANGED
@@ -2,7 +2,7 @@ import numpy as np
2
  import cv2 as cv
3
 
4
  class MPPersonDet:
5
- def __init__(self, modelPath, nmsThreshold=0.3, scoreThreshold=0.5, topK=1, backendId=0, targetId=0):
6
  self.model_path = modelPath
7
  self.nms_threshold = nmsThreshold
8
  self.score_threshold = scoreThreshold
 
2
  import cv2 as cv
3
 
4
  class MPPersonDet:
5
+ def __init__(self, modelPath, nmsThreshold=0.3, scoreThreshold=0.5, topK=5000, backendId=0, targetId=0):
6
  self.model_path = modelPath
7
  self.nms_threshold = nmsThreshold
8
  self.score_threshold = scoreThreshold