Document organization

This commit is contained in:
weiyuqing committed 2023-03-18 18:40:52 +08:00
1 parent 5f757ad939
commit b86bc4e4e1
15 files changed
+17 -13

No files matched your search

+3 -1
View File
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="ECG_by_Diffenert_CNN_Test" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

@@ -6,11 +6,11 @@ import pywt
import wfdb
import tensorflow as tf
from tensorflow import keras
from utils import loadData, plot_history_tf, plot_heat_map
from utils_oneLayerCNN import loadData, plot_history_tf, plot_heat_map
#from ECG_read_weiyuqing_without_wfdb import ECGDATAPATH
#PATH of this test
Project_PATH = "./Number-Of-CNN-Layers/One/"
Project_PATH = "../Number-Of-CNN-Layers/One/"
#PICTUREPATH= Project_PATH + "picture/"
log_dir = Project_PATH + "logs/" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
model_Path_one = Project_PATH + "model/ecg_model_one_layer.h5"
@@ -1,5 +1,5 @@
#this file give
# this file give
import os
import wfdb
import pywt
@@ -10,13 +10,13 @@ from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
# from _mian_tensorflow import Project_PATH
Project_PATH = "./Number-Of-CNN-Layers/Two/"
PICTUREPATH= Project_PATH +'picture/'
Project_PATH = '../Number-Of-CNN-Layers/One/'
PICTUREPATH = Project_PATH + 'picture/'
# from ECG_read_weiyuqing_without_wfdb import ECGDATAPATH
MITBITECGDATAPATH='./MIT-BIT/'
MITBITECGDATAPATH = '../MIT-BIT/'
# wavelet denoise preprocess using mallat algorithm
@@ -42,7 +42,7 @@ def denoise(date):
def getDataSet(number, X_data, Y_data):
ecgClassSet = ['N', 'A', 'V', 'L', 'R']
print('get' + number + ' ECG data')
record = wfdb.rdrecord(MITBITECGDATAPATH+ number, channel_names=['MLII'])
record = wfdb.rdrecord(MITBITECGDATAPATH + number, channel_names=['MLII'])
data = record.p_signal.flatten()
# use def denoise
rdata = denoise(date=data)
@@ -92,7 +92,6 @@ def loadData(ratio, random_seed):
# print(X_train, X_test, y_train, y_test)
return X_train, X_test, y_train, y_test
# train_ds = np.hstack((dataSet, labelSet))
# np.random.shuffle(train_ds)
#
@@ -114,7 +113,7 @@ def plot_heat_map(y_test, y_pred):
# normalize
# con_mat_norm = con_mat.astype('float') / con_mat.sum(axis=1)[:, np.newaxis]
# con_mat_norm = np.around(con_mat_norm, decimals=2)
# os.remove(PICTUREPATH+'confusion_matrix.png')
# plot
plt.figure(figsize=(8, 8))
seaborn.heatmap(con_mat, annot=True, fmt='.20g', cmap='Blues')
@@ -127,6 +126,9 @@ def plot_heat_map(y_test, y_pred):
def plot_history_tf(history):
# os.remove(PICTUREPATH+'accuracy.png')
# os.remove(PICTUREPATH+'loss.png')
plt.figure(figsize=(8, 8))
plt.plot(history.history['accuracy'])
plt.plot(history.history['val_accuracy'])
@@ -166,5 +168,5 @@ def plot_history_torch(history):
plt.ylabel('Loss')
plt.xlabel('Epoch')
plt.legend(['Train', 'Test'], loc='upper left')
plt.savefig(PICTUREPATH +'loss.png')
plt.savefig(PICTUREPATH + 'loss.png')
plt.show()
File renamed without changes.