pyppbox 3.7b1__tar.gz → 3.8b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. {pyppbox-3.7b1/pyppbox.egg-info → pyppbox-3.8b1}/PKG-INFO +13 -2
  2. {pyppbox-3.7b1 → pyppbox-3.8b1}/RELEASENOTES.md +9 -1
  3. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/__init__.py +1 -1
  4. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/configtools.py +13 -18
  5. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/myconfig.py +41 -54
  6. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/detectors/yolocls/__init__.py +4 -8
  7. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/detectors/yoloult/__init__.py +27 -38
  8. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/reiders/facenet/__init__.py +5 -8
  9. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/reiders/torchreid/__init__.py +7 -7
  10. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/reiders/torchreid/utils.py +2 -5
  11. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/centroid/__init__.py +1 -2
  12. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/__init__.py +1 -2
  13. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/sort/__init__.py +1 -2
  14. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/ppb/mt.py +62 -72
  15. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/standalone/__init__.py +10 -11
  16. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/utils/evatools.py +59 -82
  17. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/utils/gttools.py +5 -7
  18. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/utils/persontools.py +1 -2
  19. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/utils/restools.py +23 -39
  20. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/utils/visualizetools.py +38 -43
  21. {pyppbox-3.7b1 → pyppbox-3.8b1/pyppbox.egg-info}/PKG-INFO +13 -2
  22. {pyppbox-3.7b1 → pyppbox-3.8b1}/requirements/test_gpu.py +7 -7
  23. {pyppbox-3.7b1 → pyppbox-3.8b1}/GETSTARTED.md +0 -0
  24. {pyppbox-3.7b1 → pyppbox-3.8b1}/LICENSE +0 -0
  25. {pyppbox-3.7b1 → pyppbox-3.8b1}/MANIFEST.in +0 -0
  26. {pyppbox-3.7b1 → pyppbox-3.8b1}/README.md +0 -0
  27. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/__init__.py +0 -0
  28. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/cfg/cfg.zip +0 -0
  29. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/cfg/detectors.yaml +0 -0
  30. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/cfg/main.yaml +0 -0
  31. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/cfg/reiders.yaml +0 -0
  32. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/cfg/trackers.yaml +0 -0
  33. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/strings/strings.yaml +0 -0
  34. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/strings/strings.zip +0 -0
  35. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/config/unifiedstrings.py +0 -0
  36. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/data/datasets/.gitignore +0 -0
  37. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/data/logs/.gitignore +0 -0
  38. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/data/modules/.gitignore +0 -0
  39. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/data/res/.gitignore +0 -0
  40. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/data/res/idmap.txt +0 -0
  41. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/__init__.py +0 -0
  42. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/assets/TReID.png +0 -0
  43. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/assets/icon.ico +0 -0
  44. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/assets/settings.ico +0 -0
  45. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/guidemo.py +0 -0
  46. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/guihub.py +0 -0
  47. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/guitools.py +0 -0
  48. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/tmp/input.tmp +0 -0
  49. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/tmp/ui.tmp +0 -0
  50. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/ui_centroid.py +0 -0
  51. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/ui_deepsort.py +0 -0
  52. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/ui_facenet.py +0 -0
  53. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/ui_gt.py +0 -0
  54. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/ui_launcher.py +0 -0
  55. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/ui_sort.py +0 -0
  56. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/ui_torchreid.py +0 -0
  57. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/ui_yolocls.py +0 -0
  58. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/gui/ui_yoloult.py +0 -0
  59. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/__init__.py +0 -0
  60. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/detectors/__init__.py +0 -0
  61. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/reiders/__init__.py +0 -0
  62. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/reiders/facenet/origin/align_dataset_mtcnn.py +0 -0
  63. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/reiders/facenet/origin/detect_face.py +0 -0
  64. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/reiders/facenet/origin/facenet.py +0 -0
  65. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/reiders/torchreid/model_dict.py +0 -0
  66. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/reiders/torchreid/model_dict.yaml +0 -0
  67. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/__init__.py +0 -0
  68. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/detection.py +0 -0
  69. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/detection_yolo.py +0 -0
  70. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/generate_detections.py +0 -0
  71. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/iou_matching.py +0 -0
  72. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/kalman_filter.py +0 -0
  73. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/linear_assignment.py +0 -0
  74. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/nn_matching.py +0 -0
  75. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/preprocessing.py +0 -0
  76. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/track.py +0 -0
  77. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/tracker.py +0 -0
  78. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/deepsort/origin/voc_classes.txt +0 -0
  79. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/modules/trackers/sort/origin/sort.py +0 -0
  80. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/ppb/__init__.py +0 -0
  81. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/utils/__init__.py +0 -0
  82. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/utils/commontools.py +0 -0
  83. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/utils/logtools.py +0 -0
  84. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox/utils/mot2pyppbox.py +0 -0
  85. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox.egg-info/SOURCES.txt +0 -0
  86. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox.egg-info/dependency_links.txt +0 -0
  87. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox.egg-info/requires.txt +0 -0
  88. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyppbox.egg-info/top_level.txt +0 -0
  89. {pyppbox-3.7b1 → pyppbox-3.8b1}/pyproject.toml +0 -0
  90. {pyppbox-3.7b1 → pyppbox-3.8b1}/requirements/README.md +0 -0
  91. {pyppbox-3.7b1 → pyppbox-3.8b1}/requirements/requirements.txt +0 -0
  92. {pyppbox-3.7b1 → pyppbox-3.8b1}/setup.cfg +0 -0
  93. {pyppbox-3.7b1 → pyppbox-3.8b1}/setup.py +0 -0
  94. {pyppbox-3.7b1 → pyppbox-3.8b1}/setup_extra.yaml +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: pyppbox
