{"record":{"id":"af8521713ecf9260","repo":"WZMIAOMIAO/deep-learning-for-image-processing","slug":"vocdevkit-dose-not-in-path-af8521","errorCode":null,"errorMessage":"VOCdevkit dose not in path:'{}'.","messagePattern":"VOCdevkit dose not in path:'(.+?)'\\.","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"critical","filePath":"pytorch_segmentation/deeplab_v3/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/deeplab_v3/train_multi_GPU.py#L66-L102","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\npython train_multi_GPU.py --data-path ./VOCdevkit\n// after\npython train_multi_GPU.py --data-path /data  # /data/VOCdevkit/VOC2012 exists","handlingStrategy":"validation","validationCode":"import os\nassert os.path.isdir(os.path.join(args.data_path, 'VOCdevkit')), \\\n    f\"VOCdevkit missing under {args.data_path}\"","typeGuard":"def has_vocdevkit(root: str) -> bool:\n    return os.path.isdir(os.path.join(root, 'VOCdevkit'))","tryCatchPattern":"try:\n    main(parser_data)\nexcept FileNotFoundError as e:\n    logging.error(f\"Dataset layout wrong: {e}. Expected <data-path>/VOCdevkit/VOC2012\"); raise","preventionTips":["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"],"tags":["file-not-found","dataset-path","voc","environment"],"backgroundTag":"dataset-root-not-found","analyzedSha":"1ec3fe6f374fc9969973a61f819de25658595afa","analyzedAt":"2026-08-30T09:19:11.901Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}