diff --git a/.gitignore b/.gitignore index ac41faf..e4bec62 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ videos/* data/* +logs/* diff --git a/anpr_main.py b/anpr_main.py index 008658b..f1f7e47 100644 --- a/anpr_main.py +++ b/anpr_main.py @@ -3,7 +3,7 @@ #* File Name : anpr_yolo_v8.py #* Purpose : #* 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 #_._._._._._._._._._._._._._._._._._._._._.# import glob @@ -235,12 +235,11 @@ async def capture_number_plate(db, signal_received): res = await cursor.fetchall() logger.debug("found unprocessed records: %i ", len(res)) for record in res: - #logger.debug("processing record: %s"%json.dumps(record)) - plates = anprm.infer(filename) + logger.debug("processing video file %s"%record['filename']) + plates = anprm.infer(record['filename']) cursor = await db.execute(SQL["UPDATE_NUMBERS"], - (True, 'NOMARS', record['model'], - record['filename'], - record['ts'])) + (True, json.dumps(plates), record['model'], + record['filename'], record['ts'])) res = await cursor.fetchone() except asyncio.CancelledError: logger.debug("Closing loop capture_number_plate") diff --git a/db/numberplates.sqlite3 b/db/numberplates.sqlite3 index 2683eb8..5fec6d0 100644 Binary files a/db/numberplates.sqlite3 and b/db/numberplates.sqlite3 differ diff --git a/lib/anpr.py b/lib/anpr.py index 3ccf888..8c8540d 100644 --- a/lib/anpr.py +++ b/lib/anpr.py @@ -6,16 +6,15 @@ import torch import ultralytics from ultralytics import YOLO from PIL import Image -ultralytics.checks() +#ultralytics.checks() from xml.etree import ElementTree as ET - +from .consts import BASE_PATH if torch.cuda.is_available(): device = torch.device('cuda') else: device = torch.device('cpu') -BASE_PATH = '..' def convert_bbox_to_yolo( size: tuple[float, float], box: tuple[float, float, float, float] ) -> tuple[float, float, float, float]: diff --git a/lib/consts.py b/lib/consts.py index b99b5c7..1cfbbf1 100644 --- a/lib/consts.py +++ b/lib/consts.py @@ -2,7 +2,8 @@ DB_RECORDINGS = "db/numberplates.sqlite3" VIDEO_OUT_FULL = "videos/full/" 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" SCREEN_RESOLUTION = (1280, 720) # Resolution of the RTSP stream BITRATE = 1000000 # Bitrate for video recording