{"record":{"id":"4dcc394d7d47a7fc","repo":"WZMIAOMIAO/deep-learning-for-image-processing","slug":"vocdevkit-dose-not-in-path-4dcc39","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/lraspp/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/lraspp/train_multi_GPU.py#L66-L102","documentation":"Same guard as error 153 but in the LRASPP multi-GPU training script: before building VOCSegmentation datasets it verifies `<args.data_path>/VOCdevkit` exists and raises FileNotFoundError if not. It enforces the expected VOC dataset directory layout early with a clear message.","triggerScenarios":"`--data-path` set to the VOCdevkit dir itself or a non-dataset directory; dataset not downloaded/extracted on the node running rank 0; relative path resolved from a different CWD under torchrun; symlink broken after moving data.","commonSituations":"Multi-node training where only some nodes have the dataset mounted; job schedulers resetting CWD; sharing a script where teammates keep data at different paths; forgetting to run the download/extract step before launching 4/8-GPU training.","solutions":["Point --data-path at the parent directory containing VOCdevkit/","Create the correct layout: data_path/VOCdevkit/VOC2012/{ImageSets/Segmentation,JPEGImages,SegmentationClass}","Use absolute paths or $DATA_ROOT env var; verify on every node before torchrun","Re-extract the VOC2012 archive if VOCdevkit is genuinely missing"],"exampleFix":"// before\npython -m torch.distributed.run --nproc_per_node=4 train_multi_GPU.py --data-path ./VOCdevkit\n// after\npython -m torch.distributed.run --nproc_per_node=4 train_multi_GPU.py --data-path /data/VOC2012_train_val  # dir contains VOCdevkit/","handlingStrategy":"validation","validationCode":"import os\nassert os.path.isdir(os.path.join(args.data_path, 'VOCdevkit', 'VOC2012')), \\\n    f\"VOC root invalid: {args.data_path}\"","typeGuard":"def voc_layout_ok(path):\n    return os.path.isdir(os.path.join(path, 'VOCdevkit', 'VOC2012', 'SegmentationClass'))","tryCatchPattern":"try:\n    train_dataset = VOCSegmentation(args.data_path, year=\"2012\", ...)\nexcept FileNotFoundError as e:\n    raise SystemExit(f\"VOC dataset missing under {args.data_path}: {e}\")","preventionTips":["Point --data-path to the parent of VOCdevkit","Verify dataset presence on every rank/node before torchrun","Keep a DATA_ROOT env var and resolve paths from it","Run a preflight script that checks VOCdevkit/VOC2012 layout before training"],"tags":["file-not-found","dataset","voc","lraspp","multi-gpu"],"backgroundTag":"missing-dataset-path","analyzedSha":"1ec3fe6f374fc9969973a61f819de25658595afa","analyzedAt":"2026-08-30T09:19:11.901Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}