I am trying to train a YoloV5 model with my custom data. I am trying to train on my own computer (because Google Colab disconnects if I go AFK, and my dataset is ~3000 images, so it is really big), but I keep getting this error:
train: weights=yolov5s.pt, cfg=models/yolov5s.yaml, data=data.yaml, hyp=datahypshyp.scratch-low.yaml, epochs=300, batch_size=32, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, evolve_population=datahyps, resume_evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runstrain, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest, ndjson_console=False, ndjson_file=False
github: skipping check (not a git repository), for updates see https://github.com/ultralytics/yolov5
YOLOv5 2024-7-15 Python-3.12.2 torch-2.3.1+cpu CPU
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
TensorBoard: Start with 'tensorboard --logdir runstrain', view at http://localhost:6006/
Traceback (most recent call last):
File "C:UsersUsuárioyolov5_work2024yolov5-mastertrain.py", line 986, in <module>
main(opt)
File "C:UsersUsuárioyolov5_work2024yolov5-mastertrain.py", line 688, in main
train(opt.hyp, opt, device, callbacks)
File "C:UsersUsuárioyolov5_work2024yolov5-mastertrain.py", line 180, in train
loggers = Loggers(
^^^^^^^^
File "C:UsersUsuárioyolov5_work2024yolov5-masterutilsloggers__init__.py", line 121, in __init__
self.tb = SummaryWriter(str(s))
^^^^^^^^^^^^^^^^^^^^^
File "C:UsersUsuárioAppDataLocalProgramsPythonPython312Libsite-packagestorchutilstensorboardwriter.py", line 249, in __init__
self._get_file_writer()
File "C:UsersUsuárioAppDataLocalProgramsPythonPython312Libsite-packagestorchutilstensorboardwriter.py", line 281, in _get_file_writer
self.file_writer = FileWriter(
^^^^^^^^^^^
File "C:UsersUsuárioAppDataLocalProgramsPythonPython312Libsite-packagestorchutilstensorboardwriter.py", line 75, in __init__
self.event_writer = EventFileWriter(**
^^^^^^^^^^^^^^^^
File "C:UsersUsuárioAppDataLocalProgramsPythonPython312Libsite-packagestensorboardsummarywriterevent_file_writer.py", line 72, in __init__
tf.io.gfile.makedirs(logdir)
File "C:UsersUsuárioAppDataLocalProgramsPythonPython312Libsite-packagestensorflowpythonlibiofile_io.py", line 513, in recursive_create_dir_v2
_pywrap_file_io.RecursivelyCreateDir(compat.path_to_bytes(path))
tensorflow.python.framework.errors_impl.FailedPreconditionError: runstrainexp10 is not a directory
I have tried training my model from a pre-trained one (as the yolov5 docs recommend), like this:
python train.py --img 640 --batch 32 --epochs 300 --data data.yaml --weights yolov5s.pt
or from scratch, like this:
python train.py --img 640 --batch 32 --epochs 300 --data data.yaml --cfg models/yolov5s.yaml
I have also seen other issues, like issue #12008 on GitHub and this issue from Stack Overflow tensorflow.python.framework.errors_impl.FailedPreconditionError: runstrainexp3 is not a directory, but havent found any solution