[Python] tensorflow.python.framework.errors_impl.FailedPreconditionError: runs\train\exp3 is...

Discussão em 'Python' iniciado por Stack, Agosto 2, 2025.

  1. Stack

    Stack Membro Participativo

    I followed a tutorial on Yolov5,tutor fine tuned it on own data,I wanted to train it with my own data. I ran this command

    !cd yolov5 && python train.py --img 320 --batch 16 --epochs 500 --data dataset.yaml --weights yolov5s.pt --workers 2


    It creates a folder in runs everytime I run it,I have no idea how to fix it.

    github: up to date with https://github.com/ultralytics/yolov5
    YOLOv5 v7.0-210-gdd10481 Python-3.11.3 torch-2.0.1+cu118 CUDA:0 (NVIDIA GeForce RTX 3080 Laptop GPU, 16384MiB)

    hyperparameters: lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0
    Comet: run 'pip install comet_ml' to automatically track and visualize YOLOv5 runs in Comet
    TensorBoard: Start with 'tensorboard --logdir runs\train', view at http://localhost:6006/
    Traceback (most recent call last):
    File "C:\Users\OneDrive\Masaüstü\yolo\yolov5\train.py", line 647, in <module>
    main(opt)
    File "C:\Users\OneDrive\Masaüstü\yolo\yolov5\train.py", line 536, in main
    train(opt.hyp, opt, device, callbacks)
    File "C:\Users\OneDrive\Masaüstü\yolo\yolov5\train.py", line 101, in train
    loggers = Loggers(save_dir, weights, opt, hyp, LOGGER) # loggers instance
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\OneDrive\Masaüstü\yolo\yolov5\utils\loggers\__init__.py", line 100, in __init__
    self.tb = SummaryWriter(str(s))
    ^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\tensorboard\writer.py", line 247, in __init__
    self._get_file_writer()
    File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\tensorboard\writer.py", line 277, in _get_file_writer
    self.file_writer = FileWriter(
    ^^^^^^^^^^^
    File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\tensorboard\writer.py", line 76, in __init__
    self.event_writer = EventFileWriter(
    ^^^^^^^^^^^^^^^^
    File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorboard\summary\writer\event_file_writer.py", line 72, in __init__
    tf.io.gfile.makedirs(logdir)
    File "C:\Users\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\python\lib\io\file_io.py", line 513, in recursive_create_dir_v2
    _pywrap_file_io.RecursivelyCreateDir(compat.path_to_bytes(path))
    tensorflow.python.framework.errors_impl.FailedPreconditionError: runs\train\exp3 is not a directory


    also, my dataset.yaml file looks like this

    path: data
    train: data/images/
    val: data/images/

    nc: 17
    names: [ "dog","person","cat","tv","car","meatballs","marinara sauce","tomato soup",
    "chicken noodle soup","french onion soup","chicken breast","ribs",
    "pulled pork","hamburger","cavity","User","Sunglasses"] # User and Sunglasses are my own labels```

    Continue reading...

Compartilhe esta Página