sciveo 0.1.27__tar.gz → 0.1.29__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 (134) hide show
  1. {sciveo-0.1.27 → sciveo-0.1.29}/PKG-INFO +1 -1
  2. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/cli.py +13 -1
  3. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/audio/audio.py +4 -4
  4. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/audio/audio_extractor_process.py +1 -16
  5. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/album_in_image.py +1 -0
  6. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/depth_esimation.py +1 -0
  7. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/video/video_album.py +1 -0
  8. sciveo-0.1.29/sciveo/ml/evaluation/object_detection.py +163 -0
  9. sciveo-0.1.29/sciveo/version.py +2 -0
  10. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo.egg-info/PKG-INFO +1 -1
  11. sciveo-0.1.29/sciveo.egg-info/requires.txt +79 -0
  12. {sciveo-0.1.27 → sciveo-0.1.29}/setup.py +6 -4
  13. sciveo-0.1.27/sciveo/ml/evaluation/object_detection.py +0 -33
  14. sciveo-0.1.27/sciveo/version.py +0 -2
  15. sciveo-0.1.27/sciveo.egg-info/requires.txt +0 -79
  16. {sciveo-0.1.27 → sciveo-0.1.29}/README.md +0 -0
  17. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/__init__.py +0 -0
  18. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/api/__init__.py +0 -0
  19. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/api/base.py +0 -0
  20. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/api/upload.py +0 -0
  21. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/common/__init__.py +0 -0
  22. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/common/configuration.py +0 -0
  23. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/common/model.py +0 -0
  24. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/common/optimizers.py +0 -0
  25. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/common/sampling.py +0 -0
  26. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/content/__init__.py +0 -0
  27. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/content/dataset.py +0 -0
  28. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/content/experiment.py +0 -0
  29. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/content/project.py +0 -0
  30. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/content/runner.py +0 -0
  31. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/__init__.py +0 -0
  32. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/__init__.py +0 -0
  33. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/base.py +0 -0
  34. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/encoders/__init__.py +0 -0
  35. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/encoders/base.py +0 -0
  36. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/encoders/normalizer.py +0 -0
  37. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/nlp/__init__.py +0 -0
  38. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/nlp/search.py +0 -0
  39. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/time_series/__init__.py +0 -0
  40. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/time_series/dataset.py +0 -0
  41. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/time_series/predictor.py +0 -0
  42. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/time_series/trainer.py +0 -0
  43. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/ml/time_series/window_generator.py +0 -0
  44. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/__init__.py +0 -0
  45. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/base.py +0 -0
  46. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/job_daemon.py +0 -0
  47. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/layouts/__init__.py +0 -0
  48. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/layouts/base.py +0 -0
  49. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/pipeline.py +0 -0
  50. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/postprocessors/__init__.py +0 -0
  51. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/postprocessors/base.py +0 -0
  52. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/postprocessors/default.py +0 -0
  53. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/__init__.py +0 -0
  54. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/audio/__init__.py +0 -0
  55. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/aws.py +0 -0
  56. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/base.py +0 -0
  57. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/file/__init__.py +0 -0
  58. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/file/archive.py +0 -0
  59. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/__init__.py +0 -0
  60. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/album.py +0 -0
  61. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/embeddings.py +0 -0
  62. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/filters.py +0 -0
  63. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/generators.py +0 -0
  64. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/histogram.py +0 -0
  65. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/mask.py +0 -0
  66. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/resize.py +0 -0
  67. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/segmentation.py +0 -0
  68. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/image/watermark.py +0 -0
  69. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/media_info.py +0 -0
  70. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/nlp/__init__.py +0 -0
  71. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/nlp/address.py +0 -0
  72. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/qr.py +0 -0
  73. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/sci/__init__.py +0 -0
  74. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/sci/base.py +0 -0
  75. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/sci/dataset.py +0 -0
  76. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/sci/time_series/__init__.py +0 -0
  77. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/sci/time_series/predictor.py +0 -0
  78. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/sci/time_series/trainer.py +0 -0
  79. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/tpu_base.py +0 -0
  80. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/video/__init__.py +0 -0
  81. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/video/generators.py +0 -0
  82. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/video/motion_detection.py +0 -0
  83. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/video/resize.py +0 -0
  84. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/video/video_frames.py +0 -0
  85. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/processors/video/video_resample.py +0 -0
  86. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/queues.py +0 -0
  87. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/server.py +0 -0
  88. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/web/__init__.py +0 -0
  89. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/media/pipelines/web/server.py +0 -0
  90. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/ml/__init__.py +0 -0
  91. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/ml/evaluation/__init__.py +0 -0
  92. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/ml/images/__init__.py +0 -0
  93. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/ml/images/object_detection.py +0 -0
  94. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/ml/images/tools.py +0 -0
  95. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/ml/images/transforms.py +0 -0
  96. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/ml/nlp/__init__.py +0 -0
  97. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/monitoring/__init__.py +0 -0
  98. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/monitoring/monitor.py +0 -0
  99. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/monitoring/start.py +0 -0
  100. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/network/__init__.py +0 -0
  101. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/network/camera.py +0 -0
  102. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/network/sniffer.py +0 -0
  103. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/network/tools.py +0 -0
  104. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/__init__.py +0 -0
  105. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/array.py +0 -0
  106. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/aws/__init__.py +0 -0
  107. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/aws/priority_queue.py +0 -0
  108. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/aws/s3.py +0 -0
  109. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/common.py +0 -0
  110. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/compress.py +0 -0
  111. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/configuration.py +0 -0
  112. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/crypto.py +0 -0
  113. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/daemon.py +0 -0
  114. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/formating.py +0 -0
  115. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/hardware.py +0 -0
  116. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/http.py +0 -0
  117. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/logger.py +0 -0
  118. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/os.py +0 -0
  119. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/random.py +0 -0
  120. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/remote.py +0 -0
  121. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/simple_counter.py +0 -0
  122. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/synchronized.py +0 -0
  123. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo/tools/timers.py +0 -0
  124. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo.egg-info/SOURCES.txt +0 -0
  125. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo.egg-info/dependency_links.txt +0 -0
  126. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo.egg-info/entry_points.txt +0 -0
  127. {sciveo-0.1.27 → sciveo-0.1.29}/sciveo.egg-info/top_level.txt +0 -0
  128. {sciveo-0.1.27 → sciveo-0.1.29}/setup.cfg +0 -0
  129. {sciveo-0.1.27 → sciveo-0.1.29}/test/test_compress.py +0 -0
  130. {sciveo-0.1.27 → sciveo-0.1.29}/test/test_configuration.py +0 -0
  131. {sciveo-0.1.27 → sciveo-0.1.29}/test/test_crypto.py +0 -0
  132. {sciveo-0.1.27 → sciveo-0.1.29}/test/test_monitoring.py +0 -0
  133. {sciveo-0.1.27 → sciveo-0.1.29}/test/test_runner.py +0 -0
  134. {sciveo-0.1.27 → sciveo-0.1.29}/test/test_sampling.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.1.27
