Adversarial attacks in the Machines Can See 2018 competition

Or how I ended up in the winning team of the Machines Can See 2018 adversarial competition.

image
The essence of any competitive attacks in the example.

It so happened that I happened to take part in the Machines Can See 2018 competition. I joined the competition quite late (about a week before the end), but eventually ended up in a team of 4 people, where the contribution of three of us (including me) was necessary to win (remove one component - and we would be an outsider).

The goal of the competition is to change people's faces so that the convolutional neural network provided as a black box by the organizers could not distinguish the source person from the target person. The allowable number of changes was limited to SSIM .

The original article is posted here .

Note The clumsy translation of terminology or its absence is dictated by the lack of established terminology in the Russian language. You can offer your options in the comments.

image
The essence of the competition is to change the face at the entrance so that the black box would not be able to distinguish between two faces (at least from the point of view of the L2 / Euclidean distance)

What works in competitive attacks and what worked in our case:


What did not work in our case:


What we did not try (did not have time, did not have enough effort or were too lazy):


About the competition in general:


Resources:


1. Overview of the competition Machines Can See 2018 and how I got into it


Competition and Approaches


Honestly, I was attracted by a new interesting area, GTX 1080Ti Founders' Edition in prizes, and relatively low competition (which would not compare with 4,000 people in any competition at Kaggle against the whole ODS with 20 GPU per team).

As mentioned above, the purpose of the competition was to deceive the ChY models, so that the latter could not distinguish between two different people (in the sense of the L2-norm / Euclidean distance). Well, since it was a black box, we had to distill the Student-network on the provided data and hope that the gradients of the BL and the BL will be quite similar to the attack.

If you read reviews of articles (for example, here and now , although such articles do not really say that they work in practice) and compile what the top teams have achieved, then we can briefly describe these best practices:


Honestly, we were still confused by the fact that two completely different end-to-end approaches, implemented independently by two different people from the team, stupidly did not work for ChI. In fact, this could mean that in our interpretation of the problem statement somewhere in the data leak was hidden, which we did not notice (or that the hands are crooked). In many modern computer vision tasks, end-to-end solutions (for example, style transfer, deep watershed, image generation, cleaning of noise and artifacts, etc.) are either much better than before, or do not work at all. Meh.

image
1. Train Student Net. 2. Apply the BJ attack on Student Net. 3. Hope that the attack on Teacher Net will spread too

How the gradient method works
image

In essence, we seek by distillation that the BJ emulates the cn. Then the gradients of the input images are calculated relative to the model output. The secret, as usual, lies in heuristics.

Target metric


The target metric was the average L2 norm (Euclidean distance) between all 25 combinations of images of sources and targets (5 * 5 = 25).

Due to platform restrictions (CodaLab), it is likely that private scoring was calculated (and the commands were merged) manually, as if this were a story.

image

Team


I joined the team, after I trained the Student grids, better than everyone else on the leaderboard (as far as I know), and after a bit of discussion with Atmyre (she helped with a correctly compiled TCH, since she faced the same thing). Then we shared our local speeds with no sharing of approaches and code, and actually 2-3 days before the finish line the following happened:


Once again, I would like to thank her for her invaluable advice and organizational skills.

Line-up:

github.com/atmyre - based on the actions, was the captain of the team initially. Added a genetic differential evolution attack in the final submission;
github.com/mortido - the best implementation of FGVM attacks with superb heuristics + trained 2 models using baseline code;
github.com/snakers4 - in addition to any tests to reduce the number of options in finding a solution, I trained 3 Student models with the best metrics + provided computing power + helped in the final submission phase and the presentation of results;
github.com/stalkermustang;

As a result, we all learned many new things thanks to each other, and I am glad that we have tried our luck in this competition. The absence of at least one contribution of the three would lead to defeat.

2. Distillation Student CNN


I managed to get better speed when training Student models, since I used my own code instead of baseline code.

Key points / what worked:



What did not work:


image
Our best models - note that the best speed is 3 * 1e-4. Judging by the complexity of the models, you can roughly imagine that the PN is ResNet34. In my tests, ResNet50 + proved to be worse than ResNet34.

image
MSE first place loss

3. Final fast and “ablation” analysis


We collected our fast like this:

image

The top solution looked like this (yes, there were jokes on the topic of what just stakes would be, you can guess that the cn is a reznet):

image

Other useful approaches from other teams:


Useful heuristics for FGVM:


Short sammari:


End-to-end solutions


Even if they failed, they should be tried again in the future on new tasks. See the details in the repository, and in fact we tried the following:


image
Continuous (end-to-end) model

image
The sequence of actions in the end-to-end model

I also think my loss is just perfect.

5. Links and additional reading materials


Source: https://habr.com/ru/post/413775/


All Articles