WZMIAOMIAO/deep-learning-for-image-processing · error · FileNotFoundError
VOCdevkit dose not in path:'{}'.
Error message
VOCdevkit dose not in path:'{}'. What it means
train_multi_GPU.py checks that `<args.data_path>/VOCdevkit` exists before building VOCDataSet; if not, it raises FileNotFoundError. It ensures the distributed training has a valid VOC root.
Source
Thrown at pytorch_object_detection/faster_rcnn/train_multi_GPU.py:59
device = torch.device(args.device)
# 用来保存coco_info的文件
results_file = "results{}.txt".format(datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))
# Data loading code
print("Loading data")
data_transform = {
"train": transforms.Compose([transforms.ToTensor(),
transforms.RandomHorizontalFlip(0.5)]),
"val": transforms.Compose([transforms.ToTensor()])
}
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 -> Main -> train.txt
train_dataset = VOCDataSet(VOC_root, "2012", data_transform["train"], "train.txt")
# load validation data set
# VOCdevkit -> VOC2012 -> ImageSets -> Main -> val.txt
val_dataset = VOCDataSet(VOC_root, "2012", data_transform["val"], "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)
else:
train_sampler = torch.utils.data.RandomSampler(train_dataset)
test_sampler = torch.utils.data.SequentialSampler(val_dataset)
if args.aspect_ratio_group_factor >= 0:View on GitHub (pinned to 1ec3fe6f37)
Solutions
- Download/extract VOC2012 so `<data_path>/VOCdevkit` exists on every node used in the multi-GPU run
- Pass the parent of VOCdevkit via --data-path, not the VOCdevkit directory itself
- On multi-node setups, ensure the dataset is available at the same path on all ranks (shared filesystem or sync)
Example fix
# before torchrun --nproc_per_node=2 train_multi_GPU.py --data-path /data/VOCdevkit # after torchrun --nproc_per_node=2 train_multi_GPU.py --data-path /data # /data/VOCdevkit exists
Defensive patterns
Strategy: validation
Validate before calling
import os
data_path = args.data_path
assert os.path.exists(os.path.join(data_path, "VOCdevkit")), f"VOCdevkit missing under {data_path}" Try / catch
try:
launch_distributed_training(args)
except FileNotFoundError as e:
if "VOCdevkit" in str(e):
raise SystemExit(f"Dataset not found at {args.data_path}; extract VOC2012 there first.") Prevention
- Ensure the dataset exists on every node in the multi-GPU setup (shared filesystem or provisioning script)
- Pass the parent of VOCdevkit as --data-path
- Check dataset presence at startup on all ranks
When it happens
Trigger: Launching multi-GPU training with --data-path pointing to a directory lacking the VOCdevkit subfolder, or to VOCdevkit itself.
Common situations: Dataset not extracted on the training machine (common on multi-node setups where data exists only on one node); wrong --data-path value; symlink broken.
Related errors
- image: {} isn't RGB mode.
- VOCdevkit dose not in path:'{}'.
- VOCdevkit dose not in path:'{}'.
- VOCdevkit dose not in path:'{}'.
- DRIVE dose not in path:'{}'.
AI-assisted analysis of WZMIAOMIAO/deep-learning-for-image-processing@1ec3fe6f37 (2026-08-30).
Data as JSON: /api/errors/f0928fbd2179c7dc.
Report an issue: GitHub.