WZMIAOMIAO/deep-learning-for-image-processing · error · FileNotFoundError
DRIVE dose not in path:'{}'.
Error message
DRIVE dose not in path:'{}'. What it means
train_multi_GPU.py validates that the DRIVE directory exists directly under args.data_path before building datasets, raising FileNotFoundError('DRIVE dose not in path:...') otherwise. It fails fast instead of letting the dataset constructor fail later with a less obvious message.
Source
Thrown at pytorch_segmentation/unet/train_multi_GPU.py:78
def main(args):
init_distributed_mode(args)
print(args)
device = torch.device(args.device)
# segmentation nun_classes + background
num_classes = args.num_classes + 1
mean = (0.709, 0.381, 0.224)
std = (0.127, 0.079, 0.043)
# 用来保存coco_info的文件
results_file = "results{}.txt".format(datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))
data_root = args.data_path
# check data root
if os.path.exists(os.path.join(data_root, "DRIVE")) is False:
raise FileNotFoundError("DRIVE dose not in path:'{}'.".format(data_root))
train_dataset = DriveDataset(args.data_path,
train=True,
transforms=get_transform(train=True, mean=mean, std=std))
val_dataset = DriveDataset(args.data_path,
train=False,
transforms=get_transform(train=False, mean=mean, std=std))
print("Creating data loaders")
if args.distributed:
train_sampler = torch.utils.data.distributed.DistributedSampler(train_dataset)
test_sampler = torch.utils.data.distributed.DistributedSampler(val_dataset)
else:
train_sampler = torch.utils.data.RandomSampler(train_dataset)
test_sampler = torch.utils.data.SequentialSampler(val_dataset)
train_data_loader = torch.utils.data.DataLoader(View on GitHub (pinned to 1ec3fe6f37)
Solutions
- Set --data-path to the parent directory CONTAINING the DRIVE folder, e.g. --data-path /data (with /data/DRIVE/... inside)
- Verify with ls $DATA_PATH/DRIVE before launching
- Check folder case sensitivity (DRIVE vs drive) on Linux
Example fix
// before python train_multi_GPU.py --data-path /data/DRIVE // after python train_multi_GPU.py --data-path /data # /data/DRIVE must exist
Defensive patterns
Strategy: validation
Validate before calling
import os
assert os.path.isdir(os.path.join(args.data_path, "DRIVE")), \
f"DRIVE folder not found under {args.data_path} — pass the parent directory" Type guard
def drive_root_ok(data_path: str) -> bool:
return os.path.isdir(os.path.join(data_path, "DRIVE")) Try / catch
try:
main(args)
except FileNotFoundError as e:
print(f"fix --data-path: {e}"); raise SystemExit(1) Prevention
- --data-path must be the PARENT of DRIVE, not DRIVE itself
- Run `ls $DATA_PATH/DRIVE` before launching multi-GPU training
- Watch Linux case sensitivity: DRIVE vs drive
When it happens
Trigger: Running multi-GPU training with --data-path pointing at a directory that does not contain a DRIVE/ subfolder (e.g. pointing at DRIVE itself rather than its parent, or a typo'd path).
Common situations: Passing .../DRIVE instead of .../ as data-path, dataset extracted to a different location than the arg, relative path resolved from the wrong working directory, or misspelled folder name (drive/Drive).
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- image: {} isn't RGB mode.
- VOCdevkit dose not in path:'{}'.
- VOCdevkit dose not in path:'{}'.
- %s does not exist
- Error loading data from {}. {}
AI-assisted analysis of WZMIAOMIAO/deep-learning-for-image-processing@1ec3fe6f37 (2026-08-30).
Data as JSON: /api/errors/a285f7e8351c476d.
Report an issue: GitHub.