mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 11:06:32 +00:00
Update .gitignore and refine documentation for execution environment
- Added Cython generated files to .gitignore to prevent unnecessary tracking. - Updated paths in `inference.c` and `coreml_engine.c` to reflect the correct virtual environment. - Revised the execution environment documentation to clarify hardware dependency checks and local execution instructions, ensuring accurate guidance for users. - Removed outdated Docker suitability checks and streamlined the assessment process for test execution environments.
This commit is contained in:
@@ -1,14 +1,9 @@
|
||||
import json
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
import uuid
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
import pytest
|
||||
|
||||
_MEDIA = os.environ.get("MEDIA_DIR", "/media")
|
||||
|
||||
|
||||
def _percentile_ms(sorted_ms, p):
|
||||
n = len(sorted_ms)
|
||||
@@ -119,59 +114,3 @@ def test_nft_perf_03_tiling_overhead_large_image(
|
||||
assert large_ms > small_ms - 500.0
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="video perf covered by test_ft_p09_sse_event_delivery")
|
||||
@pytest.mark.slow
|
||||
@pytest.mark.timeout(300)
|
||||
def test_nft_perf_04_video_frame_rate_sse(
|
||||
warm_engine,
|
||||
http_client,
|
||||
jwt_token,
|
||||
sse_client_factory,
|
||||
):
|
||||
media_id = f"perf-sse-{uuid.uuid4().hex}"
|
||||
body = {
|
||||
"probability_threshold": 0.25,
|
||||
"paths": [f"{_MEDIA}/video_test01.mp4"],
|
||||
"frame_period_recognition": 4,
|
||||
"frame_recognition_seconds": 2,
|
||||
}
|
||||
headers = {"Authorization": f"Bearer {jwt_token}"}
|
||||
stamps = []
|
||||
thread_exc = []
|
||||
done = threading.Event()
|
||||
|
||||
def _listen():
|
||||
try:
|
||||
with sse_client_factory() as sse:
|
||||
time.sleep(0.3)
|
||||
for event in sse.events():
|
||||
if not event.data or not str(event.data).strip():
|
||||
continue
|
||||
data = json.loads(event.data)
|
||||
if data.get("mediaId") != media_id:
|
||||
continue
|
||||
stamps.append(time.monotonic())
|
||||
if (
|
||||
data.get("mediaStatus") == "AIProcessed"
|
||||
and data.get("mediaPercent") == 100
|
||||
):
|
||||
break
|
||||
except BaseException as e:
|
||||
thread_exc.append(e)
|
||||
finally:
|
||||
done.set()
|
||||
|
||||
th = threading.Thread(target=_listen, daemon=True)
|
||||
th.start()
|
||||
time.sleep(0.5)
|
||||
r = http_client.post(f"/detect/{media_id}", json=body, headers=headers)
|
||||
assert r.status_code == 200
|
||||
ok = done.wait(timeout=290)
|
||||
assert ok
|
||||
th.join(timeout=5)
|
||||
assert not thread_exc
|
||||
assert len(stamps) >= 2
|
||||
span = stamps[-1] - stamps[0]
|
||||
assert span <= 290.0
|
||||
gaps = [stamps[i + 1] - stamps[i] for i in range(len(stamps) - 1)]
|
||||
assert max(gaps) <= 30.0
|
||||
|
||||
Reference in New Issue
Block a user