{"record":{"id":"f0928fbd2179c7dc","repo":"WZMIAOMIAO/deep-learning-for-image-processing","slug":"vocdevkit-dose-not-in-path-f0928f","errorCode":null,"errorMessage":"VOCdevkit dose not in path:'{}'.","messagePattern":"VOCdevkit dose not in path:'(.+?)'\\.","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"pytorch_object_detection/faster_rcnn/train_multi_GPU.py","lineNumber":59,"sourceCode":"\n    device = torch.device(args.device)\n\n    # 用来保存coco_info的文件\n    results_file = \"results{}.txt\".format(datetime.datetime.now().strftime(\"%Y%m%d-%H%M%S\"))\n\n    # Data loading code\n    print(\"Loading data\")\n\n    data_transform = {\n        \"train\": transforms.Compose([transforms.ToTensor(),\n                                     transforms.RandomHorizontalFlip(0.5)]),\n        \"val\": transforms.Compose([transforms.ToTensor()])\n    }\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 -> Main -> train.txt\n    train_dataset = VOCDataSet(VOC_root, \"2012\", data_transform[\"train\"], \"train.txt\")\n\n    # load validation data set\n    # VOCdevkit -> VOC2012 -> ImageSets -> Main -> val.txt\n    val_dataset = VOCDataSet(VOC_root, \"2012\", data_transform[\"val\"], \"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)\n    else:\n        train_sampler = torch.utils.data.RandomSampler(train_dataset)\n        test_sampler = torch.utils.data.SequentialSampler(val_dataset)\n\n    if args.aspect_ratio_group_factor >= 0:","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/WZMIAOMIAO/deep-learning-for-image-processing/blob/1ec3fe6f374fc9969973a61f819de25658595afa/pytorch_object_detection/faster_rcnn/train_multi_GPU.py#L41-L77","documentation":"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.","triggerScenarios":"Launching multi-GPU training with --data-path pointing to a directory lacking the VOCdevkit subfolder, or to VOCdevkit itself.","commonSituations":"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.","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)"],"exampleFix":"# before\ntorchrun --nproc_per_node=2 train_multi_GPU.py --data-path /data/VOCdevkit\n# after\ntorchrun --nproc_per_node=2 train_multi_GPU.py --data-path /data  # /data/VOCdevkit exists","handlingStrategy":"validation","validationCode":"import os\ndata_path = args.data_path\nassert os.path.exists(os.path.join(data_path, \"VOCdevkit\")), f\"VOCdevkit missing under {data_path}\"","typeGuard":null,"tryCatchPattern":"try:\n    launch_distributed_training(args)\nexcept FileNotFoundError as e:\n    if \"VOCdevkit\" in str(e):\n        raise SystemExit(f\"Dataset not found at {args.data_path}; extract VOC2012 there first.\")","preventionTips":["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"],"tags":["python","filenotfound","dataset","multi-gpu"],"backgroundTag":"missing-dataset-path","analyzedSha":"1ec3fe6f374fc9969973a61f819de25658595afa","analyzedAt":"2026-08-30T09:19:11.901Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}