liuyugeng / ml-doctor Goto Github PK
View Code? Open in Web Editor NEWCode for ML Doctor
License: Apache License 2.0
Code for ML Doctor
License: Apache License 2.0
When trying to run the demo/tutorial code with the UTKFace dataset, it produces the following error:
ML-Doctor/demoloader/dataloader.py", line 73, in __getitem__
gender = int(attrs[1])
ValueError: invalid literal for int() with base 10: ''
When printing the attrs
it shows that the problem is with the missing gender:
['53', '', '0', '20170116184028385.jpg']
which seems to be a problem on line 4172 of the data file: landmark_list_part2.txt
: 53__0_20170116184028385.jpg
There seem to be two entries for that jpg since it is repeated on line 4213 with 62_1_0_20170116184028385.jpg
Removing line 4172 fixes the error.
Is this the correct way to preprocess the UTKFace data? If so, perhaps a note in the README would help others avoid the pain?
The changes introduced in the Opacus 1.0 API mean that this code doesn't work with the current version and it needs to be migrated. For example, simply following the README instructions results in the following error:
ImportError: cannot import name 'module_modification' from 'opacus.utils'
$ python demo.py --attack_type 0 --dataset_name mnist
Traceback (most recent call last):
File "demo.py", line 250, in <module>
main()
File "demo.py", line 227, in main
test_meminf(TARGET_PATH, device, num_classes, target_train, target_test, shadow_train, shadow_test, target_model, shadow_model, train_shadow, use_DP, noise, norm, delta)
File "demo.py", line 104, in test_meminf
attack_mode0(PATH + "_target.pth", PATH + "_shadow.pth", PATH, device, attack_trainloader, attack_testloader, target_model, shadow_model, attack_model, 1, num_classes)
File "/mnt/f/PYProject/doctor/meminf.py", line 748, in attack_mode0
res_train = attack.train(flag, RESULT_PATH)
File "/mnt/f/PYProject/doctor/meminf.py", line 289, in train
results = self.attack_model(output, prediction)
File "/home/ddq/miniconda3/envs/opacus/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/mnt/f/PYProject/utils/define_models.py", line 48, in forward
Prediction_Component_result = self.Prediction_Component(prediction)
File "/home/ddq/miniconda3/envs/opacus/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/ddq/miniconda3/envs/opacus/lib/python3.7/site-packages/torch/nn/modules/container.py", line 141, in forward
input = module(input)
File "/home/ddq/miniconda3/envs/opacus/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/ddq/miniconda3/envs/opacus/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 103, in forward
return F.linear(input, self.weight, self.bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (1x64 and 1x128)
Just add the following code to the dataloader and I can't find the problem
elif dataset_name.lower() == "mnist":
num_classes = 10
transform = transforms.Compose([
transforms.Resize((64, 64)),
transforms.ToTensor(),
transforms.Normalize((0.1307,), (0.3081,))
])
train_set = torchvision.datasets.MNIST(
root=root, train=True, download=True, transform=transform)
test_set = torchvision.datasets.MNIST(
root=root, train=False, download=True, transform=transform)
dataset = train_set + test_set
input_channel = 1
Hi,
I am trying to run secret-revealver mode in ModelInv attack,
but I am confused how to train the evaluation model.
As far as I know, the evaluation model should be trained to detect the identity of the face in each file.
However, the UTKFace dataset is not labeled with the identity.
Could you tell me how you did train the evaluation model for UTKFace?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.