update one2n.py
This commit is contained in:
@ -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