изменил метаданные
This commit is contained in:
parent
285af17f31
commit
824796b7e3
11
.env
11
.env
@ -1,10 +1,11 @@
|
||||
RTSP_URL=rtsp://192.168.0.169:8554/cam
|
||||
RTSP_URL=rtsp://192.168.31.56:8554/cam
|
||||
|
||||
# MODEL_NAME=kpp\yolo11n 10epochs\yolo11n_10epochs.pt
|
||||
YOLO_MODEL=/home/app/ml/models/kpp/yolo11n_10_epochs/yolo11n_10epochs.pt
|
||||
# YOLO_MODEL=/home/app/ml/models/kpp/yolo11n_10_epochs/yolo11n_10epochs.pt
|
||||
YOLO_MODEL=C:\project\kpp\app\ml\models\kpp\yolo11n_10_epochs\yolo11n_10epochs.pt
|
||||
|
||||
WEB_IP_ADDR=192.168.0.169:8000
|
||||
WEB_IP_ADDR=192.168.31.56:8001
|
||||
WEB_TOKEN=local-test-key
|
||||
|
||||
REDIS_HOST=192.168.0.169
|
||||
REDIS_HOST=192.168.31.56
|
||||
REDIS_PORT=6379
|
||||
|
||||
|
||||
@ -123,11 +123,10 @@ def json_packer(type, data: BaseData):
|
||||
|
||||
def server_ping():
|
||||
try:
|
||||
print(data)
|
||||
url = f"http://{ip_addr_web}/api/recieve/"
|
||||
url = f"http://{ip_addr_web}/start_recieve"
|
||||
|
||||
headers = {
|
||||
'Authorization': f'{token}',
|
||||
'Authorization': f'',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
@ -143,9 +142,8 @@ def server_ping():
|
||||
def data_upload_redis(value, key='ai_recieve'):
|
||||
try:
|
||||
value = json.dumps(value)
|
||||
print(value)
|
||||
redis_con.lpush(key, value)
|
||||
if redis_con.llen(key)%100==0:
|
||||
server_ping()
|
||||
|
||||
except Exception as e:
|
||||
error_msg = f"Ошибка {str(e)}"
|
||||
@ -171,6 +169,7 @@ container = av.open(
|
||||
video = container.demux(video=0)
|
||||
|
||||
video_stream = next(s for s in container.streams if s.type == 'video')
|
||||
server_ping()
|
||||
for packet in container.demux(video_stream):
|
||||
for frame in packet.decode():
|
||||
if 'start_time' not in locals():
|
||||
@ -184,7 +183,7 @@ for packet in container.demux(video_stream):
|
||||
img = frame.to_ndarray(format='bgr24')
|
||||
results = model.predict(img)
|
||||
data = {'pts': pts,
|
||||
'content': [],
|
||||
'content': {'content': []},
|
||||
'plate_text': []}
|
||||
for result in results:
|
||||
for box in result.boxes:
|
||||
@ -193,7 +192,7 @@ for packet in container.demux(video_stream):
|
||||
if box.cls == 0 and box.conf >= 0.2:
|
||||
text = paddle_ocr(img, x1, y1, x2, y2)
|
||||
plate = Plate(text, x1, y1, x2, y2)
|
||||
data['content'].append(json_packer(int(box.cls), plate))
|
||||
data['content']['content'].append(json_packer(int(box.cls), plate))
|
||||
data['plate_text'].append(text)
|
||||
|
||||
# cv2.rectangle(img, (int(x1), int(y1)), (int(x2), int(y2)), (0, 0, 255), 2)
|
||||
@ -201,7 +200,7 @@ for packet in container.demux(video_stream):
|
||||
# выводит данные о классе 'car'
|
||||
elif box.cls == 1 and box.conf >= 0.50:
|
||||
car = Car(x1, y1, x2, y2)
|
||||
data['content'].append(json_packer(int(box.cls), car))
|
||||
data['content']['content'].append(json_packer(int(box.cls), car))
|
||||
# cv2.rectangle(img, (int(x1), int(y1)), (int(x2), int(y2)), (0, 255, 0), 2)
|
||||
|
||||
data_upload_redis(data)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user