Create binary class dataset from multiple class dataset

Hi there, I am working on the [Intel Image Classification] ( dataset. It has six different classes: glacier, forest, street, building, mountain, and sea in it. However, I am only interested in training in some of the class. I only want to build a model to classify if an image is a forest or not forest. I can successfully load the data with dataloader function. Is there a way to override other five classes label into unforest and the other one stays as forest?


What about performing some transformations on labels?
You could set value of pixels beling to forest to 1 and others to 0. Does this work for you?

Yes. And how should I do that? I just found this Change labels in Data Loader today. I will try this later. What does train parameter do besides giving the train_labels attributes?

Also, I want to only use part of other labels so I have a balanced training dataset. For example, the original dataset has 3000 images for each class. I want to preserve 3000 images for forest class. And I want a mix of other 5 classes as a total of 3000 images. Any ideas?

It turned out I was using torchvision 0.2.1. The latest version is 0.2.3. I installed from source and I can manipulate the labels now with datasets.targets