spring-epfl / mia

A library for running membership inference attacks against ML models
MIT License
138 stars 28 forks source link

Error: Empty training data #6

Open nabladev opened 5 years ago

nabladev commented 5 years ago

Hi! I'm trying to conduct the membership attack on the Fashion Mnist dataset by slightly changing the provided example. Since the Fashion MNIST is 70k images (60k training and 10k for validation) and each image in 28x28x1, with 10 classes, I only had to adapt the target model to 28x28 images. When training the attack model I get this error: ValueError: Empty training data.

I was wondering where this problem comes from, I left untouched every other parameter like the SHADOW_DATASET_ATTACK or ATTACK_TEST_DATASET_SIZE

NickMeeker commented 3 years ago

Suuupper late on this, but I ran into this issue using my own dataset, too. The problem I wound up having was that the AttackModelBundle assumes by default your classes are one-hot encoded. If you're not one-hot encoding your classes, you'll need to set the class_one_hot_coded flag to false when constructing your attack bundle.

https://github.com/spring-epfl/mia/blob/master/mia/estimators.py#L203

This fixed it for me.