Exemplo n.º 1
0
def action_one_shot(in_path, out_path=None, n_epochs=5):
    dtw_feats = data.actions.read_actions(in_path)
    dtw_feats.transform(lambda img_i: np.expand_dims(img_i, axis=-1))
    make_model = sim.imgs.make_conv
    sim_train = sim.SimTrain(make_model, sim.all_cat)
    params = {'input_shape': (64, 64, 1)}
    sim_train(dtw_feats, out_path, n_epochs, params)
Exemplo n.º 2
0
def dtw_one_shot(in_path,out_path=None,n_epochs=5):
    dtw_feats=feats.read_feats(in_path)
    dtw_feats.norm()
    def all_cat(name_i,name_j):
        return int(name_i.split('_')[0]==name_j.split('_')[0])
    make_model=get_basic_model()
    sim_train=sim.SimTrain(make_model,all_cat)
    sim_train(dtw_feats,out_path,n_epochs)
Exemplo n.º 3
0
def get_train():
	get_model=TS_SIM()
	get_cat=sim.all_cat
	read=data.seqs.read_seqs
	params={'input_shape':(64,100)}
	train_sim=sim.SimTrain(get_model,get_cat,read,2)
	def train(in_path,out_path,n_epochs):
		return train_sim(in_path,out_path,n_epochs,params=params)
	return train
Exemplo n.º 4
0
def binary_one_shot(in_path, out_path, n_epochs=5):
    n_cats = 20
    dataset = feats.read_feats(in_path)
    get_cat = BinaryCat()
    sim_nn = sim.SimTrain(one_shot.get_basic_model(), get_cat)

    def binary_gen(nn_path, i):
        get_cat.cat = i
        sim_nn(dataset, nn_path, n_epochs)

    funcs = [[one_shot.dtw_extract, ["in_path", "nn", "feats"]]]
    dir_names = ["feats"]
    arg_dict = {'in_path': in_path}
    binary_ens = ens.BinaryEns(binary_gen, funcs, dir_names)
    binary_ens(out_path, n_cats, arg_dict)
Exemplo n.º 5
0
def binary_one_shot(in_path, out_path, n_epochs=5):
    n_cats = 12
    dataset = read_actions(in_path)
    dataset.add_dim()
    get_cat = binary.BinaryCat()
    sim_nn = sim.SimTrain(sim.imgs.make_conv, get_cat)

    def binary_gen(nn_path, i):
        get_cat.cat = i
        sim_nn(dataset, nn_path, n_epochs)

    funcs = [[extract, ["in_path", "nn", "feats"]]]
    dir_names = ["feats"]
    arg_dict = {'in_path': in_path}
    binary_ens = ens.BinaryEns(binary_gen, funcs, dir_names)
    binary_ens(out_path, n_cats, arg_dict)