abc
This commit is contained in:
@ -37,6 +37,9 @@ def find_samebox_in_array(arr, target):
|
||||
|
||||
|
||||
def extract_data(datapath):
|
||||
'''
|
||||
0/1_track.data 数据读取
|
||||
'''
|
||||
bboxes, ffeats = [], []
|
||||
|
||||
trackerboxes = np.empty((0, 9), dtype=np.float64)
|
||||
@ -147,8 +150,15 @@ def extract_data(datapath):
|
||||
return bboxes, ffeats, trackerboxes, tracker_feat_dict, trackingboxes, tracking_feat_dict
|
||||
|
||||
def read_tracking_output(filepath):
|
||||
'''
|
||||
0/1_tracking_output.data 数据读取
|
||||
'''
|
||||
|
||||
boxes = []
|
||||
feats = []
|
||||
if not os.path.isfile(filepath):
|
||||
return np.array(boxes), np.array(feats)
|
||||
|
||||
with open(filepath, 'r', encoding='utf-8') as file:
|
||||
for line in file:
|
||||
line = line.strip() # 去除行尾的换行符和可能的空白字符
|
||||
@ -176,7 +186,6 @@ def read_deletedBarcode_file(filePath):
|
||||
|
||||
split_flag, all_list = False, []
|
||||
dict, barcode_list, similarity_list = {}, [], []
|
||||
|
||||
clean_lines = [line.strip().replace("'", '').replace('"', '') for line in lines]
|
||||
|
||||
for i, line in enumerate(clean_lines):
|
||||
@ -199,6 +208,7 @@ def read_deletedBarcode_file(filePath):
|
||||
|
||||
if label == 'SeqDir':
|
||||
dict['SeqDir'] = value
|
||||
dict['filetype'] = "deletedBarcode"
|
||||
if label == 'Deleted':
|
||||
dict['Deleted'] = value
|
||||
if label == 'List':
|
||||
@ -259,15 +269,19 @@ def read_returnGoods_file(filePath):
|
||||
if label == 'SeqDir':
|
||||
dict['SeqDir'] = value
|
||||
dict['Deleted'] = value.split('_')[-1]
|
||||
dict['filetype'] = "returnGoods"
|
||||
if label == 'List':
|
||||
split_flag = True
|
||||
continue
|
||||
if split_flag:
|
||||
bcd = label.split('_')[-1]
|
||||
# event_list.append(label + '_' + bcd)
|
||||
event_list.append(label)
|
||||
barcode_list.append(label.split('_')[-1])
|
||||
barcode_list.append(bcd)
|
||||
similarity_list.append(value.split(',')[0])
|
||||
type_list.append(value.split('=')[-1])
|
||||
|
||||
|
||||
if len(barcode_list): dict['barcode'] = barcode_list
|
||||
if len(similarity_list): dict['similarity'] = similarity_list
|
||||
if len(event_list): dict['event'] = event_list
|
||||
@ -279,33 +293,51 @@ def read_returnGoods_file(filePath):
|
||||
|
||||
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# def read_seneor(filepath):
|
||||
# WeightDict = OrderedDict()
|
||||
# with open(filepath, 'r', encoding='utf-8') as f:
|
||||
# lines = f.readlines()
|
||||
# for i, line in enumerate(lines):
|
||||
# line = line.strip()
|
||||
#
|
||||
# keyword = line.split(':')[0]
|
||||
# value = line.split(':')[1]
|
||||
#
|
||||
# vdata = [float(s) for s in value.split(',') if len(s)]
|
||||
#
|
||||
# WeightDict[keyword] = vdata[-1]
|
||||
#
|
||||
# return WeightDict
|
||||
# =============================================================================
|
||||
|
||||
def read_one2one_simi(filePath):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def read_seneor(filepath):
|
||||
WeightDict = OrderedDict()
|
||||
with open(filepath, 'r', encoding='utf-8') as f:
|
||||
SimiDict = {}
|
||||
with open(filePath, 'r', encoding='utf-8') as f:
|
||||
lines = f.readlines()
|
||||
flag = False
|
||||
for i, line in enumerate(lines):
|
||||
line = line.strip()
|
||||
if line.find('barcode:')<0 and not flag:
|
||||
continue
|
||||
if line.find('barcode:')==0 :
|
||||
flag = True
|
||||
continue
|
||||
|
||||
keyword = line.split(':')[0]
|
||||
value = line.split(':')[1]
|
||||
|
||||
vdata = [float(s) for s in value.split(',') if len(s)]
|
||||
|
||||
WeightDict[keyword] = vdata[-1]
|
||||
|
||||
return WeightDict
|
||||
# if line.endswith(','):
|
||||
# line = line[:-1]
|
||||
if flag:
|
||||
barcode = line.split(',')[0].strip()
|
||||
value = line.split(',')[1].split(':')[1].strip()
|
||||
SimiDict[barcode] = float(value)
|
||||
|
||||
if flag and not line:
|
||||
flag = False
|
||||
|
||||
return SimiDict
|
||||
|
||||
|
||||
|
||||
def read_weight_timeConsuming(filePth):
|
||||
@ -362,15 +394,14 @@ def plot_sensor_curve(WeightDict, SensorDict, ProcessTimeDict):
|
||||
nw = len(wdata)
|
||||
assert(nw) >= 8, "The num of weight data is less than 8!"
|
||||
|
||||
i1, i2 = 0, 7
|
||||
while i2 < nw:
|
||||
data = wdata[i1:(i2+1)]
|
||||
max(data) - min(data)
|
||||
|
||||
if i2<7:
|
||||
i1 = 0
|
||||
else:
|
||||
i1 = i2-windth
|
||||
# i1, i2 = 0, 7
|
||||
# while i2 < nw:
|
||||
# data = wdata[i1:(i2+1)]
|
||||
# max(data) - min(data)
|
||||
# if i2<7:
|
||||
# i1 = 0
|
||||
# else:
|
||||
# i1 = i2-windth
|
||||
|
||||
min_t = min(wtime + stime)
|
||||
wtime = [t-min_t for t in wtime]
|
||||
@ -405,15 +436,12 @@ def plot_sensor_curve(WeightDict, SensorDict, ProcessTimeDict):
|
||||
|
||||
|
||||
|
||||
def main(file_path):
|
||||
def test_process(file_path):
|
||||
WeightDict, SensorDict, ProcessTimeDict = read_weight_timeConsuming(file_path)
|
||||
plot_sensor_curve(WeightDict, SensorDict, ProcessTimeDict)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
||||
def main():
|
||||
files_path = r'\\192.168.1.28\share\测试_202406\0814\0814\20240814-102227-62264578-a720-4eb9-b95e-cb8be009aa98_null'
|
||||
k = 0
|
||||
for filename in os.listdir(files_path):
|
||||
@ -424,42 +452,21 @@ if __name__ == "__main__":
|
||||
extract_data(file_path)
|
||||
|
||||
if os.path.isfile(file_path) and filename.find("process.data")>=0:
|
||||
main(file_path)
|
||||
test_process(file_path)
|
||||
|
||||
k += 1
|
||||
if k == 1:
|
||||
break
|
||||
|
||||
|
||||
|
||||
# print("Done")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def main1():
|
||||
fpath = r'\\192.168.1.28\share\测试_202406\1101\images\20241101-140456-44dc75b5-c406-4cb2-8317-c4660bb727a3_6922130101355_6922130101355\process.data'
|
||||
simidct = read_one2one_simi(fpath)
|
||||
print(simidct)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# main()
|
||||
main1()
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user