3
+ Version: 0.1.29
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
  Provides-Extra: net
@@ -21,7 +21,8 @@ def main():
21
21
  config = GlobalConfiguration.get()
22
22
 
23
23
  parser = argparse.ArgumentParser(description='sciveo CLI')
24
- parser.add_argument('command', choices=['init', 'monitor', 'scan', 'media-server'], help='Command to execute')
24
+ parser.add_argument('command', choices=['init', 'monitor', 'scan', 'media-server', 'media-run'], help='Command to execute')
25
+
25
26
  parser.add_argument('--period', type=int, default=120, help='Period in seconds')
26
27
  parser.add_argument('--block', type=bool, default=True, help='Block flag')
27
28
  parser.add_argument('--auth', type=str, default=config['secret_access_key'], help='Auth secret access key')
@@ -29,6 +30,13 @@ def main():
29
30
  parser.add_argument('--net', type=str, default=None, help='Network like 192.168.10.0/24')
30
31
  parser.add_argument('--port', type=int, default=22, help='Host port number, used for network ops')
31
32
  parser.add_argument('--localhost', type=bool, default=False, help='Add localhost to list of hosts')
33
+ parser.add_argument('--input-path', type=str, help='Input Path')
34
+ parser.add_argument('--output-path', type=str, help='Output Path')
35
+ parser.add_argument('--width', type=str, default=None, help='width')
36
+ parser.add_argument('--height', type=str, default=None, help='height')
37
+ parser.add_argument('--rate', type=int, help='Rate number')
38
+ parser.add_argument('--processor', type=str, help='Processor name')
39
+
32
40
  args = parser.parse_args()
33
41
 
34
42
  if args.command == 'monitor':
@@ -55,6 +63,10 @@ def main():
55
63
  elif args.command == 'media-server':
56
64
  from sciveo.media.pipelines.server import __START_SCIVEO_MEDIA_SERVER__
