Comments (13)
yes, it solved. Thank you!
from trojanzoo.
That means your dataset element is PIL.Image
rather than torch.Tensor
, (99% because dataset transform is None rather than PILToTensor), which is unexpected.
Update: This seems to because of transform=None
trojanzoo/trojanzoo/datasets.py
Lines 449 to 450 in 51d728b
from trojanzoo.
Would you mind reviewing the PR #150 ?
I haven't checked if it works yet, but I believe that shall solve the issue.
from trojanzoo.
It works, but a new problem occur:
Traceback (most recent call last):
File "/home/itl/Documents/xrh/backdoor/trojanzoo/examples/train.py", line 36, in
model._train(**trainer)
File "/home/itl/Documents/xrh/backdoor/trojanzoo/examples/../trojanvision/models/imagemodel.py", line 560, in _train
return super()._train(epochs=epochs, optimizer=optimizer, lr_scheduler=lr_scheduler,
File "/home/itl/Documents/xrh/backdoor/trojanzoo/examples/../trojanzoo/models.py", line 1015, in _train
return train(module=self._model, num_classes=self.num_classes,
File "/home/itl/Documents/xrh/backdoor/trojanzoo/examples/../trojanzoo/utils/train.py", line 63, in train
best_validate_result = validate_fn(loader=loader_valid, get_data_fn=get_data_fn,
File "/home/itl/Documents/xrh/backdoor/trojanzoo/examples/../trojanvision/models/imagemodel.py", line 481, in _validate
return super()._validate(**kwargs)
File "/home/itl/Documents/xrh/backdoor/trojanzoo/examples/../trojanzoo/models.py", line 1056, in _validate
return validate(module=module, num_classes=num_classes, loader=loader,
File "/home/itl/Documents/xrh/backdoor/trojanzoo/examples/../trojanzoo/utils/train.py", line 246, in validate
loss = float(loss_fn(_input, _label, _output=_output, **kwargs))
File "/home/itl/Documents/xrh/backdoor/trojanzoo/examples/../trojanzoo/models.py", line 660, in loss
return criterion(_output, _label)
File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/nn/modules/loss.py", line 1163, in forward
return F.cross_entropy(input, target, weight=self.weight,
File "/home/itl/anaconda3/envs/trojanzoo/lib/python3.10/site-packages/torch/nn/functional.py", line 2996, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
RuntimeError: expected scalar type Float but found Long
from trojanzoo.
That doesn't seem to be an obvious issue. Let me debug actually.
from trojanzoo.
Thanks for finding the bug! Does the previous PR solve your issue?
from trojanzoo.
from trojanzoo.
remove your previously saved loss_weights.npy and regenerate one. It's saved at your dataset folder
from trojanzoo.
Does it work? @rahulxie
from trojanzoo.
Does it work? @rahulxie
yes, it works! Thanks!
from trojanzoo.
I want to konw what kinds of models used to train gtsrb dataset. Is resnet18_comp ok with the same config of cifar10 (i.e., the "Quick Start" of "Train a model" in README.md) ?
from trojanzoo.
Yes, I think I use resnet18_comp in IMC paper.
You may add my WeChat?
ain-soph-aur
from trojanzoo.
ain-soph-aur
okok, I have send friend request.
from trojanzoo.
Related Issues (20)
- BackdoorAttack class has no argument for source_class HOT 1
- Low effective loading in get_class_subset function HOT 1
- Install newest version fail HOT 1
- Using a custom model HOT 4
- RuntimeError: Dataset not found or corrupted. You can use download=True to download it HOT 10
- Clean label attack accuracy is wrong HOT 5
- In new push model path is not working HOT 1
- badnet folder information HOT 1
- [Error] When I test Neural Cleanse i got a error HOT 2
- Is it possible to apply methods to graph? HOT 6
- Input aware dynamic backdoor error HOT 5
- trojanvision.datasets.ImageFolder HOT 1
- Possible bug: target_class not changed when computing ASR for reversed triggers HOT 2
- problem about saving the intermediate results and config problem HOT 6
- strange mark saved HOT 2
- Hyperparameters for training Resnet18 on CIFAR10? HOT 1
- STRIP implementation doesn't match original codebase HOT 1
- Attack saving and loading is not working HOT 2
- Comp version of networks HOT 2
- Unable to Access Triggered Dataset in BadNet Attack HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trojanzoo.