PixelLink-with-pytorch icon indicating copy to clipboard operation
PixelLink-with-pytorch copied to clipboard

Problem in training.

Open vdsprakash opened this issue 6 years ago • 1 comments

File "main.py", line 138, in main() File "main.py", line 128, in main train(config.epoch, iteration, dataloader, my_net, optimizer, optimizer2, device) File "main.py", line 59, in train for i_batch, sample in enumerate(dataloader): File "/home/denny/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 317, in next batch = self.collate_fn([self.dataset[i] for i in indices]) File "/home/denny/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 317, in batch = self.collate_fn([self.dataset[i] for i in indices]) File "/home/denny/github_open_Sources/PixelLink-with-pytorch/datasets.py", line 84, in getitem image, label = self.train_data_transform(index) File "/home/denny/github_open_Sources/PixelLink-with-pytorch/datasets.py", line 103, in train_data_transform img = self.read_image(self.images_dir, index) File "/home/denny/github_open_Sources/PixelLink-with-pytorch/datasets.py", line 34, in read_image image = ImgTransform.ReadImage(filename) File "/home/denny/github_open_Sources/PixelLink-with-pytorch/ImgLib/ImgTransform.py", line 16, in ReadImage with Image.open(filename) as img: File "/home/denny/anaconda3/envs/pytorch/lib/python3.6/site-packages/PIL/Image.py", line 2609, in open fp = builtins.open(filename, "rb") FileNotFoundError: [Errno 2] No such file or directory: 'training_images/images/img_tensor(956).jpg'

vdsprakash avatar Feb 19 '19 12:02 vdsprakash

because the type of index is Tensor. you can useindex = int(index) + 1 to solve the issue.

fanjianing avatar May 06 '20 10:05 fanjianing