python train.py error in windows10
Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex
Namespace(batch_size=16, bucket='', cache_images=False, cfg='myproj/config/yolov5l.yaml', data='myproj/config/obj.yaml', device='', epochs=300, evolve=False, hyp='', img_size=[640, 640], multi_scale=False, name='', noautoanchor=False, nosave=False, notest=False, rect=False, resume=False, single_cls=False, weights='')
Using CPU
Traceback (most recent call last):
File "train.py", line 402, in
tb_writer = SummaryWriter(log_dir=increment_dir('runs/exp', opt.name))
File "D:\yolov5-masterutilsutils.py", line 911, in increment_dir
n = int(float(d[:d.find('_')]) if '_' in d else d) + 1 # increment
ValueError: invalid literal for int() with base 10: 'runs\exp0'
@futureflsl we don't have any windows environments so this one is up to you to debug. If you find a solution please submit a PR.
Incidentally I see you code is out of date. Would suggest using the latest code.
I ran into this as well. This is because the glob result, d, and the dir use a different seperator on windows. One looks like runs/exp0 and the other like runs\exp0, so they don't match for the .replace() fn.
A quick fix, untested on *nix:
d = d[-1].replace(os.sep, '/').replace(dir, '')
We want to use pathlib to generate os-agnostic paths whenever necessary. For example:
https://github.com/ultralytics/yolov5/blob/611ec44359432b3a3ac510e3d407dcae1bb1b7af/utils/datasets.py#L69-L71
@glenn-jocher Agreed, the above was just a rough fix. This is actually same issue that was fixed in #344 , but somehow that change isn't currently reflected in train.py, even though it says it was merged. Maybe it was accidentally overwritten later?
Oh! That’s really strange. I’ll fix.
BTW I think we have another bug. runs/exp refuses to increment past exp10
@alexstoken @futureflsl ok just pushed a fix 98f4a5af8751e6ad41a8d5bcedae6ce5cf911c37 for this. Can you git pull and try again?
Do Anyone know if the model or code is out of date then what to do?
@glenn-jocher I need a help. It seems my code or model is out of date as you told.
Could you please tell how to resolve it?
@John12Reaper you can either git pull to update your repo, or you can redownload the zip file and transfer your existing runs directory to the new version. The first is preferred, when possible.
@glenn-jocher fix works. Also tested to exp12 with no issues. Only small "bug" is that the folders are shown higher up in the file hierarchy system since they start with a one, so it goes
runs
---exp0
---exp1
---exp10
---exp11
---exp12
---exp2
Could probably fix this by forcing string format to either two or three digits before the decimal place in the return statement of increment_dir()
@alexstoken ah, good point, but I think the presented order is os-specific, so not our department.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.