semantic-segmentation-pytorch
semantic-segmentation-pytorch copied to clipboard
Permission denied error due to race condition (?)
I get the following error when I run inference:
[2019-10-30 15:33:25,356 INFO test.py line 173 9944] Loaded configuration file config/ade20k-hrnetv2.yaml
[2019-10-30 15:33:25,356 INFO test.py line 174 9944] Running with config:
DATASET:
imgMaxSize: 1000
imgSizes: (300, 375, 450, 525, 600)
list_train: ./data/training.odgt
list_val: ./data/validation.odgt
num_class: 150
padding_constant: 32
random_flip: True
root_dataset: ./data/
segm_downsampling_rate: 4
DIR: ckpt/ade20k-hrnetv2-c1
MODEL:
arch_decoder: c1
arch_encoder: hrnetv2
fc_dim: 720
weights_decoder:
weights_encoder:
TEST:
batch_size: 1
checkpoint: epoch_30.pth
result: ./
TRAIN:
batch_size_per_gpu: 2
beta1: 0.9
deep_sup_scale: 0.4
disp_iter: 20
epoch_iters: 5000
fix_bn: False
lr_decoder: 0.02
lr_encoder: 0.02
lr_pow: 0.9
num_epoch: 30
optim: SGD
seed: 304
start_epoch: 0
weight_decay: 0.0001
workers: 16
VAL:
batch_size: 1
checkpoint: epoch_30.pth
visualize: False
Loading weights for net_encoder
Loading weights for net_decoder
# samples: 1
0%| | 0/1 [00:00<?, ?it/s]Traceback (most recent call last):
File "C:/Users/sarim/PycharmProjects/thesis/semantic_segmentation/test.py", line 201, in <module>
main(cfg, args.gpu)
File "C:/Users/sarim/PycharmProjects/thesis/semantic_segmentation/test.py", line 128, in main
test(segmentation_module, loader_test, gpu)
File "C:/Users/sarim/PycharmProjects/thesis/semantic_segmentation/test.py", line 59, in test
for batch_data in loader:
File "C:\Users\sarim\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 582, in __next__
return self._process_next_batch(batch)
File "C:\Users\sarim\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\dataloader.py", line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
PermissionError: Traceback (most recent call last):
File "C:\Users\sarim\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\_utils\worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "C:\Users\sarim\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\utils\data\_utils\worker.py", line 99, in <listcomp>
samples = collate_fn([dataset[i] for i in batch_indices])
File "C:\Users\sarim\PycharmProjects\thesis\semantic_segmentation\dataset.py", line 266, in __getitem__
img = Image.open(image_path).convert('RGB')
File "C:\Users\sarim\AppData\Local\Programs\Python\Python37\lib\site-packages\PIL\Image.py", line 2770, in open
fp = builtins.open(filename, "rb")
PermissionError: [Errno 13] Permission denied: 'D:/kitti/training/image_02/0000'
I set num_workers to 0 and 1 in the dataloader :
# Dataset and Loader
dataset_test = TestDataset(
cfg.list_test,
cfg.DATASET)
loader_test = torch.utils.data.DataLoader(
dataset_test,
batch_size=cfg.TEST.batch_size,
shuffle=False,
collate_fn=user_scattered_collate,
num_workers=1,
drop_last=True)
But I still get the same error.