xttmp 2.3.0.3__tar.gz → 2.3.0.5__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 (51) hide show
  1. {xttmp-2.3.0.3/src/xttmp.egg-info → xttmp-2.3.0.5}/PKG-INFO +4 -3
  2. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/README.md +3 -2
  3. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/pyproject.toml +1 -1
  4. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/math_operator.py +12 -4
  5. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/demo/inference_gui.py +4 -6
  6. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/main.py +0 -8
  7. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/model/haarstmd.py +1 -0
  8. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/util/iostream.py +44 -19
  9. {xttmp-2.3.0.3 → xttmp-2.3.0.5/src/xttmp.egg-info}/PKG-INFO +4 -3
  10. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/LICENSE +0 -0
  11. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/setup.cfg +0 -0
  12. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/__init__.py +0 -0
  13. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/api/__init__.py +0 -0
  14. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/api/evaluate.py +0 -0
  15. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/api/get_visualize_handle.py +0 -0
  16. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/api/instancing_model.py +0 -0
  17. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/__init__.py +0 -0
  18. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/apgstmd_core.py +0 -0
  19. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/apgstmdv2_core.py +0 -0
  20. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/base_core.py +0 -0
  21. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/dstmd_core.py +0 -0
  22. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/estmd_backbone.py +0 -0
  23. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/estmd_core.py +0 -0
  24. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/feedbackstmd_core.py +0 -0
  25. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/fracstmd_core.py +0 -0
  26. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/fstmd_core.py +0 -0
  27. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/fstmdv2_core.py +0 -0
  28. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/haarstmd_core.py +0 -0
  29. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/stfeedbackstmd_core.py +0 -0
  30. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/stmdplus_core.py +0 -0
  31. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/stmdplusv2_core.py +0 -0
  32. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/core/vstmd_core.py +0 -0
  33. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/demo/evaluate_model.py +0 -0
  34. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/demo/inference_gui_single_process.py +0 -0
  35. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/demo/inference_image_stream.py +0 -0
  36. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/demo/inference_video.py +0 -0
  37. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/model/__init__.py +0 -0
  38. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/model/backbone.py +0 -0
  39. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/model/facilitated_model.py +0 -0
  40. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/model/feedback_model.py +0 -0
  41. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/model/vstmd.py +0 -0
  42. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/util/__init__.py +0 -0
  43. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/util/compute_module.py +0 -0
  44. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/util/create_kernel.py +0 -0
  45. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/util/evaluate_module.py +0 -0
  46. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp/util/stmd.ico +0 -0
  47. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp.egg-info/SOURCES.txt +0 -0
  48. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp.egg-info/dependency_links.txt +0 -0
  49. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp.egg-info/entry_points.txt +0 -0
  50. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp.egg-info/requires.txt +0 -0
  51. {xttmp-2.3.0.3 → xttmp-2.3.0.5}/src/xttmp.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xttmp
3
- Version: 2.3.0.3
3
+ Version: 2.3.0.5
4
4
  Summary: eXtremely Tiny Target - Motion Perception
5
5
  Author-email: Shawn MX <mingshuoxu@hotmail.com>
6
6
  Project-URL: Homepage, https://github.com/MingshuoXu/Small-Target-Motion-Detectors
@@ -30,7 +30,7 @@ Dynamic: license-file
30
30
 
31
31
  # Small Target Motion Detectors, Version 2.3 (XTT-MP: Extremely Tiny Target - Motion Perception)
32
32
 
