簡體   English   中英

如何修復 YOLOX 中的訓練錯誤 launch:90?

[英]How to fix training error launch:90 in YOLOX?

!python tools/train.py -f exps/example/yolox_voc/yolox_voc_s.py -d 1 -b 16 --fp16  -c /content/yolox_s.pth
2022-03-29 19:24:57 | INFO     | apex.amp.frontend:356 - enabled                : True
2022-03-29 19:24:57 | INFO     | apex.amp.frontend:356 - opt_level              : O1
2022-03-29 19:24:57 | INFO     | apex.amp.frontend:356 - cast_model_type        : None
2022-03-29 19:24:57 | INFO     | apex.amp.frontend:356 - patch_torch_functions  : True
2022-03-29 19:24:57 | INFO     | apex.amp.frontend:356 - keep_batchnorm_fp32    : None
2022-03-29 19:24:57 | INFO     | apex.amp.frontend:356 - master_weights         : None
2022-03-29 19:24:57 | INFO     | apex.amp.frontend:356 - loss_scale             : dynamic
2022-03-29 19:24:57 | INFO     | yolox.core.trainer:297 - loading checkpoint for fine tuning
2022-03-29 19:24:57 | WARNING  | yolox.utils.checkpoint:27 - Shape of head.cls_preds.0.weight in checkpoint is torch.Size([80, 128, 1, 1]), while shape of head.cls_preds.0.weight in model is torch.Size([3, 128, 1, 1]).
2022-03-29 19:24:57 | WARNING  | yolox.utils.checkpoint:27 - Shape of head.cls_preds.0.bias in checkpoint is torch.Size([80]), while shape of head.cls_preds.0.bias in model is torch.Size([3]).
2022-03-29 19:24:57 | WARNING  | yolox.utils.checkpoint:27 - Shape of head.cls_preds.1.weight in checkpoint is torch.Size([80, 128, 1, 1]), while shape of head.cls_preds.1.weight in model is torch.Size([3, 128, 1, 1]).
2022-03-29 19:24:57 | WARNING  | yolox.utils.checkpoint:27 - Shape of head.cls_preds.1.bias in checkpoint is torch.Size([80]), while shape of head.cls_preds.1.bias in model is torch.Size([3]).
2022-03-29 19:24:57 | WARNING  | yolox.utils.checkpoint:27 - Shape of head.cls_preds.2.weight in checkpoint is torch.Size([80, 128, 1, 1]), while shape of head.cls_preds.2.weight in model is torch.Size([3, 128, 1, 1]).
2022-03-29 19:24:57 | WARNING  | yolox.utils.checkpoint:27 - Shape of head.cls_preds.2.bias in checkpoint is torch.Size([80]), while shape of head.cls_preds.2.bias in model is torch.Size([3]).
2022-03-29 19:24:57 | ERROR    | yolox.core.launch:90 - An error has been caught in function 'launch', process 'MainProcess' (1549), thread 'MainThread' (140243385931648):
Traceback (most recent call last):

  File "tools/train.py", line 125, in <module>
    args=(exp, args),
          │    └ Namespace(batch_size=16, ckpt='/content/yolox_s.pth', devices=1, dist_backend='nccl', dist_url=None, exp_file='exps/example/y...
          └ ╒══════════════════╤═════════════════════════════════════════════════════════════════════════════════════════════════════════...

> File "/content/apex/YOLOX/yolox/core/launch.py", line 90, in launch
    main_func(*args)
    │          └ (╒══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════...
    └ <function main at 0x7f8cf10d3e60>

  File "tools/train.py", line 104, in main
    trainer.train()
    │       └ <function Trainer.train at 0x7f8bf2234d40>
    └ <yolox.core.trainer.Trainer object at 0x7f8bec4a7a90>

  File "/content/apex/YOLOX/yolox/core/trainer.py", line 69, in train
    self.before_train()
    │    └ <function Trainer.before_train at 0x7f8bec969710>
    └ <yolox.core.trainer.Trainer object at 0x7f8bec4a7a90>

  File "/content/apex/YOLOX/yolox/core/trainer.py", line 150, in before_train
    no_aug=self.no_aug,
           │    └ False
           └ <yolox.core.trainer.Trainer object at 0x7f8bec4a7a90>

  File "exps/example/yolox_voc/yolox_voc_s.py", line 36, in get_data_loader
    max_labels=50,

  File "/content/apex/YOLOX/yolox/data/datasets/voc.py", line 115, in __init__
    os.path.join(rootpath, "ImageSets", "Main", name + ".txt")
    │  │    │    │                              └ 'trainval'
    │  │    │    └ '/content/apex/YOLOX/datasets/VOCdevkit/VOC2007'
    │  │    └ <function join at 0x7f8cf31177a0>
    │  └ <module 'posixpath' from '/usr/lib/python3.7/posixpath.py'>
    └ <module 'os' from '/usr/lib/python3.7/os.py'>

FileNotFoundError: [Errno 2] No such file or directory: '/content/apex/YOLOX/datasets/VOCdevkit/VOC2007/ImageSets/Main/trainval.txt'

該文件存在於/content/YOLOX/datasets/VOCdevkit/VOC2007/ImageSets/Main/trainval.txt但不在/content/apex/YOLOX/datasets/VOCdevkit/VOC2007/ImageSets/Main/trainval.txt

我該如何解決?

這更像是一個尋址問題,而不是機器學習問題; 無論如何,如果你正在使用並且在你的YOLOX文件夾中有帶有.pth檢查點的content文件夾,你應該像下面這樣運行命令(假設你的終端路徑在你的 YOlox 文件夾內(通過運行pwd命令檢查)):

假設您想在自定義數據集上進行訓練,您應該在此處遵循他們的指南; 例如,如果你的數據在 coco 中,你應該把它放在./datasets文件夾中

現在,如果您在文件夾./content/中下載了權重,則以下命令開始基於 yolox_s.pth 對./datasets中的圖像進行訓練,假設它們是 coco 格式。

python tools/train.py -f exps/example/yolox_voc/yolox_voc_s.py -d 1 -b 16 --fp16 -c content/yolox_s.pth

注意:路徑開頭的/指的是文件系統的開頭,但./ (或不使用它)指的是當前文件夾。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM