I use google colab. colab was crash after getting this exception.
I pass the single image to model with for loop it’s working fine. but if i use dataloader then it’s returning this exception and colab was crash.
class Dataset(torch.utils.data.Dataset):
def __init__(self,inputImage):
outLabel=pd.read_csv('/content/drive/MyDrive/image_labels.csv',index_col="image")
self.outLabel=outLabel
self.imagePath=imagePath
def __len__(self):
return (len(inputImage))
def __getitem__(self,index):
target_encoded=[]
input_data=inputImage[index]
# path='/content/drive/MyDrive//images/',input_data
# path=path[0]+path[1]
# img=Image.open(path)
# # # images = images.to(device)
# # # labels = labels.to(device)
# # convert_tensor = transforms.ToTensor()
# convert_tensor = transforms.Compose([transforms.Resize(size=(720,720)),transforms.ToTensor()])
# img=convert_tensor(img)
rows = self.outLabel.loc[[input_data]]
dums=np.zeros((80,4))
lst=[]
for i in range(len(rows)):
dums[i][0],dums[i][1],dums[i][2],dums[i][3]=rows['left'][i],rows['width'][i],rows['top'][i],rows['height'][i]
# dums[i][1]=rows['width'][i]
# dums[i][2]=rows['top'][i]
# dums[i][3]=rows['height'][i]
target_encoded=torch.tensor(dums)
return input_data,target_encoded