Update file with test results (#2)
ci/woodpecker/push/build-arm Pipeline was successful
ci/woodpecker/manual/build-arm Pipeline was successful

* Skip GSD and size filtering without altitude

* Update files

* Skip GSD and size filtering without altitude
This commit is contained in:
Roman Meshko
2026-04-23 21:01:25 +03:00
committed by GitHub
parent 00164d9e54
commit 911da5cb1c
12 changed files with 121 additions and 39 deletions
+13 -5
View File
@@ -15,6 +15,7 @@ import cv2
import jwt as pyjwt
import numpy as np
import requests as http_requests
from loguru import logger
from fastapi import Body, Depends, FastAPI, File, Form, HTTPException, Request, UploadFile
from fastapi.responses import Response, StreamingResponse
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
@@ -270,7 +271,8 @@ def _post_media_record(payload: dict, bearer: str) -> bool:
timeout=30,
)
return r.status_code in (200, 201)
except Exception:
except Exception as exc:
logger.warning(f"Failed to create media record in annotations service: {exc}")
return False
@@ -284,7 +286,8 @@ def _put_media_status(media_id: str, media_status: int, bearer: str) -> bool:
timeout=30,
)
return r.status_code in (200, 204)
except Exception:
except Exception as exc:
logger.warning(f"Failed to update media status in annotations service for {media_id}: {exc}")
return False
@@ -332,10 +335,13 @@ def _post_annotation_to_service(token_mgr: TokenManager, media_id: str,
try:
token = token_mgr.get_valid_token()
image_b64 = base64.b64encode(annotation.image).decode() if annotation.image else None
total_seconds = int(annotation.time // 1000) if annotation.time else 0
hours, remainder = divmod(total_seconds, 3600)
minutes, seconds = divmod(remainder, 60)
payload = {
"mediaId": media_id,
"source": 0,
"videoTime": f"00:00:{annotation.time // 1000:02d}" if annotation.time else "00:00:00",
"videoTime": f"{hours:02d}:{minutes:02d}:{seconds:02d}",
"detections": [d.model_dump() for d in dtos],
}
if image_b64:
@@ -346,8 +352,10 @@ def _post_annotation_to_service(token_mgr: TokenManager, media_id: str,
headers={"Authorization": f"Bearer {token}"},
timeout=30,
)
except Exception:
pass
except Exception as exc:
logger.warning(
f"Failed to post annotation to annotations service for media {media_id}: {exc}"
)
def _cleanup_channel(channel_id: str):