better logging and moved BASE_PATH to consts.py

This commit is contained in:
Nandhini Anand Jeyahar 2025-05-01 20:42:34 +02:00
parent fe515d61ba
commit d7474a11ab
5 changed files with 10 additions and 10 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
videos/* videos/*
data/* data/*
logs/*

View file

@ -3,7 +3,7 @@
#* File Name : anpr_yolo_v8.py #* File Name : anpr_yolo_v8.py
#* Purpose : #* Purpose :
#* Creation Date : 21-04-2025 #* Creation Date : 21-04-2025
#* Last Modified : Thu 01 May 2025 05:48:26 PM UTC #* Last Modified : Thu 01 May 2025 08:27:26 PM CEST
#* Created By : Yaay Nands #* Created By : Yaay Nands
#_._._._._._._._._._._._._._._._._._._._._.# #_._._._._._._._._._._._._._._._._._._._._.#
import glob import glob
@ -235,12 +235,11 @@ async def capture_number_plate(db, signal_received):
res = await cursor.fetchall() res = await cursor.fetchall()
logger.debug("found unprocessed records: %i ", len(res)) logger.debug("found unprocessed records: %i ", len(res))
for record in res: for record in res:
#logger.debug("processing record: %s"%json.dumps(record)) logger.debug("processing video file %s"%record['filename'])
plates = anprm.infer(filename) plates = anprm.infer(record['filename'])
cursor = await db.execute(SQL["UPDATE_NUMBERS"], cursor = await db.execute(SQL["UPDATE_NUMBERS"],
(True, 'NOMARS', record['model'], (True, json.dumps(plates), record['model'],
record['filename'], record['filename'], record['ts']))
record['ts']))
res = await cursor.fetchone() res = await cursor.fetchone()
except asyncio.CancelledError: except asyncio.CancelledError:
logger.debug("Closing loop capture_number_plate") logger.debug("Closing loop capture_number_plate")

Binary file not shown.

View file

@ -6,16 +6,15 @@ import torch
import ultralytics import ultralytics
from ultralytics import YOLO from ultralytics import YOLO
from PIL import Image from PIL import Image
ultralytics.checks() #ultralytics.checks()
from xml.etree import ElementTree as ET from xml.etree import ElementTree as ET
from .consts import BASE_PATH
if torch.cuda.is_available(): if torch.cuda.is_available():
device = torch.device('cuda') device = torch.device('cuda')
else: else:
device = torch.device('cpu') device = torch.device('cpu')
BASE_PATH = '..'
def convert_bbox_to_yolo( def convert_bbox_to_yolo(
size: tuple[float, float], box: tuple[float, float, float, float] size: tuple[float, float], box: tuple[float, float, float, float]
) -> tuple[float, float, float, float]: ) -> tuple[float, float, float, float]:

View file

@ -2,7 +2,8 @@ DB_RECORDINGS = "db/numberplates.sqlite3"
VIDEO_OUT_FULL = "videos/full/" VIDEO_OUT_FULL = "videos/full/"
VIDEO_OUT_ANAL = "videos/analysis" VIDEO_OUT_ANAL = "videos/analysis"
MODEL_NAME = "models/train25/best.pt" BASE_PATH = '/home/nands/workspace/c4s/anpr'
MODEL_NAME = "yolo_v8_custom"
RTSP_URL = "rtsp://admin:C4sinfra12@192.168.1.10:554/rtsp" RTSP_URL = "rtsp://admin:C4sinfra12@192.168.1.10:554/rtsp"
SCREEN_RESOLUTION = (1280, 720) # Resolution of the RTSP stream SCREEN_RESOLUTION = (1280, 720) # Resolution of the RTSP stream
BITRATE = 1000000 # Bitrate for video recording BITRATE = 1000000 # Bitrate for video recording