Megvii-BaseDetection / Megvii-BaseDetection/YOLOX

AttributeError: 'Exp' object has no attribute 'perspective'

Open
#1,188 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

I used the latest code of 3.19 to train my data set on nano and found such an error. How can I solve this problem

(mypytorch) D:\ProgramData\YOLOX>python tools/train.py -f exps/example/yolox_voc/yolox_voc_nano.py -d 1 -b 16 --fp16 -o -c weights/yolox_nano.pth --cache
2022-03-18 23:52:55 | INFO | yolox.core.trainer:129 - args: Namespace(batch_size=16, cache=True, ckpt='weights/yolox_nano.pth', devices=1, dist_backend='nccl', dist_url=None, exp_file='exps/example/yolox_voc/yolox_voc_nano.py', experiment_name='yolox_voc_nano', fp16=True, logger='tensorboard', machine_rank=0, name=None, num_machines=1, occupy=True, opts=[], resume=False, start_epoch=None)
2022-03-18 23:52:55 | INFO | yolox.core.trainer:130 - exp value:
╒═══════════════════╤════════════════════════════╕
│ keys │ values │
╞═══════════════════╪════════════════════════════╡
│ seed │ None │
├───────────────────┼────────────────────────────┤
│ output_dir │ './YOLOX_outputs' │
├───────────────────┼────────────────────────────┤
│ print_interval │ 10 │
├───────────────────┼────────────────────────────┤
│ eval_interval │ 10 │
├───────────────────┼────────────────────────────┤
│ num_classes │ 1 │
├───────────────────┼────────────────────────────┤
│ depth │ 0.33 │
├───────────────────┼────────────────────────────┤
│ width │ 0.25 │
├───────────────────┼────────────────────────────┤
│ act │ 'silu' │
├───────────────────┼────────────────────────────┤
│ data_num_workers │ 4 │
├───────────────────┼────────────────────────────┤
│ input_size │ (416, 416) │
├───────────────────┼────────────────────────────┤
│ multiscale_range │ 5 │
├───────────────────┼────────────────────────────┤
│ data_dir │ None │
├───────────────────┼────────────────────────────┤
│ train_ann │ 'instances_train2017.json' │
├───────────────────┼────────────────────────────┤
│ val_ann │ 'instances_val2017.json' │
├───────────────────┼────────────────────────────┤
│ test_ann │ 'instances_test2017.json' │
├───────────────────┼────────────────────────────┤
│ mosaic_prob │ 0.5 │
├───────────────────┼────────────────────────────┤
│ mixup_prob │ 1.0 │
├───────────────────┼────────────────────────────┤
│ hsv_prob │ 1.0 │
├───────────────────┼────────────────────────────┤
│ flip_prob │ 0.5 │
├───────────────────┼────────────────────────────┤
│ degrees │ 10.0 │
├───────────────────┼────────────────────────────┤
│ translate │ 0.1 │
├───────────────────┼────────────────────────────┤
│ mosaic_scale │ (0.5, 1.5) │
├───────────────────┼────────────────────────────┤
│ enable_mixup │ False │
├───────────────────┼────────────────────────────┤
│ mixup_scale │ (0.5, 1.5) │
├───────────────────┼────────────────────────────┤
│ shear │ 2.0 │
├───────────────────┼────────────────────────────┤
│ warmup_epochs │ 1 │
├───────────────────┼────────────────────────────┤
│ max_epoch │ 300 │
├───────────────────┼────────────────────────────┤
│ warmup_lr │ 0 │
├───────────────────┼────────────────────────────┤
│ min_lr_ratio │ 0.05 │
├───────────────────┼────────────────────────────┤
│ basic_lr_per_img │ 0.00015625 │
├───────────────────┼────────────────────────────┤
│ scheduler │ 'yoloxwarmcos' │
├───────────────────┼────────────────────────────┤
│ no_aug_epochs │ 15 │
├───────────────────┼────────────────────────────┤
│ ema │ True │
├───────────────────┼────────────────────────────┤
│ weight_decay │ 0.0005 │
├───────────────────┼────────────────────────────┤
│ momentum │ 0.9 │
├───────────────────┼────────────────────────────┤
│ save_history_ckpt │ True │
├───────────────────┼────────────────────────────┤
│ exp_name │ 'yolox_voc_nano' │
├───────────────────┼────────────────────────────┤
│ test_size │ (416, 416) │
├───────────────────┼────────────────────────────┤
│ test_conf │ 0.01 │
├───────────────────┼────────────────────────────┤
│ nmsthre │ 0.65 │
├───────────────────┼────────────────────────────┤
│ random_size │ (10, 20) │
╘═══════════════════╧════════════════════════════╛
2022-03-18 23:52:55 | INFO | yolox.core.trainer:135 - Model Summary: Params: 0.90M, Gflops: 1.04
2022-03-18 23:52:55 | INFO | yolox.core.trainer:307 - loading checkpoint for fine tuning
2022-03-18 23:52:55 | WARNING | yolox.utils.checkpoint:24 - Shape of head.cls_preds.0.weight in checkpoint is torch.Size([80, 64, 1, 1]), while shape of head.cls_preds.0.weight in model is torch.Size([1, 64, 1, 1]).
2022-03-18 23:52:55 | WARNING | yolox.utils.checkpoint:24 - 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([1]).
2022-03-18 23:52:55 | WARNING | yolox.utils.checkpoint:24 - Shape of head.cls_preds.1.weight in checkpoint is torch.Size([80, 64, 1, 1]), while shape of head.cls_preds.1.weight in model is torch.Size([1, 64, 1, 1]).
2022-03-18 23:52:55 | WARNING | yolox.utils.checkpoint:24 - 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([1]).
2022-03-18 23:52:55 | WARNING | yolox.utils.checkpoint:24 - Shape of head.cls_preds.2.weight in checkpoint is torch.Size([80, 64, 1, 1]), while shape of head.cls_preds.2.weight in model is torch.Size([1, 64, 1, 1]).
2022-03-18 23:52:55 | WARNING | yolox.utils.checkpoint:24 - 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([1]).
2022-03-18 23:52:57 | WARNING | yolox.data.datasets.voc:143 -


