Comments (2)
Hi @yearep7, can you please post a minimal working example that reproduces your findings? Then we can look at your parameters (and how you use the attack) to check what's wrong.
from foolbox.
`fmodel = foolbox.models.PyTorchModel(net, bounds=(0, 1), num_classes=num_classes,device='cuda:0')
pgd
batch_start_time = time.time()
data=[]
for batch_idx, (inputs, target) in tqdm(enumerate(testloader)):
data.append((inputs, target))
def save(index):
print(index)
inputs=data[index][0]
target = data[index][1]
image = inputs.detach().numpy()
label = target.detach().numpy()
# apply attack on source image
attack = foolbox.attacks.PGD(fmodel)
adversarial = attack(image, label)
if adversarial is None:
print('wu attack')
adversarial=inputs
for i in range(len(adversarial)):
adversarial1=255*torch.from_numpy(adversarial[i].transpose(1,2,0))
#
name=class_name[label[i]]
if not os.path.exists(model_folder+'/'+name):
os.mkdir(model_folder+'/'+name)
adversarial1=np.uint8(adversarial1)
adversarial1=cv2.cvtColor(adversarial1,cv2.COLOR_RGB2BGR)
cv2.imencode('.png', adversarial1)[1].tofile(model_folder+'/'+name+'/'+name+'_%d_%d.png'%(index,i))
# cv2.imshow('test',adversarial1)
# cv2.waitKey(1 )
#`
No matter how I change the parameters, it operates according to a specified disturbance
from foolbox.
Related Issues (20)
- Is there a way to change/override the expected loss function of Foolbox's 'attack' function? HOT 1
- Is it possible to set the default loss function of a foolbox model? HOT 1
- Example Code Running Failed HOT 1
- [tests/test_models] The results of `transform_bounds` are inconsistent between CPU and GPU. HOT 3
- Are there any plans to support attacks on TFLite models? HOT 1
- Changing CUDA device at runtime HOT 1
- Logit optimization
- specifying criterion fails with TypeError HOT 2
- "nll_loss_forward_no_reduce_cuda_kernel_index" not implemented for 'Float' HOT 3
- Deprecation warning using old scipy namespace for gaussian_filter
- how to define the bounds HOT 2
- About the pgd attacks HOT 1
- how to use GaussianBlurAttack HOT 1
- FGSM TargetedMisclassfication HOT 1
- Use foolbox for multi-label classification HOT 1
- Local datasets supported?
- Is there a criterion for query budget? HOT 1
- It seems like the 'success' value in the return of the 'attack' function is overconfident. HOT 2
- About Carlini-Wagner Attack
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 foolbox.