33
- [![PyPI version](https://img.shields.io/pypi/v/XTT-MP.svg)](https://pypi.org/project/XTT-MP/) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/) [![PyTorch](https://img.shields.io/badge/pytorch-1.10%2B-ee4c2c)](https://pytorch.org/)
33
+ [![PyPI version](https://img.shields.io/pypi/v/xttmp.svg)](https://pypi.org/project/xttmp/) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/) [![PyTorch](https://img.shields.io/badge/pytorch-1.10%2B-ee4c2c)](https://pytorch.org/)
34
34
 
35
35
 
36
36
  **XTT-MP** (Extremely Tiny Target - Motion Perception) is a natural architecture-based framework specifically designed for detecting and perceiving the motion of **extremely small targets** in complex environments.
@@ -67,13 +67,14 @@ Built with modularity and extensibility in mind, XTT-MP provides a robust suite
67
67
  - After `pip install xttmp`, use the installed code and bring your own input data, or run from a repository checkout to access the bundled examples.
68
68
 
69
69
  ### Via PyPI
70
- #### CPU
70
+ #### CPU / MPS
71
71
  ```bash
72
72
  pip install xttmp[torch]
73
73
  ```
74
74
 
75
75
  #### NVIDIA GPU (CUDA 12.6)
76
76
  ```bash
77
+ pip install xttmp
77
78
  pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126
78
79
  ```
79
80
 
@@ -1,6 +1,6 @@
1
1
  # Small Target Motion Detectors, Version 2.3 (XTT-MP: Extremely Tiny Target - Motion Perception)
2
2
 
3
- [![PyPI version](https://img.shields.io/pypi/v/XTT-MP.svg)](https://pypi.org/project/XTT-MP/) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/) [![PyTorch](https://img.shields.io/badge/pytorch-1.10%2B-ee4c2c)](https://pytorch.org/)
3
+ [![PyPI version](https://img.shields.io/pypi/v/xttmp.svg)](https://pypi.org/project/xttmp/) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/) [![PyTorch](https://img.shields.io/badge/pytorch-1.10%2B-ee4c2c)](https://pytorch.org/)
4
4
 
5
5
 
6
6
  **XTT-MP** (Extremely Tiny Target - Motion Perception) is a natural architecture-based framework specifically designed for detecting and perceiving the motion of **extremely small targets** in complex environments.
@@ -37,13 +37,14 @@ Built with modularity and extensibility in mind, XTT-MP provides a robust suite
37
37
  - After `pip install xttmp`, use the installed code and bring your own input data, or run from a repository checkout to access the bundled examples.
38
38
 
39
39
  ### Via PyPI
40
- #### CPU
40
+ #### CPU / MPS
41
41
  ```bash
42
42
  pip install xttmp[torch]
43
43
  ```
44
44
 
45
45
  #### NVIDIA GPU (CUDA 12.6)
46
46
  ```bash
47
+ pip install xttmp
47
48
  pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126
48
49
  ```
49
50
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xttmp"
7
- version = "2.3.0.3"
7
+ version = "2.3.0.5"
8
8
  description = "eXtremely Tiny Target - Motion Perception"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -102,7 +102,9 @@ class GaussianBlur(BaseCore):
102
102
  weight = self.blur_kernel.expand(C, 1, self.kernel_size, self.kernel_size)
103
103
 
104
104
  # 使用深度可分离卷积(groups=C),每个通道独立进行高斯模糊
105
- return F.conv2d(x, weight, padding='same', groups=C)
105
+ self.output = F.conv2d(x, weight, padding='same', groups=C)
106
+
107
+ return self.output
106
108
 
107
109
 
108
110
  class GammaDelay(BaseCore):
@@ -161,7 +163,9 @@ class GammaDelay(BaseCore):
161
163
  else:
162
164
  self.buffer.append(x)
163
165
 
164
- return compute_temporal_conv_inplace(self.buffer, self.gamma_kernel)
166
+ self.output = compute_temporal_conv_inplace(self.buffer, self.gamma_kernel)
167
+
168
+ return self.output
165
169
 
166
170
 
167
171
  class GammaBandPassFilter(BaseCore):
@@ -236,7 +240,9 @@ class GammaBandPassFilter(BaseCore):
236
240
  else:
237
241
  self.buffer.append(x)
238
242
 
239
- return compute_temporal_conv_inplace(self.buffer, self.bandpass_kernel)
243
+ self.output = compute_temporal_conv_inplace(self.buffer, self.bandpass_kernel)
244
+
245
+ return self.output
240
246
 
241
247
 
242
248
  class SpatialInhibition(BaseCore):
@@ -304,4 +310,6 @@ class SpatialInhibition(BaseCore):
304
310
  weight = self.kernel.expand(C, 1, self.kernel_size, self.kernel_size)
305
311
 
306
312
  # groups=C 表示进行深度可分离卷积(Depthwise Convolution),每个通道独立滤波
307
- return F.relu(F.conv2d(x, weight, padding='same', groups=C))
313
+ self.output = F.relu(F.conv2d(x, weight, padding='same', groups=C))
314
+
315
+ return self.output
@@ -18,9 +18,6 @@ from xttmp.util.iostream import ( # type: ignore
18
18
  FrameIterator,
19
19
  FrameVisualizer,
20
20
  )
21
- from xttmp.api import instancing_model
22
-
23
-
24
21
  # configure logging
25
22
  logging.basicConfig(level=logging.INFO,
26
23
  format='%(asctime)s - %(levelname)s - %(message)s')
@@ -34,7 +31,6 @@ class StmdGui:
34
31
  self.FrameIterator = FrameIterator
35
32
  self.FrameVisualizer = FrameVisualizer
36
33
  self.post_processor = None
37
- self.instancing_model = instancing_model
38
34
 
39
35
  def _get_user_input(self) -> tuple:
40
36
  """ get user input """
@@ -89,7 +85,9 @@ class StmdGui:
89
85
  self.post_processor = post_processor
90
86
  self.device = device
91
87
  reader = self._create_frame_reader(opt1, opt2)
92
- model = self.instancing_model(model_name, device)
88
+
89
+ from xttmp.api import instancing_model
90
+ model = instancing_model(model_name, device)
93
91
 
94
92
  visualizer = self.FrameVisualizer(
95
93
  window_name=model_name,
@@ -114,7 +112,7 @@ class StmdGui:
114
112
  run_time = time.perf_counter() - time_start
115
113
 
116
114
  post_res = post_processor(result['response'], result.get('direction'))
117
- show_str = f'{self.device} : {run_time*1000:.1f} ms'
115
+ show_str = f'{self.device.upper()} : {run_time*1000:.1f} ms'
118
116
  if not visualizer.update(color_img, result=post_res, show_str=show_str):
119
117
  break
120
118
 
@@ -2,14 +2,6 @@ from pathlib import Path
2
2
  import subprocess
3
3
  import sys
4
4
 
5
- try:
6
- import torch
7
- except ImportError:
8
- raise ImportError(
9
- "Please install PyTorch first. "
10
- "See https://pytorch.org/get-started/locally/"
11
- )
12
-
13
5
  def main():
14
6
  script_path = Path(__file__).resolve().parent / 'demo' / 'inference_gui.py'
15
7
  result = subprocess.run([sys.executable, str(script_path)], check=False)
@@ -4,6 +4,7 @@ from ..core import haarstmd_core
4
4
  from .backbone import ESTMDBackbone
5
5
  from ..util.compute_module import compute_response, compute_direction
6
6
 
7
+
7
8
  class HaarSTMD(ESTMDBackbone):
8
9
  ''' HaarSTMD: Advancing small target motion detection in dim light
9
10
 
@@ -451,7 +451,7 @@ class ModelSelectorGUI:
451
451
  self.root = root
452
452
 
453
453
  def create_gui(self, modelList):
454
- self.modelLabel = ttk.Label(self.root, text="Select a model:", width = 15)
454
+ self.modelLabel = ttk.Label(self.root, text="Select A Model:", width = 15)
455
455
  self.modelLabel.grid(row=0, column=0, padx=10, pady=10)
456
456
 
457
457
  self.modelCombobox = ttk.Combobox(self.root, values=modelList, width = 25)
@@ -596,14 +596,14 @@ class PostProcessingSelectorGUI:
596
596
  self.selectedOption = tk.IntVar(value=2)
597
597
 
598
598
  self.dotLabel = ttk.Radiobutton(self.root,
599
- text='dot output',
599
+ text='STMD Output',
600
600
  variable=self.selectedOption,
601
601
  value=2,
602
602
  command=self.select_dot)
603
603
  self.dotLabel.grid(row=5, column=1, padx=10, pady=10, sticky="w")
604
604
 
605
605
  self.bboxLabel = ttk.Radiobutton(self.root,
606
- text='bbox output',
606
+ text='Bbox Output',
607
607
  variable=self.selectedOption,
608
608
  value=1,
609
609
  command=self.select_bbox)
@@ -644,14 +644,20 @@ class PostProcessingSelectorGUI:
644
644
  raise ValueError(f"Unknown output type: {self.output_type}")
645
645
 
646
646
  def update_show_threshold(self, *args):
647
- value = float(self.showThresholdVar.get())
647
+ try:
648
+ value = float(self.showThresholdVar.get())
649
+ except ValueError:
650
+ value = 0.0
648
651
  self.show_threshold = min(max(value, 0.0), 1.0) # 确保在 [0.0, 1.0] 范围内
649
652
 
650
653
  def update_top_num(self, *args):
651
- value = int(self.getTopNumVar.get())
652
- self.top_num = max(value, 1) # 确保 top_num 至少为 1
653
-
654
+ try:
655
+ value = int(self.getTopNumVar.get())
656
+ except ValueError:
657
+ # 如果输入为空或者包含非数字字符,赋予一个默认值
658
+ value = 0
654
659
 
660
+ self.top_num = max(value, 1) # 确保 top_num 至少为 1
655
661
 
656
662
 
657
663
  class DeviceSelectorGUI:
@@ -667,26 +673,37 @@ class DeviceSelectorGUI:
667
673
  if torch.cuda.is_available():
668
674
  self.selectedOption.set(2)
669
675
  self.device = "cuda"
670
-
671
- self.cpuLabel = ttk.Radiobutton(self.root,
672
- text='CPU',
673
- variable=self.selectedOption,
674
- value=1,
675
- command=self.select_cpu)
676
- self.cpuLabel.grid(row=8, column=1, padx=10, pady=10, sticky="w")
677
676
 
678
- self.gpuLabel = ttk.Radiobutton(self.root,
679
- text='GPU',
677
+ self.device_frame = ttk.Frame(self.root)
678
+ self.device_frame.grid(row=8, column=1, columnspan=2, padx=10, pady=10, sticky="w")
679
+
680
+ self.cpuLabel = ttk.Radiobutton(self.device_frame,
681
+ text='CPU',
682
+ variable=self.selectedOption,
683
+ value=1,
684
+ command=self.select_cpu)
685
+ # 使用 pack(side="left") 可以让它们在 frame 内从左到右水平挨着排列
686
+ self.cpuLabel.pack(side="left", padx=(0, 20)) # 右侧留 20px 间距
687
+
688
+ self.cudaLabel = ttk.Radiobutton(self.device_frame,
689
+ text='CUDA',
680
690
  variable=self.selectedOption,
681
691
  value=2,
682
- command=self.select_gpu)
683
- self.gpuLabel.grid(row=8, column=2, padx=10, pady=10, sticky="w")
692
+ command=self.select_cuda)
693
+ self.cudaLabel.pack(side="left", padx=(0, 20))
694
+
695
+ self.mpsLabel = ttk.Radiobutton(self.device_frame,
696
+ text='MPS',
697
+ variable=self.selectedOption,
698
+ value=3,
699
+ command=self.select_mps)
700
+ self.mpsLabel.pack(side="left")
684
701
 
685
702
  def select_cpu(self):
686
703
  self.selectedOption.set(1)
687
704
  self.device = "cpu"
688
705
 
689
- def select_gpu(self):
706
+ def select_cuda(self):
690
707
  if torch.cuda.is_available():
691
708
  self.selectedOption.set(2)
692
709
  self.device = "cuda"
@@ -694,6 +711,14 @@ class DeviceSelectorGUI:
694
711
  messagebox.showinfo("Message title", "CUDA is not available. Please select CPU.")
695
712
  self.select_cpu()
696
713
 
714
+ def select_mps(self):
715
+ if torch.backends.mps.is_available():
716
+ self.selectedOption.set(3)
717
+ self.device = "mps"
718
+ else:
719
+ messagebox.showinfo("Message title", "Metal Performance Shaders (MPS) is not available. Please select CPU.")
720
+ self.select_cpu()
721
+
697
722
 
698
723
  class XTTMP_GUI:
699
724
  def __init__(self, root):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xttmp
3
- Version: 2.3.0.3
3
+ Version: 2.3.0.5
4
4
  Summary: eXtremely Tiny Target - Motion Perception
5
5
  Author-email: Shawn MX <mingshuoxu@hotmail.com>
6
6
  Project-URL: Homepage, https://github.com/MingshuoXu/Small-Target-Motion-Detectors
@@ -30,7 +30,7 @@ Dynamic: license-file
30
30
 
31
31
  # Small Target Motion Detectors, Version 2.3 (XTT-MP: Extremely Tiny Target - Motion Perception)
32
32
 
33
- [![PyPI version](https://img.shields.io/pypi/v/XTT-MP.svg)](https://pypi.org/project/XTT-MP/) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/) [![PyTorch](https://img.shields.io/badge/pytorch-1.10%2B-ee4c2c)](https://pytorch.org/)
33
+ [![PyPI version](https://img.shields.io/pypi/v/xttmp.svg)](https://pypi.org/project/xttmp/) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/) [![PyTorch](https://img.shields.io/badge/pytorch-1.10%2B-ee4c2c)](https://pytorch.org/)
34
34
 
35
35
 
36
36
  **XTT-MP** (Extremely Tiny Target - Motion Perception) is a natural architecture-based framework specifically designed for detecting and perceiving the motion of **extremely small targets** in complex environments.
@@ -67,13 +67,14 @@ Built with modularity and extensibility in mind, XTT-MP provides a robust suite
67
67
  - After `pip install xttmp`, use the installed code and bring your own input data, or run from a repository checkout to access the bundled examples.
68
68
 
69
69
  ### Via PyPI
70
- #### CPU
70
+ #### CPU / MPS
71
71
  ```bash
72
72
  pip install xttmp[torch]
73
73
  ```
74
74
 
75
75
  #### NVIDIA GPU (CUDA 12.6)
76
76
  ```bash
77
+ pip install xttmp
77
78
  pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126
78
79
  ```
79
80
 
File without changes
File without changes
File without changes
File without changes