Exemple #1
0
def test_Caltech101():
    dset = caltech.Caltech101()
    task = dset.img_classification_task(dtype='float32')
    tasks.assert_img_classification(*task, N=9144)

    X, y = task
    assert X[0].shape == (144, 145, 3)
    assert X[1].shape == (817, 656, 3)
    assert X[100].shape == (502, 388, 3)

    assert len(np.unique(y)) == 102  # number of categories
    ylist = y.tolist()
    counts = [ylist.count(z) for z in np.unique(ylist)]
    assert counts == counts_101

    z = y.copy()
    z.sort()
    assert (y == z).all()

    assert (y[1:] != y[:-1]).nonzero()[0].tolist() == caltech_101_breaks
Exemple #2
0
def test_Caltech101():
    dset = caltech.Caltech101()
    task = dset.img_classification_task(dtype="float32")
    tasks.assert_img_classification(*task, N=9144)

    X, y = task
    assert X[0].shape == (144, 145, 3)
    assert X[1].shape == (817, 656, 3)
    assert X[100].shape == (502, 388, 3)

    assert len(np.unique(y)) == 102  # number of categories
    ylist = y.tolist()
    counts = [ylist.count(z) for z in np.unique(ylist)]
    assert counts == counts_101

    z = y.copy()
    z.sort()
    assert (y == z).all()

    assert (y[1:] != y[:-1]).nonzero()[0].tolist() == caltech_101_breaks
Exemple #3
0
def test_Caltech256():
    dset = caltech.Caltech256()
    task = dset.img_classification_task(dtype='float32')
    tasks.assert_img_classification(*task)
Exemple #4
0
def test_img_classification_task():
    dset = lfw.Original()
    X, y = dset.img_classification_task(dtype='float32')
    tasks.assert_img_classification(X, y)
Exemple #5
0
def test_Caltech256():
    dset = caltech.Caltech256()
    task = dset.img_classification_task(dtype="float32")
    tasks.assert_img_classification(*task)