update one2n.py
This commit is contained in:
BIN
realtime/__pycache__/event_time_specify.cpython-39.pyc
Normal file
BIN
realtime/__pycache__/event_time_specify.cpython-39.pyc
Normal file
Binary file not shown.
86
realtime/draw_traj.py
Normal file
86
realtime/draw_traj.py
Normal file
@ -0,0 +1,86 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Fri Feb 21 14:28:59 2025
|
||||
|
||||
@author: ym
|
||||
"""
|
||||
|
||||
import os
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
|
||||
import sys
|
||||
sys.path.append(r"D:\DetectTracking")
|
||||
from contrast.utils.event import ShoppingEvent
|
||||
from tracking.utils.read_data import read_weight_sensor, extract_data_realtime, read_tracking_output_realtime
|
||||
from tracking.utils.read_data import read_process
|
||||
|
||||
|
||||
|
||||
def read_tracker_data(filepath):
|
||||
pass
|
||||
|
||||
|
||||
def read_tracking_output_data(filepath):
|
||||
pass
|
||||
|
||||
|
||||
def read_process_data(filepath):
|
||||
path
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
evtPaths = r"\\192.168.1.28\share\测试视频数据以及日志\全实时测试\V12\2025-2-21\persist"
|
||||
evtPaths = Path(evtPaths)
|
||||
|
||||
for evtpath in evtPaths.iterdir():
|
||||
|
||||
## 1. 读取重力数据
|
||||
if evtpath.name.find("Weight")>=0 and evtpath.name.find(".txt")>0:
|
||||
weight_data = read_weight_sensor(evtpath)
|
||||
|
||||
if not evtpath.is_dir():
|
||||
continue
|
||||
|
||||
## 2. 读取事件data数据
|
||||
for fpath in evtpath.iterdir():
|
||||
|
||||
fname = fpath.name
|
||||
if fname.find("tracker.data"):
|
||||
pass
|
||||
|
||||
if fname.find("tracking_output.data"):
|
||||
pass
|
||||
|
||||
|
||||
if fname.find("process.data") >=0:
|
||||
pass
|
||||
|
||||
|
||||
fpath = str(fpath)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -9,11 +9,10 @@ import numpy as np
|
||||
# from matplotlib.pylab import mpl
|
||||
# mpl.use('Qt5Agg')
|
||||
import matplotlib.pyplot as plt
|
||||
from move_detect import MoveDetect
|
||||
|
||||
import sys
|
||||
sys.path.append(r"D:\DetectTracking")
|
||||
|
||||
from move_detect import MoveDetect
|
||||
# from tracking.utils.read_data import extract_data, read_deletedBarcode_file, read_tracking_output, read_weight_timeConsuming
|
||||
from tracking.utils.read_data import read_weight_timeConsuming
|
||||
|
||||
|
@ -9,9 +9,10 @@ import sys
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from datetime import datetime
|
||||
from contrast.utils.event import ShoppingEvent
|
||||
|
||||
sys.path.append(r"D:\DetectTracking")
|
||||
|
||||
from contrast.utils.event import ShoppingEvent
|
||||
from tracking.utils.read_data import read_weight_sensor, extract_data_realtime, read_tracking_output_realtime
|
||||
from tracking.utils.read_data import read_process
|
||||
|
||||
|
@ -13,10 +13,14 @@ from pathlib import Path
|
||||
import glob
|
||||
import numpy as np
|
||||
import copy
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
from collections import OrderedDict
|
||||
|
||||
from event_time_specify import devide_motion_state #, state_measure
|
||||
|
||||
import sys
|
||||
sys.path.append(r"D:\DetectTracking")
|
||||
from imgs_inference import run_yolo
|
||||
from event_time_specify import devide_motion_state#, state_measure
|
||||
from tracking.utils.read_data import read_weight_sensor
|
||||
|
||||
# IMG_FORMATS = 'bmp', 'dng', 'jpeg', 'jpg', 'mpo', 'png', 'tif', 'tiff', 'webp', 'pfm' # include image suffixes
|
||||
@ -400,8 +404,8 @@ def splitevent(imgpath, MotionSlice):
|
||||
|
||||
|
||||
def runyolo():
|
||||
eventdirs = r"\\192.168.1.28\share\realtime\eventdata"
|
||||
savedir = r"\\192.168.1.28\share\realtime\result"
|
||||
eventdirs = r"\\192.168.1.28\share\个人文件\wqg\realtime\eventdata"
|
||||
savedir = r"\\192.168.1.28\share\个人文件\wqg\realtime\result"
|
||||
|
||||
k = 0
|
||||
for edir in os.listdir(eventdirs):
|
||||
@ -419,12 +423,40 @@ def run_tracking(trackboxes, MotionSlice):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def read_wsensor(filepath):
|
||||
WeightDict = OrderedDict()
|
||||
with open(filepath, 'r', encoding='utf-8') as f:
|
||||
lines = f.readlines()
|
||||
clean_lines = [line.strip().replace("'", '').replace('"', '') for line in lines]
|
||||
for i, line in enumerate(clean_lines):
|
||||
line = line.strip()
|
||||
|
||||
line = line.strip()
|
||||
|
||||
if line.find(':') < 0: continue
|
||||
# if line.find("Weight") >= 0:
|
||||
# label = "Weight"
|
||||
# continue
|
||||
|
||||
|
||||
keyword = line.split(':')[0]
|
||||
value = line.split(':')[1]
|
||||
|
||||
# if label == "Weight":
|
||||
if len(keyword) and len(value):
|
||||
vdata = [float(s) for s in value.split(',') if len(s)]
|
||||
WeightDict[keyword] = vdata[-1]
|
||||
|
||||
|
||||
weights = [(float(t), w) for t, w in WeightDict.items()]
|
||||
weights = np.array(weights).astype(np.int64)
|
||||
|
||||
return weights
|
||||
|
||||
|
||||
def show_seri():
|
||||
datapath = r"\\192.168.1.28\share\个人文件\wqg\realtime\eventdata\1731316835560"
|
||||
savedir = r"D:\DetectTracking\realtime\1"
|
||||
savedir = r"\\192.168.1.28\share\个人文件\wqg\realtime\1"
|
||||
|
||||
|
||||
imgdir = datapath.split('\\')[-2] + "_" + datapath.split('\\')[-1]
|
||||
@ -450,7 +482,7 @@ def show_seri():
|
||||
|
||||
'''===============读取重力信号数据==================='''
|
||||
seneorfile = os.path.join(datapath, 'sensor.txt')
|
||||
weights = read_weight_sensor(seneorfile)
|
||||
weights = read_wsensor(seneorfile)
|
||||
|
||||
# weights = [(float(t), w) for t, w in WeightDict.items()]
|
||||
# weights = np.array(weights)
|
||||
@ -471,10 +503,8 @@ def show_seri():
|
||||
|
||||
def main():
|
||||
# runyolo()
|
||||
|
||||
show_seri()
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
Reference in New Issue
Block a user