Example #1
0
def test_bow(size=0):
    kmeans = cluster()
    train_data = fvloader.load_train_data(size=size, balance=False)
    for item in train_data:
        gene, nimg, gene_label, timestep = item
        fv = bow(nimg, kmeans)
        print("gene", gene, "count", timestep, "fv", fv.shape)
Example #2
0
def test_fisher(size=0):
    weights, means, covs = load_gmm()
    print("weights", weights.shape)
    print("means", means.shape)
    print("covriances", covs.shape)
    train_data = fvloader.load_train_data(size=size, balance=False)
    for item in train_data:
        gene, nimg, gene_label, timestep = item
        fv = fisher_vector(nimg, weights, means, covs)
        print("gene", gene, "count", timestep, "fv", fv.shape)
Example #3
0
def load_fv(fv='fv0'):
    if fv == 'fv0':
        gmm_data = fvloader.load_train_data(size=0, balance=False)
        weights, means, covs = load_gmm(gmm_data, gmmdir='gmm/fv0')

        train_data = fvloader.load_train_data(size=0, balance=True)
        val_data = fvloader.load_val_data(size=0)
        test_data = fvloader.load_test_data(size=0)

    elif fv == 'matlab':
        gmm_data = matloader.load_train_data(size=0, balance=False)
        weights, means, covs = load_gmm(gmm_data, gmmdir='gmm/matlab')

        train_data = matloader.load_train_data(size=0, balance=True)
        val_data = matloader.load_val_data(size=0)
        test_data = matloader.load_test_data(size=0)

    train_items = data2fisher(train_data, weights, means, covs)
    val_items = data2fisher(val_data, weights, means, covs)
    test_items = data2fisher(test_data, weights, means, covs)

    return train_items, val_items, test_items
Example #4
0
def load_fv(fv='fv0'):
    if fv == 'fv0':
        kmean_data = fvloader.load_train_data(size=0, balance=False)
        kmeans = cluster(kmean_data)

        train_data = fvloader.load_train_data(size=0, balance=True)
        val_data = fvloader.load_val_data(size=0)
        test_data = fvloader.load_test_data(size=0)
        bovdir = 'bov/fv0'

    elif fv == 'matlab':
        kmean_data = matloader.load_train_data(size=0, balance=False)
        kmeans = cluster(kmean_data)

        train_data = matloader.load_train_data(size=0, balance=True)
        val_data = matloader.load_val_data(size=0)
        test_data = matloader.load_test_data(size=0)
        bovdir = 'bov/matlab'

    train_items = data2bov(train_data, kmeans, bovdir=bovdir)
    val_items = data2bov(val_data, kmeans, bovdir=bovdir)
    test_items = data2bov(test_data, kmeans, bovdir=bovdir)

    return train_items, val_items, test_items
Example #5
0
def load_fv(fv='fv0'):
    if fv == 'fv0':
        vlad_data = fvloader.load_train_data(size=0, balance=False)
        kmeans = cluster(vlad_data)

        train_data = fvloader.load_train_data(size=0, balance=True)
        val_data = fvloader.load_val_data(size=0)
        test_data = fvloader.load_test_data(size=0)
        vladdir = 'vlad/fv0'

    elif fv == 'matlab':
        vlad_data = matloader.load_train_data(size=0, balance=False)
        kmeans = cluster(vlad_data)

        train_data = matloader.load_train_data(size=0, balance=True)
        val_data = matloader.load_val_data(size=0)
        test_data = matloader.load_test_data(size=0)
        vladdir = 'vlad/matlab'

    train_items = data2vlad(train_data, kmeans, vladdir=vladdir)
    val_items = data2vlad(val_data, kmeans, vladdir=vladdir)
    test_items = data2vlad(test_data, kmeans, vladdir=vladdir)

    return train_items, val_items, test_items