3
- Version: 3.7b1
3
+ Version: 3.8b1
4
4
  Summary: Toolbox for people detecting, tracking, and re-identifying.
5
5
  Home-page: https://github.com/rathaumons/pyppbox
6
6
  Author: Ratha SIV
@@ -57,6 +57,17 @@ Requires-Dist: PyQt6
57
57
  Requires-Dist: sfps
58
58
  Requires-Dist: pyppbox-torchreid
59
59
  Requires-Dist: vsensebox-ultralytics>=8.3.5
60
+ Dynamic: author
61
+ Dynamic: classifier
62
+ Dynamic: description
63
+ Dynamic: description-content-type
64
+ Dynamic: home-page
65
+ Dynamic: keywords
66
+ Dynamic: license
67
+ Dynamic: maintainer
68
+ Dynamic: requires-dist
69
+ Dynamic: requires-python
70
+ Dynamic: summary
60
71
 
61
72
  # 🐍📦 [**pyppbox**](https://github.com/rathaumons/pyppbox)
62
73
 
@@ -12,7 +12,15 @@
12
12
 
13
13
  ## **pyppbox V3 - Make Simpler and Faster**
14
14
 
15
- * `pyppbox` [v3.7b1](https://github.com/rathaumons/pyppbox/tree/v3.7b1) - The Last V3
15
+ * `pyppbox` [v3.8b1](https://github.com/rathaumons/pyppbox/tree/v3.8b1) - The Last V3
16
+
17
+ - Add `show_footnote` option to `visualizePeople()`
18
+ - Optimize and enhance general performance
19
+ - Correct typos and improve documentation
20
+ - **Known issue/limitation**:
21
+ - You tell me :)
22
+
23
+ * `pyppbox` [v3.7b1](https://github.com/rathaumons/pyppbox/tree/v3.7b1) - ~~The Last V3~~
16
24
 
17
25
  - Sync `pyppbox.utils.persontools.Person`'s misc across frames in all trackers
18
26
  - Improve and add `--use-numid` for using number id in MOT as the real id in `pyppbox` format
@@ -47,7 +47,7 @@ from pyppbox.gui.guitools import (
47
47
  )
48
48
 
49
49
 
50
- __version__ = '3.7b1'
50
+ __version__ = '3.8b1'
51
51
  __author__ = 'Ratha SIV'
52
52
  __description__ = 'Toolbox for people detecting, tracking, and re-identifying.'
53
53
  __homepage__ = 'https://rathaumons.github.io/pyppbox'
@@ -24,8 +24,7 @@ import yaml
24
24
  from yaml.loader import SafeLoader
25
25
 
26
26
  from .unifiedstrings import UnifiedStrings
27
- from pyppbox.utils.commontools import (joinFPathFull, getAbsPathFDS,
28
- getGlobalRootDir, isExist)
27
+ from pyppbox.utils.commontools import joinFPathFull, getAbsPathFDS, getGlobalRootDir, isExist
29
28
  from pyppbox.utils.logtools import add_warning_log, add_error_log
30
29
 
31
30
 
@@ -81,10 +80,8 @@ class PYPPBOXStructure(object):
81
80
  """
82
81
  if cfg_dir != internal_cfg_dir:
83
82
  if not isExist(cfg_dir):
84
- add_warning_log("PYPPBOXStructure : __init__() -> cfg_dir='" +
85
- str(cfg_dir) + "' does not exist.")
86
- add_warning_log("PYPPBOXStructure : __init__() -> " +
87
- "Switched to internal cfg directory !")
83
+ add_warning_log(f"PYPPBOXStructure : __init__() -> cfg_dir='{cfg_dir}' does not exist.")
84
+ add_warning_log("PYPPBOXStructure : __init__() -> Switched to internal cfg directory !")
88
85
  cfg_dir = internal_cfg_dir
89
86
  self.cfg_dir = cfg_dir
90
87
  self.internal_root_dir = internal_root_dir
@@ -125,10 +122,8 @@ class PYPPBOXStructure(object):
125
122
  A path of the config directory.
126
123
  """
127
124
  if not isExist(cfg_dir):
128
- add_warning_log("PYPPBOXStructure : setCustomCFG() -> cfg_dir='"
129
- + str(cfg_dir) + "' does not exist.")
130
- add_warning_log("PYPPBOXStructure : setCustomCFG() -> " +
131
- "Switched to internal cfg directory !")
125
+ add_warning_log(f"PYPPBOXStructure : setCustomCFG() -> cfg_dir='{cfg_dir}' does not exist.")
126
+ add_warning_log("PYPPBOXStructure : setCustomCFG() -> Switched to internal cfg directory!")
132
127
  cfg_dir = internal_cfg_dir
133
128
  self.cfg_dir = cfg_dir
134
129
  self.setYAMLPath()
@@ -237,11 +232,11 @@ def loadDocument(yaml_json):
237
232
  elif '.yaml' in yaml_json.lower():
238
233
  document = yaml.load(cfg, Loader=SafeLoader)
239
234
  except ValueError as e:
240
- msg = 'loadDocument() -> ' + str(e)
235
+ msg = f'loadDocument() -> {e}'
241
236
  add_error_log(msg)
242
237
  raise ValueError(msg)
243
238
  else:
244
- msg = "loadDocument() -> " + str(yaml_json) + "' does not exist!"
239
+ msg = f"loadDocument() -> '{yaml_json}' does not exist!"
245
240
  add_error_log(msg)
246
241
  raise ValueError(msg)
247
242
  return document
@@ -268,13 +263,13 @@ def loadListDocument(yaml_json):
268
263
  elif '.yaml' in yaml_json.lower():
269
264
  docs = yaml.load_all(cfg, Loader=SafeLoader)
270
265
  except ValueError as e:
271
- msg = 'loadListDocument() -> ' + str(e)
266
+ msg = f'loadListDocument() -> {e}'
272
267
  add_error_log(msg)
273
268
  raise ValueError(msg)
274
269
  for doc in docs:
275
270
  document_list.append(doc)
276
271
  else:
277
- msg = "loadListDocument() -> " + str(yaml_json) + "' does not exist!"
272
+ msg = f"loadListDocument() -> '{yaml_json}' does not exist!"
278
273
  add_error_log(msg)
279
274
  raise ValueError(msg)
280
275
  return document_list
@@ -299,7 +294,7 @@ def loadRawYAMLString(raw_string):
299
294
  d = yaml.load(raw_string, Loader=SafeLoader)
300
295
  document = next(iter(d))
301
296
  except ValueError as e:
302
- msg = 'loadRawYAMLString() -> ' + str(e)
297
+ msg = f'loadRawYAMLString() -> {e}'
303
298
  add_error_log(msg)
304
299
  raise ValueError(msg)
305
300
  return document
@@ -324,7 +319,7 @@ def loadRawYAMLStringMT(raw_string):
324
319
  for d in ds:
325
320
  document_list.append(d)
326
321
  except ValueError as e:
327
- msg = 'loadRawYAMLStringMT() -> ' + str(e)
322
+ msg = f'loadRawYAMLStringMT() -> {e}'
328
323
  add_error_log(msg)
329
324
  raise ValueError(msg)
330
325
  return document_list
@@ -348,7 +343,7 @@ def dumpDocDict(output_file, doc, header):
348
343
  for key, value in doc.items():
349
344
  dumping.write('%s: %s\n' % (key, value))
350
345
  except ValueError as e:
351
- msg = 'dumpDocDict() -> ' + str(e)
346
+ msg = f'dumpDocDict() -> {e}'
352
347
  add_error_log(msg)
353
348
  raise ValueError(msg)
354
349
 
@@ -375,7 +370,7 @@ def dumpListDocDict(output_file, doc_list, header):
375
370
  dumping.write("---\n")
376
371
  sep_index += 1
377
372
  except ValueError as e:
378
- msg = 'dumpListDocDict() -> ' + str(e)
373
+ msg = f'dumpListDocDict() -> {e}'
379
374
  add_error_log(msg)
380
375
  raise ValueError(msg)
381
376
 
@@ -130,7 +130,7 @@ class NoneCFG(BaseCGF):
130
130
  Parameters
131
131
  ----------
132
132
  input : any
133
- A parameter to be overwritten to a unified string of :code:`"None"`.
133
+ A parameter to be overrided with a unified string of :code:`"None"`.
134
134
  """
135
135
  input = "None"
136
136
  self.dt_name = self.unified_strings.getUnifiedFormat(input)
@@ -173,7 +173,7 @@ class MainCFG(BaseCGF):
173
173
  self.reider = self.unified_strings.getUnifiedFormat(self.configs['reider'])
174
174
  self.configs = self.getDocument()
175
175
  except Exception as e:
176
- msg = "MainCFG : set() -> " + str(e)
176
+ msg = f"MainCFG : set() -> {e}"
177
177
  add_error_log(msg)
178
178
  raise ValueError(msg)
179
179
  else:
@@ -264,18 +264,15 @@ class DCFGYOLOCLS(BaseCGF):
264
264
  self.dt_name = self.unified_strings.getUnifiedFormat(self.configs['dt_name'])
265
265
  self.nms = self.configs['nms']
266
266
  self.conf = self.configs['conf']
267
- self.class_file = getAdaptiveAbsPathFDS(self.from_dir,
268
- self.configs['class_file'])
269
- self.model_cfg_file = getAdaptiveAbsPathFDS(self.from_dir,
270
- self.configs['model_cfg_file'])
271
- self.model_weights = getAdaptiveAbsPathFDS(self.from_dir,
272
- self.configs['model_weights'])
267
+ self.class_file = getAdaptiveAbsPathFDS(self.from_dir, self.configs['class_file'])
268
+ self.model_cfg_file = getAdaptiveAbsPathFDS(self.from_dir, self.configs['model_cfg_file'])
269
+ self.model_weights = getAdaptiveAbsPathFDS(self.from_dir, self.configs['model_weights'])
273
270
  self.model_image_size = self.configs['model_image_size']
274
271
  self.model_resolution = (self.model_image_size, self.model_image_size)
275
272
  self.repspoint_calibration = self.configs['repspoint_calibration']
276
273
  self.configs = self.getDocument()
277
274
  except Exception as e:
278
- msg = "DCFGYOLOCLS : set() -> " + str(e)
275
+ msg = f"DCFGYOLOCLS : set() -> {e}"
279
276
  add_error_log(msg)
280
277
  raise ValueError(msg)
281
278
  else:
@@ -376,12 +373,11 @@ class DCFGYOLOULT(BaseCGF):
376
373
  self.device = self.configs['device']
377
374
  self.max_det = self.configs['max_det']
378
375
  self.line_width = self.configs['line_width']
379
- self.model_file = getAdaptiveAbsPathFDS(self.from_dir,
380
- self.configs['model_file'])
376
+ self.model_file = getAdaptiveAbsPathFDS(self.from_dir, self.configs['model_file'])
381
377
  self.repspoint_calibration = self.configs['repspoint_calibration']
382
378
  self.configs = self.getDocument()
383
379
  except Exception as e:
384
- msg = "DCFGYOLOULT : set() -> " + str(e)
380
+ msg = f"DCFGYOLOULT : set() -> {e}"
385
381
  add_error_log(msg)
386
382
  raise ValueError(msg)
387
383
  else:
@@ -467,7 +463,7 @@ class DCFGGT(BaseCGF):
467
463
  self.gt_map_file = getAdaptiveAbsPathFDS(self.from_dir, self.configs['gt_map_file'])
468
464
  self.configs = self.getDocument()
469
465
  except Exception as e:
470
- msg = "DCFGGT : set() -> " + str(e)
466
+ msg = f"DCFGGT : set() -> {e}"
471
467
  add_error_log(msg)
472
468
  raise ValueError(msg)
473
469
  else:
@@ -520,7 +516,7 @@ class TCFGCentroid(BaseCGF):
520
516
  self.max_spread = self.configs['max_spread']
521
517
  self.configs = self.getDocument()
522
518
  except Exception as e:
523
- msg = "TCFGCentroid : set() -> " + str(e)
519
+ msg = f"TCFGCentroid : set() -> {e}"
524
520
  add_error_log(msg)
525
521
  raise ValueError(msg)
526
522
  else:
@@ -577,7 +573,7 @@ class TCFGSORT(BaseCGF):
577
573
  self.iou_threshold = self.configs['iou_threshold']
578
574
  self.configs = self.getDocument()
579
575
  except Exception as e:
580
- msg = "TCFGSORT : set() -> " + str(e)
576
+ msg = f"TCFGSORT : set() -> {e}"
581
577
  add_error_log(msg)
582
578
  raise ValueError(msg)
583
579
  else:
@@ -663,7 +659,7 @@ class TCFGDeepSORT(BaseCGF):
663
659
  self.model_file = getAdaptiveAbsPathFDS(self.from_dir, self.configs['model_file'])
664
660
  self.configs = self.getDocument()
665
661
  except Exception as e:
666
- msg = "TCFGDeepSORT : set() -> " + str(e)
662
+ msg = f"TCFGDeepSORT : set() -> {e}"
667
663
  add_error_log(msg)
668
664
  raise ValueError(msg)
669
665
  else:
@@ -772,7 +768,7 @@ class RCFGFaceNet(BaseCGF):
772
768
  self.yl_w_calibration = self.configs['yl_w_calibration']
773
769
  self.configs = self.getDocument()
774
770
  except Exception as e:
775
- msg = "RCFGFaceNet : set() -> " + str(e)
771
+ msg = f"RCFGFaceNet : set() -> {e}"
776
772
  add_error_log(msg)
777
773
  raise ValueError(msg)
778
774
  else:
@@ -873,13 +869,10 @@ class RCFGTorchreid(BaseCGF):
873
869
  try:
874
870
  from pyppbox.modules.reiders.torchreid.model_dict import TorchreidModelDict
875
871
  self.ri_name = self.unified_strings.getUnifiedFormat(self.configs['ri_name'])
876
- self.classifier_pkl = getAdaptiveAbsPathFDS(self.from_dir,
877
- self.configs['classifier_pkl'])
878
- self.train_data = getAdaptiveAbsPathFDS(self.from_dir,
879
- self.configs['train_data'])
872
+ self.classifier_pkl = getAdaptiveAbsPathFDS(self.from_dir, self.configs['classifier_pkl'])
873
+ self.train_data = getAdaptiveAbsPathFDS(self.from_dir, self.configs['train_data'])
880
874
  self.model_name = self.configs['model_name']
881
- self.model_path = getAdaptiveAbsPathFDS(self.from_dir,
882
- self.configs['model_path'])
875
+ self.model_path = getAdaptiveAbsPathFDS(self.from_dir, self.configs['model_path'])
883
876
  self.min_confidence = self.configs['min_confidence']
884
877
  self.device = self.configs['device']
885
878
  self.configs = self.getDocument()
@@ -890,7 +883,7 @@ class RCFGTorchreid(BaseCGF):
890
883
  self.model_dict = TorchreidModelDict()
891
884
  self.model_wh = self.model_dict.getWH(getFileName(self.model_path))
892
885
  except Exception as e:
893
- msg = "RCFGTorchreid : set() -> " + str(e)
886
+ msg = f"RCFGTorchreid : set() -> {e}"
894
887
  add_error_log(msg)
895
888
  raise ValueError(msg)
896
889
  else:
@@ -1152,7 +1145,7 @@ class MyConfigurator(PYPPBOXStructure):
1152
1145
  ----------
1153
1146
  main_yaml : str or dict, default=None
1154
1147
  A YAML/JSON file path, or a raw/ready dictionary of the main configurations
1155
- or main.yaml. This :obj:`main_yaml` helps overwrite the original one configured
1148
+ or main.yaml. This :obj:`main_yaml` helps override the original one configured
1156
1149
  during the :meth:`__init__()`.
1157
1150
  Leave it as default :code:`main_yaml=None`, to load and set according to the
1158
1151
  configurations inside config directory :attr:`cfg_dir` set in the :meth:`__init__()`.
@@ -1170,7 +1163,7 @@ class MyConfigurator(PYPPBOXStructure):
1170
1163
  ----------
1171
1164
  main_yaml : str or dict, default=None
1172
1165
  A YAML/JSON file path, or a raw/ready dictionary of the main configurations
1173
- or main.yaml. This :obj:`main_yaml` helps overwrite the original one configured
1166
+ or main.yaml. This :obj:`main_yaml` helps override the original one configured
1174
1167
  during the :meth:`__init__()`.
1175
1168
  Leave it as default :code:`main_yaml=None`, to load and set according to the
1176
1169
  configurations inside config directory :attr:`cfg_dir` set in the :meth:`__init__()`.
@@ -1202,7 +1195,7 @@ class MyConfigurator(PYPPBOXStructure):
1202
1195
  ----------
1203
1196
  detectors_yaml : str or dict, default=None
1204
1197
  A YAML/JSON file path, or a raw/ready dictionary of the detectors' configurations
1205
- or detectors.yaml. This :obj:`detectors_yaml` helps overwrite the original one
1198
+ or detectors.yaml. This :obj:`detectors_yaml` helps override the original one
1206
1199
  configured during the :meth:`__init__()`.
1207
1200
  Leave it as default :code:`detectors_yaml=None`, to load and set according to the
1208
1201
  configurations inside config directory :attr:`cfg_dir` set in the :meth:`__init__()`.
@@ -1210,7 +1203,7 @@ class MyConfigurator(PYPPBOXStructure):
1210
1203
  An indication of whether the paths inside your configuration file are relative
1211
1204
  to :code:`{pyppbox root}` or not. This indication or behavior was automatically
1212
1205
  decided during the :meth:`__init__()`, and you don't need to set or change it
1213
- unless you set :obj:`detectors_yaml` to overwrite the original configurations. If
1206
+ unless you set :obj:`detectors_yaml` to override the original configurations. If
1214
1207
  all the paths inside your configuration file have full absolute paths, setting
1215
1208
  :obj:`relative_to_pyppbox_root` is optional.
1216
1209
  """
@@ -1232,7 +1225,7 @@ class MyConfigurator(PYPPBOXStructure):
1232
1225
  if d['dt_name'].lower() == self.unified_strings.gt:
1233
1226
  self.dcfg_gt.set(d)
1234
1227
  except Exception as e:
1235
- msg = "MyConfigurator : setGTCFG() -> " + str(e)
1228
+ msg = f"MyConfigurator : setGTCFG() -> {e}"
1236
1229
  add_error_log(msg)
1237
1230
  raise ValueError(msg)
1238
1231
 
@@ -1243,7 +1236,7 @@ class MyConfigurator(PYPPBOXStructure):
1243
1236
  ----------
1244
1237
  detectors_yaml : str or dict, default=None
1245
1238
  A YAML/JSON file path, or a raw/ready dictionary of the detectors' configurations
1246
- or detectors.yaml. This :obj:`detectors_yaml` helps overwrite the original one
1239
+ or detectors.yaml. This :obj:`detectors_yaml` helps override the original one
1247
1240
  configured during the :meth:`__init__()`.
1248
1241
  Leave it as default :code:`detectors_yaml=None`, to load and set according to the
1249
1242
  configurations inside config directory :attr:`cfg_dir` set in the :meth:`__init__()`.
@@ -1251,7 +1244,7 @@ class MyConfigurator(PYPPBOXStructure):
1251
1244
  An indication of whether the paths inside your configuration file are relative
1252
1245
  to :code:`{pyppbox root}` or not. This indication or behavior was automatically
1253
1246
  decided during the :meth:`__init__()`, and you don't need to set or change it
1254
- unless you set :obj:`detectors_yaml` to overwrite the original configurations. If
1247
+ unless you set :obj:`detectors_yaml` to override the original configurations. If
1255
1248
  all the paths inside your configuration file have full absolute paths, setting
1256
1249
  :obj:`relative_to_pyppbox_root` is optional.
1257
1250
  """
@@ -1285,11 +1278,10 @@ class MyConfigurator(PYPPBOXStructure):
1285
1278
  self.dcfg_gt.set(d)
1286
1279
  self.dt_map.append(self.dcfg_gt.dt_name)
1287
1280
  else:
1288
- msg = ("MyConfigurator : setAllDCFG() -> Name '" +
1289
- str(d['dt_name']) + "' is not supported.")
1281
+ msg = f"MyConfigurator : setAllDCFG() -> Name '{d['dt_name']}' is not supported."
1290
1282
  add_warning_log(msg)
1291
1283
  except Exception as e:
1292
- msg = "MyConfigurator : setAllDCFG() -> " + str(e)
1284
+ msg = f"MyConfigurator : setAllDCFG() -> {e}"
1293
1285
  add_error_log(msg)
1294
1286
  raise ValueError(msg)
1295
1287
 
@@ -1300,7 +1292,7 @@ class MyConfigurator(PYPPBOXStructure):
1300
1292
  ----------
1301
1293
  trackers_yaml : str or dict, default=None
1302
1294
  A YAML/JSON file path, or a raw/ready dictionary of the trackers' configurations
1303
- or trackers.yaml. This :obj:`trackers_yaml` helps overwrite the original one
1295
+ or trackers.yaml. This :obj:`trackers_yaml` helps override the original one
1304
1296
  configured during the :meth:`__init__()`.
1305
1297
  Leave it as default :code:`trackers_yaml=None`, to load and set according to the
1306
1298
  configurations inside config directory :attr:`cfg_dir` set in the :meth:`__init__()`.
@@ -1308,7 +1300,7 @@ class MyConfigurator(PYPPBOXStructure):
1308
1300
  An indication of whether the paths inside your configuration file are relative
1309
1301
  to :code:`{pyppbox root}` or not. This indication or behavior was automatically
1310
1302
  decided during the :meth:`__init__()`, and you don't need to set or change it
1311
- unless you set :obj:`trackers_yaml` to overwrite the original configurations. If
1303
+ unless you set :obj:`trackers_yaml` to override the original configurations. If
1312
1304
  all the paths inside your configuration file have full absolute paths, setting
1313
1305
  :obj:`relative_to_pyppbox_root` is optional.
1314
1306
  """
@@ -1341,11 +1333,10 @@ class MyConfigurator(PYPPBOXStructure):
1341
1333
  self.tcfg_deepsort.set(d)
1342
1334
  self.tk_map.append(self.tcfg_deepsort.tk_name)
1343
1335
  else:
1344
- msg = ("MyConfigurator : setAllTCFG() -> Name '" +
1345
- str(d['dt_name']) + "' is not supported.")
1336
+ msg = f"MyConfigurator : setAllTCFG() -> Name '{d['dt_name']}' is not supported."
1346
1337
  add_warning_log(msg)
1347
1338
  except Exception as e:
1348
- msg = "MyConfigurator : setAllTCFG() -> " + str(e)
1339
+ msg = f"MyConfigurator : setAllTCFG() -> {e}"
1349
1340
  add_error_log(msg)
1350
1341
  raise ValueError(msg)
1351
1342
 
@@ -1356,7 +1347,7 @@ class MyConfigurator(PYPPBOXStructure):
1356
1347
  ----------
1357
1348
  reiders_yaml : str or dict, default=None
1358
1349
  A YAML/JSON file path, or a raw/ready dictionary of the reiders' configurations or
1359
- reiders.yaml. This :obj:`reiders_yaml` helps overwrite the original one configured
1350
+ reiders.yaml. This :obj:`reiders_yaml` helps override the original one configured
1360
1351
  during the :meth:`__init__()`.
1361
1352
  Leave it as default :code:`reiders_yaml=None`, to load and set according to the
1362
1353
  configurations inside config directory :attr:`cfg_dir` set in the :meth:`__init__()`.
@@ -1364,7 +1355,7 @@ class MyConfigurator(PYPPBOXStructure):
1364
1355
  An indication of whether the paths inside your configuration file are relative
1365
1356
  to :code:`{pyppbox root}` or not. This indication or behavior was automatically
1366
1357
  decided during the :meth:`__init__()`, and you don't need to set or change it
1367
- unless you set :obj:`reiders_yaml` to overwrite the original configurations. If
1358
+ unless you set :obj:`reiders_yaml` to override the original configurations. If
1368
1359
  all the paths inside your configuration file have full absolute paths, setting
1369
1360
  :obj:`relative_to_pyppbox_root` is optional.
1370
1361
  """
@@ -1393,15 +1384,14 @@ class MyConfigurator(PYPPBOXStructure):
1393
1384
  self.rcfg_torchreid.set(d)
1394
1385
  self.ri_map.append(self.rcfg_torchreid.ri_name)
1395
1386
  else:
1396
- msg = ("MyConfigurator : setAllRCFG() -> Name '" +
1397
- str(d['dt_name']) + "' is not supported.")
1387
+ msg = f"MyConfigurator : setAllRCFG() -> Name '{d['dt_name']}' is not supported."
1398
1388
  add_warning_log(msg)
1399
1389
  except Exception as e:
1400
- raise ValueError("MyConfigurator : setAllRCFG() -> " + str(e))
1390
+ raise ValueError(f"MyConfigurator : setAllRCFG() -> {e}")
1401
1391
 
1402
1392
  def setASupportedModuleCFG(self, input_cfg, relative_to_pyppbox_root=False):
1403
1393
  """Load and set configurations for a supported module. Be aware that calling
1404
- this method will overwrite the original or previous configurations.
1394
+ this method will override the original or previous configurations.
1405
1395
 
1406
1396
  Parameters
1407
1397
  ----------
@@ -1426,11 +1416,10 @@ class MyConfigurator(PYPPBOXStructure):
1426
1416
  self.dcfg_gt = DCFGGT(relative_to_pyppbox_root)
1427
1417
  self.dcfg_gt.set(cfg)
1428
1418
  else:
1429
- msg = ("MyConfigurator : setASupportedModuleCFG() -> Name '" +
1430
- str(cfg['dt_name']) + "' is not supported.")
1419
+ msg = f"MyConfigurator : setASupportedModuleCFG() -> Name '{cfg['dt_name']}' is not supported."
1431
1420
  add_warning_log(msg)
1432
1421
  except Exception as e:
1433
- msg = "MyConfigurator : setASupportedModuleCFG() -> " + str(e)
1422
+ msg = f"MyConfigurator : setASupportedModuleCFG() -> {e}"
1434
1423
  add_error_log(msg)
1435
1424
  raise ValueError(msg)
1436
1425
  elif "tk_name" in k_list:
@@ -1445,11 +1434,10 @@ class MyConfigurator(PYPPBOXStructure):
1445
1434
  self.tcfg_deepsort = TCFGDeepSORT(relative_to_pyppbox_root)
1446
1435
  self.tcfg_deepsort.set(cfg)
1447
1436
  else:
1448
- msg = ("MyConfigurator : setASupportedModuleCFG() -> Name '" +
1449
- str(cfg['tk_name']) + "' is not supported.")
1437
+ msg = f"MyConfigurator : setASupportedModuleCFG() -> Name '{cfg['tk_name']}' is not supported."
1450
1438
  add_warning_log(msg)
1451
1439
  except Exception as e:
1452
- msg = "MyConfigurator : setASupportedModuleCFG() -> " + str(e)
1440
+ msg = f"MyConfigurator : setASupportedModuleCFG() -> {e}"
1453
1441
  add_error_log(msg)
1454
1442
  raise ValueError(msg)
1455
1443
  elif "ri_name" in k_list:
@@ -1461,11 +1449,10 @@ class MyConfigurator(PYPPBOXStructure):
1461
1449
  self.rcfg_torchreid = RCFGTorchreid(relative_to_pyppbox_root)
1462
1450
  self.rcfg_torchreid.set(cfg)
1463
1451
  else:
1464
- msg = ("MyConfigurator : setASupportedModuleCFG() -> Name '" +
1465
- str(cfg['ri_name']) + "' is not supported.")
1452
+ msg = f"MyConfigurator : setASupportedModuleCFG() -> Name '{cfg['ri_name']}' is not supported."
1466
1453
  add_warning_log(msg)
1467
1454
  except Exception as e:
1468
- msg = "MyConfigurator : setASupportedModuleCFG() -> " + str(e)
1455
+ msg = f"MyConfigurator : setASupportedModuleCFG() -> {e}"
1469
1456
  add_error_log(msg)
1470
1457
  raise ValueError(msg)
1471
1458
 
@@ -102,10 +102,8 @@ class MyYOLOCLS(object):
102
102
  repspoints.append(repspoint)
103
103
  confs.append(float(conf))
104
104
  if visual:
105
- cv2.circle(img, (repspoint[0], repspoint[1]), radius=5,
106
- color=(0, 0, 255), thickness=-1)
107
- cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]),
108
- (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
105
+ cv2.circle(img, (repspoint[0], repspoint[1]), 5, (0, 0, 255), -1)
106
+ cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]), (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
109
107
  return img, pboxes_xywh, pboxes_xyxy, repspoints, confs
110
108
 
111
109
  def detectPeople(self, img, visual=True, min_width_filter=35, alt_repspoint=False, alt_repspoint_top=True):
@@ -149,8 +147,6 @@ class MyYOLOCLS(object):
149
147
  repspoint=repspoint, det_conf=float(conf)))
