'pytorch dataset python script does not run in colab

I've decided to make reusable scripts for frequently used classes. So, i made one for my image dataset and imported it in collab. I can create the dataset object successfully but can't get data from it.

here is my dataset code: https://pastebin.com/XfAiTe3A

Here is how i use the script in google colab:

from imageDataset import customDataset
dataset = customDataset(train_data)\
dataset[0]

Here is the error:

     16         target = self.targets[index]
---> 17         image = io.imread(self.image_paths[index])
     18 
     19         if self.augmentations is not None:

SystemError: <built-in function imread> returned NULL without setting an error

But if i copy paste the code in a jupyter cell , i can use the class like i normally do. What I'm i doing wrong?

any help is appreciated, thanks



Solution 1:[1]

I just had to rerun the notebook and the problem fixed itself. Coding truly amazes me

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 default-303