main.py 2.46 KB
Newer Older
1
from config import config
okiss's avatar
okiss committed
2
from ensemble import run
3
import numpy as np
okiss's avatar
okiss committed
4
import scipy
okiss's avatar
okiss committed
5
from scipy import io
okiss's avatar
okiss committed
6
import h5py
okiss's avatar
okiss committed
7
8
import logging
import time
9

10
def main():
Ard Kastrati's avatar
Ard Kastrati committed
11
12
    logging.basicConfig(filename=config['info_log'], level=logging.INFO)
    logging.info('Started the Logging')
13
    start_time = time.time()
14
    # try:
okiss's avatar
okiss committed
15
    trainX, trainY = IOHelper.get_mat_data(config['data_dir'], verbose=True)
okiss's avatar
okiss committed
16
17
18
19
20
21

    if config['model'] == 'eegnet' or config['model'] == 'eegnet_cluster':
        trainX = np.transpose(trainX, (0, 2, 1))
        logging.info(trainX.shape)
    run(trainX,trainY)
    '''
zpgeng's avatar
zpgeng committed
22
    if config['model'] == 'cnn' or config['model'] == 'cnn_cluster':
23
        logging.info("Started running CNN. If you want to run other methods please choose another model in the config.py file.")
24
        CNN.run(trainX, trainY)
25

zpgeng's avatar
zpgeng committed
26
    elif config['model'] == 'eegnet' or config['model'] == 'eegnet_cluster':
27
28
        logging.info(
            "Started running EEGNet. If you want to run other methods please choose another model in the config.py file.")
29
        eegnet_x = np.transpose(trainX, (0, 2, 1))
Ard Kastrati's avatar
Ard Kastrati committed
30
        logging.info(eegnet_x.shape)
31
        eegNet.run(trainX=eegnet_x, trainY=trainY)
32

33
34
35
    elif config['model'] == 'inception' or config['model'] == 'inception_cluster':
        logging.info("Started running InceptionTime. If you want to run other methods please choose another model in the config.py file.")
        inception.run(trainX=trainX, trainY=trainY)
36

zpgeng's avatar
zpgeng committed
37
    elif config['model'] == 'xception' or config['model'] == 'xception_cluster':
38
        logging.info("Started running XceptionTime. If you want to run other methods please choose another model in the config.py file.")
39
40
41
42
43
        xception.run(trainX=trainX, trainY=trainY)

    elif config['model'] == 'deepeye' or config['model'] == 'deepeye_cluster':
        logging.info("Started running DeepEye. If you want to run other methods please choose another model in the config.py file.")
        deepeye.run(trainX=trainX, trainY=trainY)
okiss's avatar
okiss committed
44

45
46
47
    elif config['model'] == 'deepeye-rnn' or config['model'] == 'deepeye-rnn_cluster':
        logging.info("Started running deepeye-rnn. If you want to run other methods please choose another model in the config.py file.")
        deepeyeRNN.run(trainX=trainX, trainY=trainY)
48

49
    else:
Ard Kastrati's avatar
Ard Kastrati committed
50
        logging.info('Cannot start the program. Please choose one model in the config.py file')
okiss's avatar
okiss committed
51
    '''
Ard Kastrati's avatar
Ard Kastrati committed
52
53
    logging.info("--- Runtime: %s seconds ---" % (time.time() - start_time))
    logging.info('Finished Logging')
54

55
if __name__=='__main__':
zigeng's avatar
zigeng committed
56
    main()