57
65
  __START_SCIVEO_MEDIA_SERVER__()
66
+ elif args.command == 'media-run':
67
+ if args.processor == "audio-plot":
68
+ from sciveo.media.pipelines.processors.audio.audio_extractor_process import plot_audio
69
+ plot_audio(args.width, args.height, args.rate, args.input_path, args.output_path)
58
70
  else:
59
71
  warning(args.command, "not implemented")
60
72
 
@@ -50,11 +50,11 @@ class AudioExtract(BaseProcessor):
50
50
  exception(e, aac_audio_local_path)
51
51
 
52
52
  def plot_new_process(self, w, h, sampling_rate, aac_audio_local_path, image_audio_local_path):
53
- cmd = "python pipelines/processors/audio/audio_extractor_process.py "
53
+ cmd = "sciveo media-run --processor audio-plot "
54
54
  cmd += f"--width {w} --height {h} "
55
- cmd += f"--sampling_rate {sampling_rate} "
56
- cmd += f"--aac_audio_local_path '{aac_audio_local_path}' "
57
- cmd += f"--image_audio_local_path '{image_audio_local_path}' "
55
+ cmd += f"--rate {sampling_rate} "
56
+ cmd += f"--input-path '{aac_audio_local_path}' "
57
+ cmd += f"--output-path '{image_audio_local_path}' "
58
58
  cmd += " 1>audio.log 2>audio-error.log"
59
59
  debug("plot_new_process cmd", cmd)
60
60
  os.system(cmd)
@@ -9,15 +9,13 @@
9
9
  # 2024
10
10
  #
11
11
 
12
- import cv2
13
- import argparse
12
+ import numpy as np
14
13
  from scipy.io import wavfile
15
14
  from scipy.signal import butter, lfilter
16
15
  import matplotlib.pyplot as plt
17
16
 
18
17
  from sciveo.tools.logger import *
19
18
  from sciveo.tools.common import *
20
- from sciveo.media.pipelines.processors.base import *
21
19
 
22
20
 
23
21
  class AudioFFT:
