Skip to content

Implement Defense GAN defender#7

Open
sribnyak wants to merge 13 commits into
AIRI-Institute:mainfrom
sribnyak:defense_gan_defender
Open

Implement Defense GAN defender#7
sribnyak wants to merge 13 commits into
AIRI-Institute:mainfrom
sribnyak:defense_gan_defender

Conversation

@sribnyak

@sribnyak sribnyak commented Jul 31, 2024

Copy link
Copy Markdown

Cr.: Иван Галкин, Иван Конюшенко, Александр Срибняк, Ренат Харисов

@vpozdnyakov vpozdnyakov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно доработать, оставил комментарии

self.noise_size = noise_size
super().__init__()
self.model = nn.Sequential(
nn.Linear(100, 256),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

наверное тут должно быть nn.Linear(noise_size, 256)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

256 лучше не хардкодить, а дать пользователю возможность указать

noise_size: int = 256):
self.num_sensors = num_sensors
self.window_size = window_size
self.noise_size = noise_size

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем хранить размер шума? он вроде нигде не используется

nn.LeakyReLU(True),
nn.Linear(256, 256),
nn.LeakyReLU(True),
nn.Linear(256, 256),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

количество слоев лучше тоже указывать в параметре

return self.model(x).view(-1, self.window_size, self.num_sensors)


class Discriminator(nn.Module):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

аналогичные комментарии как и для генератора. добавить число слоев и размерность в виде параметров

return self.model(x)


class DefenseGanDefender(BaseDefender):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не очень удачное название, два раза повторяется слово defense. пусть будет просто GANDefender

return self.model.predict(np.stack(approximations))


# GRU version

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не надо добавлять комментарии между классами


# GRU version

class SelectItem(nn.Module):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

что это за класс? для чего он нужен?

self.noise_size = noise_size
super().__init__()
self.model = nn.Sequential(
nn.GRU(self.noise_size, 128, num_layers=1, batch_first=True),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

128 не надо харкодить, вынести в параметры

return self.model(x)


class GRUDiscriminator(nn.Module):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

128 не надо харкодить, вынести в параметры

return self.model(x)


class GRUDefenseGanDefender(BaseDefender):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в чем отличие этого класса от DefenseGANDefender? если только в том что разные архитектуры генератора и дискриминатора, то лучше это внутри одного класса сделать.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants