Example #1
0
import torch
from train_test import Justreducelr_0, ShallowNet, SimpleCNN
from train_test import test, set_record_file
from MusicDataset import MusicDataThree
from MusicDataset import Musicdata_v7
from MusicDataset import Musicdata_LSTM
import torch.nn as nn
import numpy as np
# from MusicDataset import Musicdata_LSTM
basic_dir = 'D:/OneDrive-UCalgary/OneDrive - University of Calgary/data/cal500/'
basic_dir = '../'
set_record_file('record-modeltest.txt')

print('Test of deep convolutional network')
data_dir = basic_dir + 'raw-data-v5/'
data_file = basic_dir + 'music-data-v5.csv'
label_file = basic_dir + 'labels-v5.csv'
# net_name = 'shallownet'
net_name = '0-justreducelr'
# net_name = 'simplecnn-freq'
model_name = net_name + '.pt'
net = Justreducelr_0()  # deep convolutional network
net.load_state_dict(torch.load(model_name))
net.eval()
# test_set = MusicDataThree(data_file=data_file, label_file=label_file, start=2560, total=3219)
test_set = MusicDataThree(data_file=data_file,
                          label_file=label_file,
                          start=2560,
                          total=3219)
test(net, net_name=net_name, dataset=test_set)
Example #2
0
from train_test import train, test, set_record_file
from train_test import Coon_0_2 as Net

# time.sleep(3600*4)

print('start')
set_record_file('record-coon-128.txt')
net_name = '2-0+coon-128'
model_path = net_name + '.pt'
net = Net()
net = train(net, model_path=model_path)
test(net, net_name)


Example #3
0
from train_test import train, test, set_record_file
from train_test import Coon_0_2 as Net
from MusicDataset import MusicDataThree, ExpNorm

# time.sleep(3600*4)

print('start')
set_record_file('record-expoon.txt')
net_name = '2-0+expcoon'
model_path = net_name + '.pt'
tsfm = ExpNorm()
train_set = MusicDataThree(transform=tsfm, start=0, total=1)
test_set = MusicDataThree(transform=tsfm, start=0, total=1)
net = Net()
net = train(net, model_path=model_path, dataset=train_set)
test(net, net_name, dataset=test_set)


Example #4
0
from train_test import train, test, set_record_file
from MusicDataset import MusicDataThree, IniNorm

print('start')
net_name = '0-justreducelr-ininorm'
model_path = net_name + '.pt'
set_record_file('record-normreducelr.txt')
tsfm = IniNorm()
train_set = MusicDataThree(transform=tsfm, start=0, total=1)
test_set = MusicDataThree(transform=tsfm, start=0, total=1)
net = train(model_path=model_path, dataset=train_set)
test(net, net_name, dataset=test_set)
Example #5
0
from train_test import train, test, set_record_file
from train_test import Coon_0_2 as Net
from MusicDataset import MusicDataThree, IniNorm

# time.sleep(3600*4)

print('start')
set_record_file('record-normcoon.txt')
net_name = '2-0+normcoon'
model_path = net_name + '.pt'
tsfm = IniNorm()
train_set = MusicDataThree(transform=tsfm, start=0, total=1)
test_set = MusicDataThree(transform=tsfm, start=0, total=1)
net = Net()
net = train(net, model_path=model_path, dataset=train_set)
test(net, net_name, dataset=test_set)


Example #6
0
import sys
arg_len = len(sys.argv)
net_name = sys.argv[1]
# net_name = 'fzdata'
# net_name = 'fzdata-freq'
# net_name = 'fzdata-fully'
# net_name = 'fzdata-comb'
mode = sys.argv[2]
# mode = 'fully'
# mode = 'conv'
# mode = anyone else
basic_dir = 'D:/OneDrive-UCalgary/OneDrive - University of Calgary/data/cal500/'
basic_dir = '../'
if net_name == 'fzdata-freq':
	data_file = basic_dir + 'music-data-v9-freq.csv'
else:
	data_file = basic_dir + 'music-data-v9.csv'
# data_file = basic_dir + 'music-data-v7.csv'
# data_file = basic_dir + 'music-data-v9-freq.csv'

label_file = basic_dir + 'labels-v5.csv'
record_file = 'record-' + net_name + '.txt'
model_path = net_name + '.pt'
set_record_file(record_file)
net = Net(mode)
# net.apply(weights_init)
train_set = Musicdata_v7(data_file=data_file, label_file=label_file, start=0, total=2560)
test_set = Musicdata_v7(data_file=data_file, label_file=label_file, start=2560, total=3219)
net = train(net, model_path=model_path, dataset=train_set)
test(net, net_name, dataset=test_set)
Example #7
0
from train_test import train, test, set_record_file
from train_test import Justreducelr_0 as Net
import torch

# time.sleep(3600*16)

print('start')
net_name = '0-justreducelr'
model_path = net_name + '.pt'
set_record_file('record' + net_name + '.txt')
net = Net()
net.load_state_dict(torch.load(model_path))
net.eval()
net = train(net=net, model_path=model_path)
test(net, net_name)
Example #8
0
from train_test import train, test, set_record_file

# time.sleep(3600*16)


print('start')
net_name = '0-justreducelr'
model_path = net_name + '.pt'
set_record_file('record-60.txt')
net = train(model_path=model_path)
test(net, net_name)