Multi-label classification problem script testing dataset

I have very difficult multi-label problem for which I try to fit a residual network. I would like to test this script with a small multi-label dataset from torchvision library. However, when trying to search these datasets, only reference given is the original paper where these datasets were introduced. Seaching these datasets is cumbersome. Is there a suitable dataset in vision, or must I implement such dataset myself?

Simplification of the script.

num_classes = 7
model = resnet34(

features = model.fc.in_features

model.fc = nn.Sequential(
    nn.Linear(features, features),
    nn.Linear(features, num_classes),

loss_fn = nn.BCEWithLogitsLoss()
# This type of input with bsize = 16
target = torch.tensor([[0, 0, 1, 0, 1, 0, 1]], dtype=torch.float32)
img = torch.rand(3, 256, 256, dtype=torch.float32)
predicted = model(img.unsqueeze(0))
loss = loss_fn(predicted, target)

You can test your multi-class classification and model via some small classification datasets such as CIFAR10, CIFAR100, or MNIST. There could be seem as smoke tests but torchvision would download them for you so you wouldn’t need to search for them.

From what I have understood, these datasets have single correct label, not multiple. They do not fit to my use case, as I have multi-class and multi-label problem.

I might have been unclear previously. A dataset that fits my purpose would have multiple correct labels. Let’s say, a dataset with a large amount of colorful T-shirt images. Then I would predict that a T-shirt would have red-blue-green colors, or label of [0., 0., 0., 1., 0., 1., 1.] if the labels would contain information on the colors of the T-shirts.

EDIT: I might be wrong myself as CIFAR-100 contains superclass and multiple classes for this superclass. I might be able to combine these and have superclass and class input array. Will required some work thought.

You are right and I didn’t realize you are looking for a multi-label dataset, sorry.
I’m not aware of a CIFAR-like multi-label dataset and think that often tabular datasets are used for these use cases as an example (e.g. movie genre datasets).
paperswithcode mentions a few datasets, but I would guess you might need to download them offline due to their size.

1 Like

I managed to find a movie poster genre dataset that should fit multi-label requirement in

Working this to a Dataset requires a bit of work however.