0
$\begingroup$

I import the CIFAR-10 dataset to mathematica 11 notebook using code as below:

obj = ResourceObject["CIFAR-10"];
data = ResourceData[obj,"TrainingData"];

And then I get my whole dataset of labeled images which contains 10 classes of images (cat, dog, automobile, truck, etc.).

What I want to do is to decrease the number of classes in this dataset, which means I only want to use the images of cat and dog for my experiment.

I tried the approaches in the documents but they did not work.

Anyone can help me with this? I'm really appreciate for that.

$\endgroup$

1 Answer 1

0
$\begingroup$

You can use Cases for this together with HoldPattern

reducedSet = data // Cases[HoldPattern[ _ -> "dog" | "cat"]]
$\endgroup$
1
  • $\begingroup$ It works! Thank you sooooooooo much! $\endgroup$
    – Chang Liu
    Dec 27, 2016 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.