-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclassifiers_handler.py
More file actions
43 lines (32 loc) · 1.29 KB
/
classifiers_handler.py
File metadata and controls
43 lines (32 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from pathlib import Path
from classifiers.raw_data_classifier import *
def main():
# read shit from file
operation = input("To prepare data inout 'p', to classify input 'c': ")
# temp_path = Path("./classifiers/classifiers_data")
# for file in temp_path.iterdir():
# if file.suffix != ".jsonl":
# continue
# timestamps, adc_outputs = load_segment_file(file)
# plt.figure(figsize=(10, 5))
# for channel_idx in range(adc_outputs.shape[1]):
# plt.plot(timestamps, adc_outputs[:, channel_idx], label=f"ADC {channel_idx + 1}")
# plt.title(file.name)
# plt.xlabel("Timestamp")
# plt.ylabel("ADC output")
# plt.legend()
# plt.tight_layout()
# plt.show()
if operation == 'p':
raw_data_dir = Path("./data/raw")
for file in raw_data_dir.iterdir():
print(file.name)
timestamps, adc_data = process_raw_file(file)
split_data_into_segments(file, adc_data, timestamps)
else:
model, test_loader, label_to_id, id_to_label = lstm_classification(Path("./classifiers/classifiers_data"))
results_and_plot(model, test_loader, label_to_id, id_to_label)
# lstm classification
# plot and profit
if __name__ == "__main__":
main()