{"record":{"id":"274afff6760a566c","repo":"WZMIAOMIAO/deep-learning-for-image-processing","slug":"vocdevkit-dose-not-in-path-274aff","errorCode":null,"errorMessage":"VOCdevkit dose not in path:'{}'.","messagePattern":"VOCdevkit dose not in path:'(.+?)'\\.","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"pytorch_segmentation/fcn/train_multi_GPU.py","lineNumber":84,"sourceCode":"\n    return model\n\n\ndef main(args):\n    init_distributed_mode(args)\n    print(args)\n\n    device = torch.device(args.device)\n    # segmentation nun_classes + background\n    num_classes = args.num_classes + 1\n\n    # 用来保存coco_info的文件\n    results_file = \"results{}.txt\".format(datetime.datetime.now().strftime(\"%Y%m%d-%H%M%S\"))\n\n    VOC_root = args.data_path\n    # check voc root\n    if os.path.exists(os.path.join(VOC_root, \"VOCdevkit\")) is False:\n        raise FileNotFoundError(\"VOCdevkit dose not in path:'{}'.\".format(VOC_root))\n\n    # load train data set\n    # VOCdevkit -> VOC2012 -> ImageSets -> Segmentation -> train.txt\n    train_dataset = VOCSegmentation(args.data_path,\n                                    year=\"2012\",\n                                    transforms=get_transform(train=True),\n                                    txt_name=\"train.txt\")\n    # load validation data set\n    # VOCdevkit -> VOC2012 -> ImageSets -> Segmentation -> val.txt\n    val_dataset = VOCSegmentation(args.data_path,\n                                  year=\"2012\",\n                                  transforms=get_transform(train=False),\n                                  txt_name=\"val.txt\")\n\n    print(\"Creating data loaders\")\n    if args.distributed:\n        train_sampler = torch.utils.data.distributed.DistributedSampler(train_dataset)\n        test_sampler = torch.utils.data.distributed.DistributedSampler(val_dataset)","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/WZMIAOMIAO/deep-learning-for-image-processing/blob/1ec3fe6f374fc9969973a61f819de25658595afa/pytorch_segmentation/fcn/train_multi_GPU.py#L66-L102","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\npython train_multi_GPU.py --data-path /home/data/VOCdevkit   # wrong: nested too deep\n// after\npython train_multi_GPU.py --data-path /home/data             # contains VOCdevkit/","handlingStrategy":"validation","validationCode":"import os\ndata_path = args.data_path\nassert os.path.isdir(os.path.join(data_path, 'VOCdevkit', 'VOC2012', 'ImageSets', 'Segmentation')), \\\n    f\"VOC dataset layout missing under {data_path}\"","typeGuard":"def voc_root_ok(path):\n    return os.path.isdir(os.path.join(path, 'VOCdevkit'))","tryCatchPattern":"try:\n    train_dataset = VOCSegmentation(args.data_path, year=\"2012\", ...)\nexcept FileNotFoundError as e:\n    sys.exit(f\"Dataset not found at {args.data_path}: {e}. Download/extract VOC2012 first.\")","preventionTips":["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"],"tags":["file-not-found","dataset","voc","path","multi-gpu"],"backgroundTag":"missing-dataset-path","analyzedSha":"1ec3fe6f374fc9969973a61f819de25658595afa","analyzedAt":"2026-08-30T09:19:11.901Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}