Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion deepsecure/adv_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,21 @@ def train(self, train_dataloader, epochs):
lr=0.00001)
loss_adv_sum = 0
self.ite = epoch

# Iterate over the training data loader
for i, data in enumerate(train_dataloader, start=0):
# Unpack the current batch of images and labels
images, labels = data

# Move the images and labels to the specified device (e.g., GPU or CPU)
images, labels = images.to(self.device), labels.to(self.device)


# Perform training for the current batch and obtain adversarial loss and adversarial images
loss_adv_batch, adv_img = self.train_batch(images)

# Accumulate the adversarial loss over all batches
loss_adv_sum += loss_adv_batch



# print statistics
Expand Down