WZMIAOMIAO/deep-learning-for-image-processing · error · FileNotFoundError
VOCdevkit dose not in path:'{}'.
Error message
VOCdevkit dose not in path:'{}'. What it means
The multi-GPU FCN training script checks that `<args.data_path>/VOCdevkit` exists before building datasets. If the directory is missing it raises FileNotFoundError, because VOCSegmentation would otherwise fail later with a more confusing path error. It is an early environment/data-layout guard.
Source
Thrown at pytorch_segmentation/fcn/train_multi_GPU.py:84
return model
def main(args):
init_distributed_mode(args)
print(args)
device = torch.device(args.device)
# segmentation nun_classes + background
num_classes = args.num_classes + 1
# 用来保存coco_info的文件
results_file = "results{}.txt".format(datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))
VOC_root = args.data_path
# check voc root
if os.path.exists(os.path.join(VOC_root, "VOCdevkit")) is False:
raise FileNotFoundError("VOCdevkit dose not in path:'{}'.".format(VOC_root))
# load train data set
# VOCdevkit -> VOC2012 -> ImageSets -> Segmentation -> train.txt
train_dataset = VOCSegmentation(args.data_path,
year="2012",
transforms=get_transform(train=True),
txt_name="train.txt")
# load validation data set
# VOCdevkit -> VOC2012 -> ImageSets -> Segmentation -> val.txt
val_dataset = VOCSegmentation(args.data_path,
year="2012",
transforms=get_transform(train=False),
txt_name="val.txt")
print("Creating data loaders")
if args.distributed:
train_sampler = torch.utils.data.distributed.DistributedSampler(train_dataset)
test_sampler = torch.utils.data.distributed.DistributedSampler(val_dataset)View on GitHub (pinned to 1ec3fe6f37)
Solutions
- Pass the parent directory that directly contains `VOCdevkit` via --data-path
- Verify layout: data_path/VOCdevkit/VOC2012/ImageSets/Segmentation/train.txt exists
- Use an absolute path for --data-path when launching torchrun from another CWD
- Check mount points/volume permissions if training inside a container
Example fix
// before python train_multi_GPU.py --data-path /home/data/VOCdevkit # wrong: nested too deep // after python train_multi_GPU.py --data-path /home/data # contains VOCdevkit/
Defensive patterns
Strategy: validation
Validate before calling
import os
data_path = args.data_path
assert os.path.isdir(os.path.join(data_path, 'VOCdevkit', 'VOC2012', 'ImageSets', 'Segmentation')), \
f"VOC dataset layout missing under {data_path}" Type guard
def voc_root_ok(path):
return os.path.isdir(os.path.join(path, 'VOCdevkit')) Try / catch
try:
train_dataset = VOCSegmentation(args.data_path, year="2012", ...)
except FileNotFoundError as e:
sys.exit(f"Dataset not found at {args.data_path}: {e}. Download/extract VOC2012 first.") Prevention
- Always pass the directory that contains VOCdevkit, not VOCdevkit itself
- Use absolute paths for --data-path
- Verify dataset layout on every node in multi-GPU/multi-node jobs
- Add a dataset download/extract step to your launch script
When it happens
Trigger: Running `train_multi_GPU.py` with `--data-path` pointing to a directory that does not contain a `VOCdevkit` folder; passing the VOCdevkit folder itself instead of its parent; extracting the dataset elsewhere; typo in the path or relative path resolved from the wrong CWD.
Common situations: Distributed training launched from a different working directory so relative paths break; downloading only VOC2012 images but not the SegmentationClass annotations layout; pointing at COCO root by mistake; Docker mounts missing the dataset.
Related errors
- VOCdevkit dose not in path:'{}'.
- VOCdevkit dose not in path:'{}'.
- VOCdevkit dose not in path:'{}'.
- DRIVE dose not in path:'{}'.
- image: {} isn't RGB mode.
AI-assisted analysis of WZMIAOMIAO/deep-learning-for-image-processing@1ec3fe6f37 (2026-08-30).
Data as JSON: /api/errors/274afff6760a566c.
Report an issue: GitHub.