@@ -136,16 +134,3 @@ def plot_audio(width, height, sampling_rate, aac_audio_local_path, image_audio_l
136
134
  plt.savefig(image_audio_local_path, dpi=dpi, bbox_inches='tight', pad_inches=0)
137
135
  except Exception as e:
138
136
  exception(e, aac_audio_local_path)
139
-
140
-
141
- parser = argparse.ArgumentParser(description='Audio Extractor')
142
-
143
- parser.add_argument('--width', type=str, help='width')
144
- parser.add_argument('--height', type=str, help='height')
145
- parser.add_argument('--sampling_rate', type=str, help='aduio sampling rate')
146
- parser.add_argument('--aac_audio_local_path', type=str, help='aac_audio_local_path')
147
- parser.add_argument('--image_audio_local_path', type=str, help='image_audio_local_path')
148
-
149
- args = parser.parse_args()
150
-
151
- plot_audio(args.width, args.height, args.sampling_rate, args.aac_audio_local_path, args.image_audio_local_path)
@@ -11,6 +11,7 @@
11
11
 
12
12
  import cv2
13
13
  import math
14
+ import numpy as np
14
15
 
15
16
  from sciveo.tools.logger import *
16
17
  from sciveo.tools.common import *
@@ -13,6 +13,7 @@ import os
13
13
  import cv2
14
14
  import gc
15
15
  from PIL import Image
16
+ import numpy as np
16
17
 
17
18
  import torch
18
19
  from transformers import AutoImageProcessor, AutoModelForDepthEstimation
@@ -10,6 +10,7 @@
10
10
  #
11
11
 
12
12
  import cv2
13
+ import numpy as np
13
14
 
14
15
  from sciveo.tools.common import *
15
16
  from sciveo.media.pipelines.processors.base import *
@@ -0,0 +1,163 @@
1
+ #
2
+ # Pavlin Georgiev, Softel Labs
3
+ #
4
+ # This is a proprietary file and may not be copied,
5
+ # distributed, or modified without express permission
6
+ # from the owner. For licensing inquiries, please
7
+ # contact pavlin@softel.bg.
8
+ #
9
+ # 2024
10
+ #
11
+
12
+ import time
13
+ import math
14
+ import numpy as np
15
+
16
+ from sciveo.tools.logger import *
17
+ from sciveo.ml.images.object_detection import *
18
+
19
+
20
+ """
21
+
22
+ Object Detection Evaluation
23
+
24
+ """
25
+ class EvalObjectDetection:
26
+ def __init__(self, predictions, labels, class_names):
27
+ self.predictions = predictions
28
+ self.labels = labels
29
+ self.class_names = class_names
30
+
31
+ # Convert from yolo predictions
32
+ def from_yolo(self):
33
+ self.converted_predictions = []
34
+ for predicted in predictions:
35
+ boxes = predicted.boxes
36
+ class_names = predicted.names
37
+
38
+ converted_prediction = {}
39
+ for i in range(len(boxes)):
40
+ class_id = int(boxes.cls[i].item())
41
+ label_class = class_names[class_id]
42
+ if label_class not in self.class_names:
43
+ continue
44
+ box = boxes.xyxyn[i].tolist()
45
+ confidence = boxes.conf[i].item()
46
+ box_confidence = box + [confidence]
47
+
48
+ converted_prediction.setdefault(label_class, [])
49
+ converted_prediction[label_class].append(box_confidence)
50
+ self.converted_predictions.append(converted_prediction)
51
+
52
+ # TODO: currently labels of type [ {"class 1": [ ['x1':x1,'y1':y1,'x2':x2,'y2':y2] ... ], "class 2": [ ['x1':x1,'y1':y1,'x2':x2,'y2':y2] ... ]} ... ]
53
+ self.converted_labels = []
54
+ for label in self.labels:
55
+ converted_label = {}
56
+ for class_name, class_boxes in label.items():
57
+ converted_label[class_name] = []
58
+ for box in class_boxes:
59
+ converted_label[class_name].append([box['x1'], box['y1'], box['x2'], box['y2']])
60
+ self.converted_labels.append(converted_label)
61
+
62
+ def compute_iou(self, box1, box2):
63
+ """
64
+ box1, box2: [x1, y1, x2, y2] format.
65
+ Returns the IoU between the two boxes.
66
+ """
67
+ x1_inter = max(box1[0], box2[0])
68
+ y1_inter = max(box1[1], box2[1])
69
+ x2_inter = min(box1[2], box2[2])
70
+ y2_inter = min(box1[3], box2[3])
71
+
72
+ inter_area = max(0, x2_inter - x1_inter) * max(0, y2_inter - y1_inter)
73
+ box1_area = (box1[2] - box1[0]) * (box1[3] - box1[1])
74
+ box2_area = (box2[2] - box2[0]) * (box2[3] - box2[1])
75
+ union_area = box1_area + box2_area - inter_area
76
+
77
+ if union_area == 0:
78
+ return 0.0
79
+
80
+ return inter_area / union_area
81
+
82
+ # Compute the Average Precision (AP)
83
+ def compute_ap(self, class_name, iou_threshold=0.0):
84
+ """
85
+ Calculate the Average Precision based on IoU and confidence scores.
86
+ Returns the AP for the current class.
87
+ """
88
+
89
+ count_labels = 0
90
+ true_positives = []
91
+ false_positives = []
92
+ false_negatives = []
93
+ detected = []
94
+
95
+ for i, prediction in enumerate(self.converted_predictions):
96
+ current_predictions = prediction.get(class_name, [])
97
+ current_labels = self.converted_labels[i].get(class_name, [])
98
+
99
+ count_labels += len(current_labels)
100
+ TP = 0
101
+
102
+ for prediction_box in current_predictions:
103
+ max_iou = 0
104
+ gt_match = None
105
+
106
+ for label_box in current_labels:
107
+ iou = self.compute_iou(prediction_box[:4], label_box)
108
+ if iou > 0.5 and iou >= max_iou:
109
+ max_iou = iou
110
+ gt_match = label_box
111
+
112
+ if max_iou >= iou_threshold and gt_match not in detected:
113
+ true_positives.append(1)
114
+ false_positives.append(0)
115
+ detected.append(gt_match)
116
+ TP += 1
117
+ else:
118
+ true_positives.append(0)
119
+ false_positives.append(1)
120
+
121
+ FN = len(current_labels) - TP
122
+ false_negatives.append(FN)
123
+
124
+ # Convert to cumulative sums
125
+ tp_cumsum = np.cumsum(true_positives)
126
+ fp_cumsum = np.cumsum(false_positives)
127
+
128
+ # Compute recall and precision
129
+ recall = tp_cumsum / count_labels
130
+ precision = tp_cumsum / (tp_cumsum + fp_cumsum)
131
+
132
+ # Compute AP using the trapezoidal rule (integrating precision over recall)
133
+ ap = np.trapz(precision, recall)
134
+ return ap, np.sum(false_negatives) / count_labels
135
+
136
+ def threshold(self, class_name, max_false_negative):
137
+ list_ap = []
138
+ list_fn = []
139
+ list_thresholds = np.linspace(0.0, 1.0, 101).tolist()
140
+ for i, iou_threshold in enumerate(list_thresholds):
141
+ ap, FN = self.compute_ap(class_name, iou_threshold)
142
+ #debug("AP", ap, "FN", FN)
143
+ if FN > max_false_negative:
144
+ ap = 0.0
145
+ list_ap.append(ap)
146
+ list_fn.append(FN)
147
+ idx = list_ap.index(max(list_ap))
148
+ debug("Threshold", class_name, list_thresholds[idx], "AP", list_ap[idx], "FN", list_fn[idx])
149
+ return list_thresholds[idx], list_ap[idx], list_fn[idx]
150
+
151
+ def evaluate(self, iou_thresholds={"default": 0.0}):
152
+ """
153
+ Calculate metrics like mAP based on IoU.
154
+ """
155
+ aps = []
156
+ class_ap = {}
157
+ for class_name in self.class_names:
158
+ ap, false_negatives = self.compute_ap(class_name, iou_thresholds.get(class_name, iou_thresholds["default"]))
159
+ aps.append(ap)
160
+ class_ap[class_name] = ap
161
+
162
+ mAP = np.mean(aps)
163
+ return {'mAP': mAP, 'AP per class': class_ap}
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.1.29'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.1.27
3
+ Version: 0.1.29
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
  Provides-Extra: net
@@ -0,0 +1,79 @@
1
+ numpy>=0.0.0
2
+ requests>=0.0.0
3
+
4
+ [all]
5
+ psutil>=0.0.0
6
+ netifaces>=0.0.0
7
+ scapy>=0.0.0
8
+
9
+ [media]
10
+ scikit-learn>=0.0.0
11
+ scipy>=0.0.0
12
+ scikit-video>=0.0.0
13
+ scikit-image>=0.0.0
14
+ pycryptodome>=0.0.0
15
+ exifread>=0.0.0
16
+ qrcode[pil]>=0.0.0
17
+ boto3
18
+ pandas>=0.0.0
19
+ pika>=0.0.0
20
+ regex>=0.0.0
21
+ matplotlib>=0.0.0
22
+ joblib>=0.0.0
23
+ tqdm>=0.0.0
24
+ ffmpeg-python>=0.0.0
25
+ opencv-python-headless>=0.0.0
26
+ opencv-contrib-python-headless>=0.0.0
27
+
28
+ [media-all]
29
+ psutil>=0.0.0
30
+ netifaces>=0.0.0
31
+ scapy>=0.0.0
32
+ scikit-learn>=0.0.0
33
+ scipy>=0.0.0
34
+ scikit-video>=0.0.0
35
+ scikit-image>=0.0.0
36
+ pycryptodome>=0.0.0
37
+ exifread>=0.0.0
38
+ qrcode[pil]>=0.0.0
39
+ boto3
40
+ pandas>=0.0.0
41
+ pika>=0.0.0
42
+ regex>=0.0.0
43
+ matplotlib>=0.0.0
44
+ joblib>=0.0.0
45
+ tqdm>=0.0.0
46
+ ffmpeg-python>=0.0.0
47
+ opencv-python-headless>=0.0.0
48
+ opencv-contrib-python-headless>=0.0.0
49
+ fastapi
50
+ uvicorn[standard]
51
+ tensorflow>=0.0.0
52
+ keras>=0.0.0
53
+ torch>=0.0.0
54
+ torchvision>=0.0.0
55
+ diffusers>=0.0.0
56
+ transformers>=0.0.0
57
+ accelerate>=0.0.0
58
+ annoy>=0.0.0
59
+
60
+ [media-ml]
61
+ tensorflow>=0.0.0
62
+ keras>=0.0.0
63
+ torch>=0.0.0
64
+ torchvision>=0.0.0
65
+ diffusers>=0.0.0
66
+ transformers>=0.0.0
67
+ accelerate>=0.0.0
68
+ annoy>=0.0.0
69
+
70
+ [media-server]
71
+ fastapi
72
+ uvicorn[standard]
73
+
74
+ [mon]
75
+ psutil>=0.0.0
76
+
77
+ [net]
78
+ netifaces>=0.0.0
79
+ scapy>=0.0.0
@@ -21,13 +21,15 @@ extras_require = {
21
21
  'scapy>=0.0.0',
22
22
  ],
23
23
  'media': [
24
- 'scikit-learn', 'scipy', 'scikit-video', 'scikit-image', 'pycryptodome', 'exifread', 'qrcode[pil]',
25
- 'boto3', 'pandas', 'pika', 'regex', 'matplotlib', 'joblib', 'tqdm',
26
- 'ffmpeg-python', 'opencv-python-headless', 'opencv-contrib-python-headless',
24
+ 'scikit-learn>=0.0.0', 'scipy>=0.0.0', 'scikit-video>=0.0.0', 'scikit-image>=0.0.0', 'pycryptodome>=0.0.0', 'exifread>=0.0.0', 'qrcode[pil]>=0.0.0',
25
+ 'boto3', 'pandas>=0.0.0', 'pika>=0.0.0', 'regex>=0.0.0', 'matplotlib>=0.0.0', 'joblib>=0.0.0', 'tqdm>=0.0.0',
26
+ 'ffmpeg-python>=0.0.0', 'opencv-python-headless>=0.0.0', 'opencv-contrib-python-headless>=0.0.0',
27
27
  ],
28
28
  'media-server': ['fastapi', 'uvicorn[standard]'],
29
29
  'media-ml': [
30
- 'tensorflow', 'keras', 'torch', 'torchvision', 'diffusers', 'transformers', 'accelerate', 'annoy',
30
+ 'tensorflow>=0.0.0', 'keras>=0.0.0',
31
+ 'torch>=0.0.0', 'torchvision>=0.0.0',
32
+ 'diffusers>=0.0.0', 'transformers>=0.0.0', 'accelerate>=0.0.0', 'annoy>=0.0.0',
31
33
  ]
32
34
  }
