WZMIAOMIAO/deep-learning-for-image-processing · critical · FileNotFoundError
VOCdevkit dose not in path:'{}'.
Error message
VOCdevkit dose not in path:'{}'. What it means
train_multi_GPU.py's main() checks that args.data_path contains a VOCdevkit directory before loading VOCSegmentation. If os.path.join(VOC_root, 'VOCdevkit') does not exist, it raises FileNotFoundError including the path, since the segmentation dataset layout is required under that folder.
Source
Thrown at pytorch_segmentation/deeplab_v3/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
- Set --data-path to the parent directory that directly contains VOCdevkit (which contains VOC2012).
- Verify the layout: <data-path>/VOCdevkit/VOC2012/ImageSets/Segmentation/train.txt must exist.
- Use an absolute path and check it exists before launching, e.g. ls $DATA_PATH/VOCdevkit.
Example fix
// before python train_multi_GPU.py --data-path ./VOCdevkit // after python train_multi_GPU.py --data-path /data # /data/VOCdevkit/VOC2012 exists
Defensive patterns
Strategy: validation
Validate before calling
import os
assert os.path.isdir(os.path.join(args.data_path, 'VOCdevkit')), \
f"VOCdevkit missing under {args.data_path}" Type guard
def has_vocdevkit(root: str) -> bool:
return os.path.isdir(os.path.join(root, 'VOCdevkit')) Try / catch
try:
main(parser_data)
except FileNotFoundError as e:
logging.error(f"Dataset layout wrong: {e}. Expected <data-path>/VOCdevkit/VOC2012"); raise Prevention
- Point --data-path at the parent of VOCdevkit, not VOCdevkit itself
- Extract the VOC2012 archive before training
- Use absolute paths and verify layout in launch scripts
When it happens
Trigger: Running multi-GPU training with --data-path pointing to a directory that lacks the VOCdevkit subfolder (wrong root, dataset not extracted, or VOC2012 tar not unpacked).
Common situations: Pointing --data-path at the VOCdevkit folder itself instead of its parent; dataset downloaded but not extracted; typo or relative path resolved from a different working directory when launched via torchrun/torch.distributed.launch.
Related errors
- VOCdevkit dose not in path:'{}'.
- VOCdevkit dose not in path:'{}'.
- not found weights file: {}
- not found weights file: {}
- not found weights file: {}
AI-assisted analysis of WZMIAOMIAO/deep-learning-for-image-processing@1ec3fe6f37 (2026-08-30).
Data as JSON: /api/errors/af8521713ecf9260.
Report an issue: GitHub.