`def training(epoch, net, device, criterion, train_data, optimizer,tb):
“”"
Run one training epoch
:param epoch: Current epoch
:param net: Network
:param device: Torch device
:param criterion: function to evaluate the loss
:param train_data: Training Dataset
:param optimizer: Optimizer
:return:  Average Losses for Epoch
“”"
results = 0
batch_idx = 0
# change flag of training
net.train()

tic = time.perf_counter()

for sample in train_data:  
    
    toc = time.perf_counter()      
    
    batch_idx +=1

    # load of the normalized image
    img = sample['img'].to(device)
    
    # load of the ground bounding boxes
    ground_bb = sample['bb'].to(device)`

Each cycle takes too much time at loading the data. In fact trying to time the interval between before the for loop and the initial of the for loop it takes about 1 minute. How I can speed this each cycle?