150
148
  i += 1
151
149
  if visual:
152
- cv2.circle(img, (repspoint[0], repspoint[1]), radius=5,
153
- color=(0, 0, 255), thickness=-1)
154
- cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]),
155
- (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
150
+ cv2.circle(img, (repspoint[0], repspoint[1]), 5, (0, 0, 255), -1)
151
+ cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]), (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
156
152
  return people, img
@@ -60,6 +60,8 @@ class MyYOLOULT(object):
60
60
  if self.cfg.device.lower() == 'cpu':
61
61
  self.cpu_only = True
62
62
  ignore_this_logger("ultralytics")
63
+ ignore_this_logger("pyppbox-ultralytics")
64
+ ignore_this_logger("vsensebox-ultralytics")
63
65
  if "nas" in self.cfg.model_file:
64
66
  # YOLO NAS isn't stable yet :/
65
67
  from ultralytics import NAS
@@ -67,12 +69,13 @@ class MyYOLOULT(object):
67
69
  else:
68
70
  from ultralytics import YOLO
69
71
  self.model = YOLO(self.cfg.model_file)
70
- from ultralytics.utils.plotting import Colors
71
- self.colors = Colors()
72
- self.skeleton = [[16, 14], [14, 12], [17, 15], [15, 13],
73
- [12, 13], [6, 12], [7, 13], [6, 7], [6, 8],
74
- [7, 9], [8, 10], [9, 11], [2, 3], [1, 2],
75
- [1, 3], [2, 4], [3, 5], [4, 6], [5, 7]]
72
+ if "pose" in self.cfg.model_file.lower():
73
+ from ultralytics.utils.plotting import Colors
74
+ self.colors = Colors()
75
+ self.kpt_color = Colors().pose_palette[[16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9]]
76
+ self.limb_color = Colors().pose_palette[[9, 9, 9, 9, 7, 7, 7, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16]]
77
+ self.skeleton = [[16, 14], [14, 12], [17, 15], [15, 13], [12, 13], [6, 12], [7, 13], [6, 7], [6, 8],
78
+ [7, 9], [8, 10], [9, 11], [2, 3], [1, 2], [1, 3], [2, 4], [3, 5], [4, 6], [5, 7]]
76
79
 
77
80
  def __kpts__(self, img, kpts, radius=5, kpt_line=True):
78
81
  # Internal function
@@ -81,23 +84,17 @@ class MyYOLOULT(object):
81
84
  nkpt, ndim = kpts.shape
82
85
  is_pose = nkpt == 17 and ndim == 3
83
86
  kpt_line &= is_pose
84
- kpt_color = self.colors.pose_palette[[16, 16, 16, 16, 16, 0, 0,
85
- 0, 0, 0, 0, 9, 9, 9, 9, 9, 9]]
86
87
  for i, k in enumerate(kpts):
87
- color_k = [int(x) for x in kpt_color[i]
88
- ] if is_pose else self.colors(i)
88
+ color_k = [int(x) for x in self.kpt_color[i]] if is_pose else self.colors(i)
89
89
  x_coord, y_coord = k[0], k[1]
90
90
  if x_coord % shape[1] != 0 and y_coord % shape[0] != 0:
91
91
  if len(k) == 3:
92
92
  conf = k[2]
93
93
  if conf < 0.5:
94
94
  continue
95
- cv2.circle(img, (int(x_coord), int(y_coord)),
96
- radius, color_k, -1, lineType=cv2.LINE_AA)
95
+ cv2.circle(img, (int(x_coord), int(y_coord)),radius, color_k, -1, lineType=cv2.LINE_AA)
97
96
  if kpt_line:
98
97
  ndim = kpts.shape[-1]
99
- limb_color = self.colors.pose_palette[[9, 9, 9, 9, 7, 7, 7, 0, 0, 0,
100
- 0, 0, 16, 16, 16, 16, 16, 16, 16]]
101
98
  for i, sk in enumerate(self.skeleton):
102
99
  pos1 = (int(kpts[(sk[0] - 1), 0]), int(kpts[(sk[0] - 1), 1]))
103
100
  pos2 = (int(kpts[(sk[1] - 1), 0]), int(kpts[(sk[1] - 1), 1]))
@@ -106,14 +103,12 @@ class MyYOLOULT(object):
106
103
  conf2 = kpts[(sk[1] - 1), 2]
107
104
  if conf1 < 0.5 or conf2 < 0.5:
108
105
  continue
109
- if (pos1[0] % shape[1] == 0 or pos1[1] % shape[0] == 0 or
110
- pos1[0] < 0 or pos1[1] < 0):
106
+ if (pos1[0] % shape[1] == 0 or pos1[1] % shape[0] == 0 or pos1[0] < 0 or pos1[1] < 0):
111
107
  continue
112
- if (pos2[0] % shape[1] == 0 or pos2[1] % shape[0] == 0 or
113
- pos2[0] < 0 or pos2[1] < 0):
108
+ if (pos2[0] % shape[1] == 0 or pos2[1] % shape[0] == 0 or pos2[0] < 0 or pos2[1] < 0):
114
109
  continue
115
- cv2.line(img, pos1, pos2, [int(x) for x in limb_color[i]],
116
- thickness=2, lineType=cv2.LINE_AA)
110
+ cv2.line(img, pos1, pos2, [int(x) for x in self.limb_color[i]], thickness=2, lineType=cv2.LINE_AA)
111
+
117
112
 
118
113
  def detect(self, img, visual=True, classes=0, min_width_filter=35):
119
114
  """Detect general object with object's class filter :obj:`class_filter`
@@ -170,7 +165,8 @@ class MyYOLOULT(object):
170
165
  dt_confidences = numpy_dets.boxes.conf
171
166
  dt_keypoints = dets[0].keypoints
172
167
  if dt_keypoints is not None:
173
- for box_xyxy, conf, kp in zip(dt_boxes_xyxy, dt_confidences, reversed(dt_keypoints)):
168
+ rev_dt_kps = reversed(dt_keypoints)
169
+ for box_xyxy, conf, kp in zip(dt_boxes_xyxy, dt_confidences, rev_dt_kps):
174
170
  box_xyxy = box_xyxy.astype(int)
175
171
  box_xywh = to_xywh(box_xyxy)
176
172
  if box_xywh[2] >= min_width_filter:
@@ -182,10 +178,8 @@ class MyYOLOULT(object):
182
178
  keypoints.append(keypoint)
183
179
  confs.append(float(conf))
184
180
  if visual:
185
- cv2.circle(img, (repspoint[0], repspoint[1]),
186
- radius=5, color=(0, 0, 255), thickness=-1)
187
- cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]),
188
- (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
181
+ cv2.circle(img, (repspoint[0], repspoint[1]), 5, (0, 0, 255), -1)
182
+ cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]), (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
189
183
  self.__kpts__(img, keypoint, kpt_line=True)
190
184
  elif len(dt_boxes_xyxy) > 0:
191
185
  for box_xyxy, conf in zip(dt_boxes_xyxy, dt_confidences):
@@ -198,10 +192,8 @@ class MyYOLOULT(object):
198
192
  repspoints.append(repspoint)
199
193
  confs.append(float(conf))
200
194
  if visual:
201
- cv2.circle(img, (repspoint[0], repspoint[1]),
202
- radius=5, color=(0, 0, 255), thickness=-1)
203
- cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]),
204
- (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
195
+ cv2.circle(img, (repspoint[0], repspoint[1]), 5, (0, 0, 255), -1)
196
+ cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]), (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
205
197
  return img, pboxes_xywh, pboxes_xyxy, repspoints, keypoints, confs
206
198
 
207
199
  def detectPeople(self, img, visual=True, min_width_filter=35, alt_repspoint=False, alt_repspoint_top=True):
@@ -249,7 +241,8 @@ class MyYOLOULT(object):
249
241
  dt_keypoints = dets[0].keypoints
250
242
  if dt_keypoints is not None:
251
243
  i = 0
252
- for box_xyxy, conf, kp in zip(dt_boxes_xyxy, dt_confidences, reversed(dt_keypoints)):
244
+ rev_dt_kps = reversed(dt_keypoints)
245
+ for box_xyxy, conf, kp in zip(dt_boxes_xyxy, dt_confidences, rev_dt_kps):
253
246
  box_xyxy = box_xyxy.astype(int)
254
247
  box_xywh = to_xywh(box_xyxy)
255
248
  if box_xywh[2] >= min_width_filter:
@@ -260,10 +253,8 @@ class MyYOLOULT(object):
260
253
  keypoints=keypoint, repspoint=repspoint, det_conf=float(conf)))
261
254
  i += 1
262
255
  if visual:
263
- cv2.circle(img, (repspoint[0], repspoint[1]),
264
- radius=5, color=(0, 0, 255), thickness=-1)
265
- cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]),
266
- (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
256
+ cv2.circle(img, (repspoint[0], repspoint[1]), 5, (0, 0, 255), -1)
257
+ cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]), (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
267
258
  self.__kpts__(img, keypoint, kpt_line=True)
268
259
  elif len(dt_boxes_xyxy) > 0:
269
260
  i = 0
@@ -277,8 +268,6 @@ class MyYOLOULT(object):
277
268
  repspoint=repspoint, det_conf=float(conf)))
278
269
  i += 1
279
270
  if visual:
280
- cv2.circle(img, (repspoint[0], repspoint[1]),
281
- radius=5, color=(0, 0, 255), thickness=-1)
282
- cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]),
283
- (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
271
+ cv2.circle(img, (repspoint[0], repspoint[1]), 5, (0, 0, 255), -1)
272
+ cv2.rectangle(img, (box_xyxy[0], box_xyxy[1]), (box_xyxy[2], box_xyxy[3]), (255, 255, 0), 2)
284
273
  return people, img