So the first talk we have is by Sven Cattell, data scientist at Endgame, and he's here to talk about adversarial patches Basically the plan for this talk was I was going to make t-shirts with adversarial patches and the volunteer t-shirts will have this stuff from it, I tried for about two months to do and eventually it started working so well, and I'm going to talk about how to make these patches, how they work, why the thing, and then like reasons for things. So I'm a data scientist at Endgame We've already heard about me so That's just what I'm going to be doing today. So the background of adversarial examples, you've got two things, basic classes of adversarial examples. One where you modify the pixels coming in for images. You modify the pixels of an image so that a classifier screws up This is the classic thing where you've got a cross-screen inside method attack, or you trigger a saliency, or various different types of attacks And we most, I hope most of us have seen Ian's panda Where he misclassifies it as a gibbon with some noise These sorts of attacks are good for understanding how neural deep learning works, but they don't act, they aren't actually attacks They can't do anything in the real world Because you'd have to grab the input out, the output of the camera, and modify the pixels on the fly, and it would You know, it's not a realistic attack, because it would be a requireable hardware computation Then you probably can get into a system. The other type of attack against machine learning is the physical modification So what you can do is you put a set of stickers on an object and have it misclassified One of the first papers that did this was one with They were attacking the Classifier that do stop signs because, you know, self-driving cars, stop signs And they came up with a way of producing Pixel modifications that they can put as stickers on the stop sign and causes the classifier to get misclassified You know, work badly There's some evidence that their attack does not work very well in real life And you have to have a weak, a poor classifier and a few other things to make it look like it works but these sorts of attacks are much harder to do So adversarial stickers or the second type of attack you actually can't put a thing on a person and out of it Okay, so the way you build the attack is there are three parts of the attack So you have the actual sticker, so Like I built this little object That contained the image, it's floating the pencil that holds the sticker it also holds a a mask so you can have the sticker be different shapes. Then we have a placer that puts the sticker on a bunch of images so that you can train against those images with the classifier. And then we have a trainer that actually does the training process. So it's very easy to build them, you've just got to build these through the components and if you go look at the original paper, there's a link to a GitHub account which has basically these things laid out. So if you've got a sticker, well the way I've built the sticker is you can take an image, a PNG image for a mask and it can be whatever you want as long as it fits within your training target thing or you can take a numpy array and then randomly initializes the patch around 50% gray with a bit of noise and that's the start of the sticker. It initializes that. When you pull the sticker, it gives you back the tensor for the sticker. I did this in about two weeks. It's called PyTorch and you can start applying it to images. It does a few things where it clips it so the sticker is an actual image so it stays in the pixel range and then it multiplies it by the mask so that it looks like that mask. An example is we've got the patch with the Defcon logo and then the mask that produced it and then we have the Endgame logo and the mask that produced it. So this is the simplest component but like the thing that we're actually training. This is the core. This is the core. So the rest is decorations around this. Probably the most important component is the placer. So what this does is you can take, you give three ranges, so a range of rotations that you're allowing, so any rotation in this range, so plus or minus 15 degrees, 30 degrees, a range of translations you're allowing and a range of scaling that you're allowing. So you can scale it up by 30% or down by 30% or whatever and you randomly select it. When you call it, what this does is it samples a bunch of your affine transformations within the ranges you've provided, copies the sticker into as many images as you have, and then transforms those stickers to be the right shape, also does this with masks, and then applies it to the sticker. So for how it works, so we've got the stickers on the side. And the masks on the side, and here is an affine transformation, and so randomly select a S, Theta, a Tx, and a Ty, and it'll select, in this case, 25 of those, and then apply that to each of those stickers, and then you get the transformation on the outside. So you see on the left you have the untransformed stickers, and on the right you have a bunch of transformed stickers. And so then you have... You store that and then put a little bit of math, and you apply the stickers to these images and you get... Sorry for the image quality here. You get a bunch of stuck images, like, stuck images, and that, at that point, you can feed to a classifier. And then we get to the last component, the trainer. This thing you can take in several models to train against, so these will be your white box models that you're training against, you're attacking against. It also takes an optimizer and a processor. There are a few other things you need to do gradient descent. This thing places the models and the stickers on the GPU and does all the stuff, the juggling that you don't want to think about. And actually what it does, it just performs the training. We have a basic training... The basic training loop here, this is for CIFAR, so we have our sticker on the left, and so the sticker goes through the placer with some images, and so it gets placed on the... Placed on the thing. So we have a bunch of 25 images. We have a bunch of images here that have had a sticker attached to them. Then this goes into a classifier, whatever classifier we have, that thing, and then we take the loss with respect to our target class. So in this case, I was going for the ninth class, the tenth class of CIFAR. So we take the loss with respect to what class we're trying to get, and then we do a back-prop gradient descent against the original sticker, because this entire thing from the original sticker to the loss is smooth... Is smooth. There's a smooth transformation, so we can do gradient descent with respect to the sticker itself. So this is the basic training loop, and if you wanted to do a single neural network, if you wanted to train it against a single classifier, you just do this, and you're good. But if you want to train it against several classifiers, so what happens if you want to train it against two, well, this... You can train it against two by going, okay, in my loop, I'm just going to do it twice, basically. The same basic loop twice. I'm going to have... You're going to do the first classifier, and then the second classifier, and then I'm going to loop until I get a sticker that works. So this is for an ensemble training against multiple models. And then there's the other way of doing it, which is what you do is you, instead of feeding into one classifier, you feed it into two classifiers, you get a loss, add it up, and take the gradient all the way back, and you get a result. So those two things work, and then you can train up a classifier, and here we go. Result. So if we have... I did this with... Like, the only thing I could get this working on was CIFAR, and we'll happily talk to people about null results here. So what I did was I got those four models on the side, so VGG-style network with nine layers, VGG with 13 layers, a ResNet with 22, and a DeepNet, which doesn't perform that well with 10 layers. And then I targeted against... Okay. Okay. I targeted against a ResNet-10, and the graph on the left is for that scale. For the zero scale, we had no performance, so this would be the image scale down to a point. Obviously, it's not going to do anything useful. And then when it covers 20% of the image, it's kind of useful. And then at about 40% of the image, it saturates the convolutional layers, and that causes misclassification. For this sticker here, you need to cover 40% of the image, and then it'll cause a misclassification. And this was trained in the sequential model, and then if you train it in parallel, it doesn't perform as well. There's reasons for that, but... So I built this out, tested it against CIFAR. You know, CIFAR was the unit test. And then I went, okay, I'm going to get this working on ImageNet. And so I went through the original paper, and with CIFAR, you can... With this stuff, it was trained with a certain range of rotations, scalings, and conflations. And if you take the rotation to be with plus or minus 90 degrees, it doesn't train well. It doesn't work. So in the original paper, they mentioned, oh, you can do complete rotations. It can be stuck in any orientation. It's fine. It'll work. But what they... When you actually look at their code, they only translate it by plus or minus 15 degrees in that range, which, well, that's the first thing that I was like, this is a little bit not so good. But so with CIFAR, this thing is with their parameters, and if you go for bigger parameters and more manipulation of the affine transformations, is that curve drops off rapidly, the more you perturb the image. So for these, this is how the GIFs of the training through an ImageNet. So what I did was I grabbed four ImageNet models of the PyTorch repository. I stuck... I pointed my trainer to train against those four, and it's the same set that I trained CIFAR against. So it would be a ResNet, ResNet-50, some 2BGG. And then it would be a CIFAR. And then it would be 2BGGs and a DeepNet. So I trained that against that, and I targeted a ResNet-50-3 or one of the BGGs. And the performance I got out of this was about 10%, 5%. So it doesn't actually function as well as the paper says. The paper that they have says it should work at the same as the CIFAR curves. And I got a flat curve. I tried... I went back to their paper. They're only using 5,000 examples. They're using models that may or may not... I don't know what their models look like. Could not get the thing to work after like two months of sitting. So basically, like, welcome to AI Village. We have a novel result. So references, like, I only used, like, the original paper, and then we got Ian's panda and the stop sign. So if you guys have any questions... Yeah? Yeah? I would be able to then do a white box attack, and these were designed to be black box attacks. And it's more effective with white box attacks. I... I... If I wanted this to be a realistic attack against machine learning models, which I should... And this should be robust enough to be black box. Also one of the things that makes the image more robust to train against several models is it's supposed to be an ox. It classifies as a conch shell, but that's partially because of the T-shirt printing. So it's not... The T-shirt printing isn't sensitive enough to get the fine details required for this to overwhelm the classifier. So I started this project with, like, yeah, these adversarial patches. It looks... The paper looks awesome. I'm going to do it. And then end of the project with, like, this is not realistic. Yeah? I don't remember at this point. I... Yeah. It might... It could be that I made a mistake somewhere. Yeah. So the code that I wrote is up on GitHub. It's... And I will be writing a blog post with AI Village and describing exactly why I think this is an old result. And with all the code and it's designed to be easily readable so you can see what's going on. Yeah? Yes. Yeah. Yeah. 40%. Well, it becomes... There's a... Like, from making a few thousand of these, I have inclinations to say, you're going to get situations where... So the deeper the network, the more effective the attack. Part, I think, is because it can diffuse out more before it gets to the final, fully complete network. So, yeah. Yeah. I think... So, yeah. Yeah? Yes. I trained it on my desktop that has two 1080 TI's. And like a 670K... 6700K thing. Yeah. I also trained... I actually trained those CIFAR things and... on my Razer Blade with the 1060, so this architecture, the model parallel architecture is about seven times faster than the sequential thing because you can put it on each one in each GPU and you don't have to juggle things. So it can train in about half an hour for image against a portion of image in. You only want to train it against like maybe 10,000 images, so you don't need to go all the way. Also when you actually go to decide, okay I'm going to do this, I pick a very very aggressive step size. So their step size in the paper is 5 and I found that if you make that too low it just stops, it doesn't move. So these GIFs were made with a step size of 0.3, so make them pretty and make them actually look like they're doing something. Do you want to try that out? The code is open source on the repo. So the way I built this was with the so there's the affine grid transformation in PyTorch, which was designed for spatial sequential networks. So in those they have a training parameter to unperturbed the network. So you know you put an affine transformation on an image to do data augmentation. So these networks were designed to learn how to undo data augmentation as well as do a classification. So there the architecture that for them is a there's a pair of objects. There's operations in PyTorch that do that step and they take in parameters like that, like the scanning thing. So that affine transformation is just a grid transformation and you can feed, it's a smooth transformation, you can feed data into that thing to fix your transformations to be useful. So there's actually a paper for doing, manipulating the affine transformations. Yeah. ... I would just, if I was a specific network that I was targeting, I would just do this. I wouldn't try to do ensemble training and stuff. Just focus on that one. Yeah. No, I wouldn't have to do anything. You might be able to be a bit more pervasive in your operations. training, too. Mm-hmm. Yeah. Yes. That's the thing. When you do this, when you take this, if you allow the rotation to be sampled from within plus or minus 90 degrees, the whole system breaks down. So the rotation that is actually effective is plus or minus 30 degrees or 15 degrees. So they already pretty much say these stickers have to be sitting straight up. Straight up and nice. Yeah. Yeah, but... Yeah, but they learn how to recognize dogs that are upside down. Yeah. Mm-hmm. Um, maybe? So I tried... Sorry. Sorry. Do you want to read the question? Actually, not the question. Not the question, but dealing with the VGG22, I think the kernels there are about three multiplied matrix. So the scaling is a lower one. Okay. Um, so the scaling is the receptive field. Yeah. The receptive field at the bottom is three by three, but then you go up one layer, the receptive field at the next thing, when you go all the way back down to the image is nine by nine. And then one layer up, it's like 27 by 27. Sorry, it's not, not by nine by nine. It's five by five and then six by six. Um, it's, sorry, uh, seven by seven. So the receptive field for this, that pixel at the top of the VGG22 is, uh, three times, yeah, 22 times two plus one. So it's massive. So this pixel sees a lot. Yeah. Um, I want you to make... Yeah. Okay. Uh, yeah, we also put resonant... yeah. And the this, we tried also to also, you can try to, so the average is 20. against every architecture. Inception is also one of the ones that you can train against. So I think we're going to be... Mark Mager is the next guy? One quick question and then... I don't know if... I'm going to write the blog post and see, and then after that I'll see if I feel like continuing to work on this is fine. But I think we need to move on to our next speaker. So Mark?