You are using cached images in RAM to accelerate training.
This requires large system RAM.
Make sure you have 60G+ RAM and 19G available disk space for training VOC.


2022-03-18 23:52:57 | INFO | yolox.data.datasets.voc:154 - Caching images for the first time. This might take about 3 minutes for VOC
100%|#############################################################################| 1743/1743 [00:08<00:00, 215.56it/s]
2022-03-18 23:53:06 | INFO | yolox.data.datasets.voc:183 - Loading cached imgs...
2022-03-18 23:53:06 | ERROR | yolox.core.launch:98 - An error has been caught in function 'launch', process 'MainProcess' (6496), thread 'MainThread' (8588):
Traceback (most recent call last):

File "tools\train.py", line 132, in
launch(
└ <function launch at 0x000002AA12D21670>

File "d:\programdata\yolox\yolox\core\launch.py", line 98, in launch
main_func(*args)
│ └ (╒═══════════════════╤═══════════════════════════════════════════════════════════════════════════════════════════════════════...
└ <function main at 0x000002AA144790D0>

File "tools\train.py", line 117, in main
trainer.train()
│ └ <function Trainer.train at 0x000002AA137A8820>
└ <yolox.core.trainer.Trainer object at 0x000002AA1446C430>

File "d:\programdata\yolox\yolox\core\trainer.py", line 73, in train
self.before_train()
│ └ <function Trainer.before_train at 0x000002AA144783A0>
└ <yolox.core.trainer.Trainer object at 0x000002AA1446C430>

File "d:\programdata\yolox\yolox\core\trainer.py", line 148, in before_train
self.train_loader = self.exp.get_data_loader(
│ │ │ └ <function Exp.get_data_loader at 0x000002AA1448C280>
│ │ └ ╒═══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════...
│ └ <yolox.core.trainer.Trainer object at 0x000002AA1446C430>
└ <yolox.core.trainer.Trainer object at 0x000002AA1446C430>

File "D:\ProgramData\YOLOX\exps/example/yolox_voc\yolox_voc_nano.py", line 90, in get_data_loader
perspective=self.perspective,
└ ╒═══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════...

AttributeError: 'Exp' object has no attribute 'perspective'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with exps/example/yolox_voc/yolox_voc_nano.py at line 90, where get_data_loader accesses perspective, then inspect the Exp definition and related experiment files for the corresponding setting. Re-run the reported tools/train.py command after the change; done means data-loader creation proceeds without the AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.