33
35
 
@@ -1,33 +0,0 @@
1
- #
2
- # Pavlin Georgiev, Softel Labs
3
- #
4
- # This is a proprietary file and may not be copied,
5
- # distributed, or modified without express permission
6
- # from the owner. For licensing inquiries, please
7
- # contact pavlin@softel.bg.
8
- #
9
- # 2024
10
- #
11
-
12
- import math
13
- import numpy as np
14
-
15
- from sciveo.ml.images.object_detection import *
16
-
17
-
18
- """
19
-
20
- Object Detection Evaluation
21
-
22
- """
23
-
24
-
25
- class EvaluateObjectDetection:
26
- def __init__(self, X, Y_true, Y_predicted):
27
- self.X = X
28
- self.Y_true = Y_true
29
- self.Y_predicted = Y_predicted
30
-
31
- def evaluate(self):
32
- pass
33
-
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.1.27'
@@ -1,79 +0,0 @@
1
- numpy>=0.0.0
2
- requests>=0.0.0
3
-
4
- [all]
5
- psutil>=0.0.0
6
- netifaces>=0.0.0
7
- scapy>=0.0.0
8
-
9
- [media]
10
- scikit-learn
11
- scipy
12
- scikit-video
13
- scikit-image
14
- pycryptodome
15
- exifread
16
- qrcode[pil]
17
- boto3
18
- pandas
19
- pika
20
- regex
21
- matplotlib
22
- joblib
23
- tqdm
24
- ffmpeg-python
25
- opencv-python-headless
26
- opencv-contrib-python-headless
27
-
28
- [media-all]
29
- psutil>=0.0.0
30
- netifaces>=0.0.0
31
- scapy>=0.0.0
32
- scikit-learn
33
- scipy
34
- scikit-video
35
- scikit-image
36
- pycryptodome
37
- exifread
38
- qrcode[pil]
39
- boto3
40
- pandas
41
- pika
42
- regex
43
- matplotlib
44
- joblib
45
- tqdm
46
- ffmpeg-python
47
- opencv-python-headless
48
- opencv-contrib-python-headless
49
- fastapi
50
- uvicorn[standard]
51
- tensorflow
52
- keras
53
- torch
54
- torchvision
55
- diffusers
56
- transformers
57
- accelerate
58
- annoy
59
-
60
- [media-ml]
61
- tensorflow
62
- keras
63
- torch
64
- torchvision
65
- diffusers
66
- transformers
67
- accelerate
68
- annoy
69
-
70
- [media-server]
71
- fastapi
72
- uvicorn[standard]
73
-
74
- [mon]
75
- psutil>=0.0.0
76
-
77
- [net]
78
- netifaces>=0.0.0
79
- scapy>=0.0.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes