{"record":{"id":"5ae19df590c5bde4","repo":"WZMIAOMIAO/deep-learning-for-image-processing","slug":"vocdevkit-dose-not-in-path-5ae19d","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/retinaNet/train_multi_GPU.py","lineNumber":60,"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":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/WZMIAOMIAO/deep-learning-for-image-processing/blob/1ec3fe6f374fc9969973a61f819de25658595afa/pytorch_object_detection/retinaNet/train_multi_GPU.py#L42-L78","documentation":"Raised as FileNotFoundError in the multi-GPU RetinaNet training entry point when args.data_path does not contain a 'VOCdevkit' subdirectory. The script checks the VOC dataset root up-front before building datasets, since VOCDataSet expects VOC_root/VOCdevkit/VOC2012/... layout. It is a data-path configuration error, not a code bug.","triggerScenarios":"Running train_multi_GPU.py with --data-path pointing to a directory that does not exist, points to the VOCdevkit folder itself (one level too deep), or points to a parent that lacks the VOCdevkit extraction of the VOC2012 dataset.","commonSituations":"Downloaded the VOC2012 tar but extracted it elsewhere or renamed it; passing a relative path from a different working directory; passing the path to VOCdevkit instead of its parent; forgetting to download the dataset on a training server.","solutions":["Verify the directory layout: args.data_path must be the parent folder containing VOCdevkit/ (i.e. data_path/VOCdevkit/VOC2012 exists)","Extract the VOC2012 dataset (e.g. tar -xvf VOCtrainval_11-May-2012.tar) into the given data-path","Pass an absolute path to --data-path to avoid working-directory issues","ls the path given in the message to confirm it exists and contains VOCdevkit"],"exampleFix":"// before\npython train_multi_GPU.py --data-path ./VOCdevkit\n// after\npython train_multi_GPU.py --data-path /data/VOC  # contains /data/VOC/VOCdevkit/VOC2012","handlingStrategy":"validation","validationCode":"import os\ndata_path = args.data_path\nassert os.path.isdir(os.path.join(data_path, 'VOCdevkit', 'VOC2012')), f'VOC2012 not under {data_path}'","typeGuard":"def has_vocdevkit(root: str) -> bool:\n    return os.path.isdir(os.path.join(root, 'VOCdevkit'))","tryCatchPattern":"try:\n    main(args)\nexcept FileNotFoundError as e:\n    print(f'Dataset root misconfigured: {e}. Fix --data-path to contain VOCdevkit/.')","preventionTips":["Always pass the parent of VOCdevkit as --data-path, not VOCdevkit itself","Verify dataset presence with a smoke ls command before launching multi-GPU jobs","Use absolute paths in launch scripts"],"tags":["filesystem","dataset","config","pytorch"],"backgroundTag":"dataset-root-path-missing","analyzedSha":"1ec3fe6f374fc9969973a61f819de25658595afa","analyzedAt":"2026-08-30T09:19:11.901Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}