jessicanada / cnn_spectrogram_algorithm Goto Github PK
View Code? Open in Web Editor NEWA method to classify spectrograms from raw EEG data using a convolutional neural network
A method to classify spectrograms from raw EEG data using a convolutional neural network
# train the model, run on test data and get output dat
NEWPATH = set_patient(0)
arch=resnet34 <--- ADD THIS LINE
data = get_the_data(arch) <--- ADD THIS INPUT TO FUNCTION
dat = train_the_model(arch,data)
Add input arch
to def get_the_data(arch):
Use:
def train_the_model(arch,data):
#train the model
learn = ConvLearner.pretrained(arch,data,precompute=True)
lr = 1e-2
learn.fit(lr,1)
learn.precompute = False
learn.fit(1e-3,3,cycle_len=1)
learn.unfreeze()
lr = np.array([1e-4,1e-3,1e-2])
cb = [EarlyStopping(learn,save_path='best_mod',patience = 6)]
learn.fit(lr,6,cycle_len=1,cycle_mult=2,callbacks=cb)
torch.save(learn.model.state_dict(),'test_saved_model.pkl')
#get output predictions and probabilities
log_preds_test = learn.predict(is_test=True)
preds_test = np.argmax(log_preds_test,axis=1)
probs_test = np.exp(log_preds_test[:,1])
#make test: a dataframe of test image names, predictions, and probabilities
test_names = np.empty_like(data.test_ds.fnames)
for i in range(len(data.test_ds.fnames)):
test_names[i] = data.test_ds.fnames[i]
#temp = data.test_ds.fnames[i]
#matchobj = re.search('.*im.*',temp)
#test_names[i] = matchobj.group()
test = pd.DataFrame(data = test_names,columns = ['image_number'])
test['prediction'] = preds_test
test['probability'] = probs_test
return test
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.