OTVision 0.6.6__py3-none-any.whl → 0.6.7__py3-none-any.whl
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.
- OTVision/detect/rtsp_input_source.py +16 -0
- OTVision/version.py +1 -1
- {otvision-0.6.6.dist-info → otvision-0.6.7.dist-info}/METADATA +1 -2
- {otvision-0.6.6.dist-info → otvision-0.6.7.dist-info}/RECORD +6 -6
- {otvision-0.6.6.dist-info → otvision-0.6.7.dist-info}/WHEEL +0 -0
- {otvision-0.6.6.dist-info → otvision-0.6.7.dist-info}/licenses/LICENSE +0 -0
|
@@ -27,6 +27,7 @@ from OTVision.domain.time import DatetimeProvider
|
|
|
27
27
|
|
|
28
28
|
RTSP_URL = "rtsp://127.0.0.1:8554/test"
|
|
29
29
|
RETRY_SECONDS = 1
|
|
30
|
+
DEFAULT_READ_FAIL_THRESHOLD = 5
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
class Counter:
|
|
@@ -82,6 +83,7 @@ class RtspInputSource(InputSourceDetect):
|
|
|
82
83
|
datetime_provider: DatetimeProvider,
|
|
83
84
|
frame_counter: Counter,
|
|
84
85
|
get_current_config: GetCurrentConfig,
|
|
86
|
+
read_fail_threshold: int = DEFAULT_READ_FAIL_THRESHOLD,
|
|
85
87
|
) -> None:
|
|
86
88
|
super().__init__(subject)
|
|
87
89
|
self._datetime_provider = datetime_provider
|
|
@@ -93,6 +95,8 @@ class RtspInputSource(InputSourceDetect):
|
|
|
93
95
|
self._stream_start_time: datetime = self._datetime_provider.provide()
|
|
94
96
|
self._current_video_start_time = self._stream_start_time
|
|
95
97
|
self._outdated = True
|
|
98
|
+
self._read_fail_threshold = read_fail_threshold
|
|
99
|
+
self._consecutive_read_fails = 0
|
|
96
100
|
|
|
97
101
|
@property
|
|
98
102
|
def _video_capture(self) -> VideoCapture:
|
|
@@ -157,10 +161,22 @@ class RtspInputSource(InputSourceDetect):
|
|
|
157
161
|
def _read_next_frame(self) -> ndarray | None:
|
|
158
162
|
successful, frame = self._video_capture.read()
|
|
159
163
|
if successful:
|
|
164
|
+
self._consecutive_read_fails = 0
|
|
160
165
|
return frame
|
|
166
|
+
self._consecutive_read_fails += 1
|
|
167
|
+
|
|
168
|
+
if self._consecutive_read_fails >= self._read_fail_threshold:
|
|
169
|
+
self._try_reconnecting_stream()
|
|
170
|
+
|
|
161
171
|
logger().debug("Failed to grab frame")
|
|
162
172
|
return None
|
|
163
173
|
|
|
174
|
+
def _try_reconnecting_stream(self) -> None:
|
|
175
|
+
self._video_capture.release()
|
|
176
|
+
self._current_video_capture = None
|
|
177
|
+
if not self.should_stop() and self._current_stream is not None:
|
|
178
|
+
self._current_video_capture = self._init_video_capture(self._current_stream)
|
|
179
|
+
|
|
164
180
|
def should_stop(self) -> bool:
|
|
165
181
|
return self._stop_capture
|
|
166
182
|
|
OTVision/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: OTVision
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.7
|
|
4
4
|
Summary: OTVision is a core module of the OpenTrafficCam framework to perform object detection and tracking.
|
|
5
5
|
Project-URL: Homepage, https://opentrafficcam.org/
|
|
6
6
|
Project-URL: Documentation, https://opentrafficcam.org/overview/
|
|
@@ -27,7 +27,6 @@ Requires-Dist: numpy==2.1.1; sys_platform != 'win32'
|
|
|
27
27
|
Requires-Dist: opencv-python==4.10.0.84
|
|
28
28
|
Requires-Dist: pandas==2.2.3
|
|
29
29
|
Requires-Dist: pyyaml==6.0.2
|
|
30
|
-
Requires-Dist: setuptools==74.0.0
|
|
31
30
|
Requires-Dist: torch==2.3.1
|
|
32
31
|
Requires-Dist: torchvision==0.18.1
|
|
33
32
|
Requires-Dist: tqdm==4.67.1
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
OTVision/__init__.py,sha256=CLnfgTlVHM4_nzDacvy06Z_Crc3hU6usd0mUyEvBf24,781
|
|
2
2
|
OTVision/config.py,sha256=0ecnI0N2rS2q0Ld6gBpK4iU2iyuUw683XWjj4g-L1m4,5336
|
|
3
3
|
OTVision/dataformat.py,sha256=BHF7qHzyNb80hI1EKfwcdJ9bgG_X4bp_hCXzdg7_MSA,1941
|
|
4
|
-
OTVision/version.py,sha256=
|
|
4
|
+
OTVision/version.py,sha256=FMJEQ4Oc-KD5z3-00dYgMptQRxDN5LgvDe6DvUmDwwI,175
|
|
5
5
|
OTVision/abstraction/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
OTVision/abstraction/defaults.py,sha256=ftETDe25gmr563RPSbG6flcEiNiHnRb0iXK1Zj_zdNg,442
|
|
7
7
|
OTVision/abstraction/observer.py,sha256=ZFGxUUjI3wUpf5ogXg2yDe-QjCcXre6SxH5zOogOx2U,1350
|
|
@@ -41,7 +41,7 @@ OTVision/detect/otdet.py,sha256=-8rZGY9NVRAwIHeVcNCjm665SmnW5UVIO_PSKdHegDA,6274
|
|
|
41
41
|
OTVision/detect/otdet_file_writer.py,sha256=idgPKwhgEd18HT7HshaT304JPlSw0kT4Isn2gWJRaSk,4304
|
|
42
42
|
OTVision/detect/pyav_frame_count_provider.py,sha256=w7p9iM3F2fljV8SD7q491gQhIHANbVczqtalcUiKj-E,453
|
|
43
43
|
OTVision/detect/rtsp_based_detect_builder.py,sha256=5-jg4ivJhiWi3PVIILVThorDNKg-i4Z-rFqZ2n01RDY,1322
|
|
44
|
-
OTVision/detect/rtsp_input_source.py,sha256=
|
|
44
|
+
OTVision/detect/rtsp_input_source.py,sha256=11R6ogEJ8tNBi7qYdV3RzlP_Bp1jojSnQe_tpDBvZBs,7552
|
|
45
45
|
OTVision/detect/timestamper.py,sha256=VvDTzHu9fTI7qQL9x775Gc27r47R8D5Pb040ffwO04k,5288
|
|
46
46
|
OTVision/detect/video_input_source.py,sha256=GLzG4LeZNYcOE1tHyebL51HxBHzJOVaDfJKsLiAtu4A,8775
|
|
47
47
|
OTVision/detect/yolo.py,sha256=Ksj8X7DZmONalaMB_iz-AtXwhEk4Fu7nZNzrXpqfhQw,10451
|
|
@@ -98,7 +98,7 @@ OTVision/view/view_helpers.py,sha256=a5yV_6ZxO5bxsSymOmxdHqzOEv0VFq4wFBopVRGuVRo
|
|
|
98
98
|
OTVision/view/view_track.py,sha256=vmfMqpbUfnzg_EsWiL-IIKNOApVF09dzSojHpUfYY6M,5393
|
|
99
99
|
OTVision/view/view_transform.py,sha256=HvRd8g8geKRy0OoiZUDn_oC3SJC5nuXhZf3uZelfGKg,5473
|
|
100
100
|
OTVision/view/helpers/OTC.ico,sha256=G9kwlDtgBXmXO3yxW6Z-xVFV2q4nUGuz9E1VPHSu_I8,21662
|
|
101
|
-
otvision-0.6.
|
|
102
|
-
otvision-0.6.
|
|
103
|
-
otvision-0.6.
|
|
104
|
-
otvision-0.6.
|
|
101
|
+
otvision-0.6.7.dist-info/METADATA,sha256=kt20s58WTB5nfTZK6ow-iXvXmiBlOQmRk0Dks_PalDE,6228
|
|
102
|
+
otvision-0.6.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
103
|
+
otvision-0.6.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
104
|
+
otvision-0.6.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|