Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtdetrv2使用coco数据集训练报错 Missing inject for type style #503

Open
xiaocongxin opened this issue Dec 2, 2024 · 4 comments
Open
Assignees

Comments

@xiaocongxin
Copy link

Star RTDETR
请先在RTDETR主页点击star以支持本项目
Star RTDETR to help more people discover this project.


Describe the bug
A clear and concise description of what the bug is.
If applicable, add screenshots to help explain your problem.

To Reproduce
Steps to reproduce the behavior.
RT-DETR-main/rtdetrv2_pytorch/tools/../src/core/workspace.py", line 151, in create raise ValueError(f'Missing inject for typestyle.') ValueError: Missing inject fortype style.

@lyuwenyu
Copy link
Owner

lyuwenyu commented Dec 2, 2024

可以提供完整的log吗;另外执行脚本的时候 工作目录要切到RT-DETR-main/rtdetrv2_pytorch/

@xiaocongxin
Copy link
Author

可以提供完整的log吗;另外执行脚本的时候 工作目录要切到RT-DETR-main/rtdetrv2_pytorch/

` python tools/train.py -c configs/rtdetrv2/rtdetrv2_r18vd_120e_coco.yml

Not init distributed mode.
cfg: {'task': 'detection', '_model': None, '_postprocessor': None, '_criterion': None, '_optimizer': None, '_lr_scheduler': None, '_lr_warmup_scheduler': None, '_train_dataloader': None, '_val_dataloader': None, '_ema': None, '_scaler': None, '_train_dataset': None, '_val_dataset': None, '_collate_fn': None, '_evaluator': None, '_writer': None, 'num_workers': 0, 'batch_size': None, '_train_batch_size': None, '_val_batch_size': None, '_train_shuffle': None, '_val_shuffle': None, 'resume': None, 'tuning': None, 'epoches': 30, 'last_epoch': -1, 'use_amp': False, 'use_ema': True, 'ema_decay': 0.9999, 'ema_warmups': 2000, 'sync_bn': True, 'clip_max_norm': 0.1, 'find_unused_parameters': False, 'seed': None, 'print_freq': 100, 'checkpoint_freq': 1, 'output_dir': './output/rtdetrv2_r18vd_120e_coco', 'summary_dir': None, 'device': '', 'yaml_cfg': {'task': 'detection', 'evaluator': {'type': 'CocoEvaluator', 'iou_types': ['bbox']}, 'num_classes': 80, 'remap_mscoco_category': True, 'train_dataloader': {'type': 'DataLoader', 'dataset': {'img_folder': './dataset/coco/train2017/', 'ann_file': './dataset/coco/annotations/instances_train2017.json', 'return_masks': False, 'transforms': {'type': 'Compose', 'ops': [{'type': 'RandomPhotometricDistort', 'p': 0.5}, {'type': 'RandomZoomOut', 'fill': 0}, {'type': 'RandomIoUCrop', 'p': 0.8}, {'type': 'SanitizeBoundingBoxes', 'min_size': 1}, {'type': 'RandomHorizontalFlip'}, {'type': 'Resize', 'size': [640, 640]}, {'type': 'SanitizeBoundingBoxes', 'min_size': 1}, {'type': 'ConvertPILImage', 'dtype': 'float32', 'scale': True}, {'type': 'ConvertBoxes', 'fmt': 'cxcywh', 'normalize': True}], 'policy': {'name': 'stop_epoch', 'epoch': 117, 'ops': ['RandomPhotometricDistort', 'RandomZoomOut', 'RandomIoUCrop']}}}, 'shuffle': True, 'num_workers': 4, 'drop_last': True, 'collate_fn': {'type': 'BatchImageCollateFuncion', 'scales': None, 'stop_epoch': 71}, 'total_batch_size': 16}, 'val_dataloader': {'type': 'DataLoader', 'dataset': {'type': 'CocoDetection', 'img_folder': './dataset/coco/val2017/', 'ann_file': './dataset/coco/annotations/instances_val2017.json', 'return_masks': False, 'transforms': {'type': 'Compose', 'ops': [{'type': 'Resize', 'size': [640, 640]}, {'type': 'ConvertPILImage', 'dtype': 'float32', 'scale': True}]}}, 'shuffle': False, 'num_workers': 4, 'drop_last': False, 'collate_fn': {'type': 'BatchImageCollateFuncion'}, 'total_batch_size': 32}, 'print_freq': 100, 'output_dir': './output/rtdetrv2_r18vd_120e_coco', 'checkpoint_freq': 1, 'sync_bn': True, 'find_unused_parameters': False, 'use_amp': False, 'scaler': {'type': 'GradScaler', 'enabled': True}, 'use_ema': True, 'ema': {'type': 'ModelEMA', 'decay': 0.9999, 'warmups': 2000}, 'epoches': 30, 'clip_max_norm': 0.1, 'optimizer': {'type': 'AdamW', 'params': [{'params': '^(?=.(?:norm|bn)).$', 'weight_decay': 0.0}], 'lr': 0.0001, 'betas': [0.9, 0.999], 'weight_decay': 0.0001}, 'lr_scheduler': {'type': 'MultiStepLR', 'milestones': [1000], 'gamma': 0.1}, 'lr_warmup_scheduler': {'type': 'LinearWarmup', 'warmup_duration': 2000}, 'model': 'RTDETR', 'criterion': 'RTDETRCriterionv2', 'postprocessor': 'RTDETRPostProcessor', 'use_focal_loss': True, 'eval_spatial_size': [640, 640], 'RTDETR': {'backbone': 'PResNet', 'encoder': 'HybridEncoder', 'decoder': 'RTDETRTransformerv2'}, 'PResNet': {'depth': 18, 'variant': 'd', 'freeze_at': -1, 'return_idx': [1, 2, 3], 'num_stages': 4, 'freeze_norm': False, 'pretrained': True}, 'HybridEncoder': {'in_channels': [128, 256, 512], 'feat_strides': [8, 16, 32], 'hidden_dim': 256, 'use_encoder_idx': [2], 'num_encoder_layers': 1, 'nhead': 8, 'dim_feedforward': 1024, 'dropout': 0.0, 'enc_act': 'gelu', 'expansion': 0.5, 'depth_mult': 1, 'act': 'silu'}, 'RTDETRTransformerv2': {'feat_channels': [256, 256, 256], 'feat_strides': [8, 16, 32], 'hidden_dim': 256, 'num_levels': 3, 'num_layers': 3, 'num_queries': 300, 'num_denoising': 100, 'label_noise_ratio': 0.5, 'box_noise_scale': 1.0, 'eval_idx': -1, 'num_points': [4, 4, 4], 'cross_attn_method': 'default', 'query_select_method': 'default'}, 'RTDETRPostProcessor': {'num_top_queries': 300}, 'RTDETRCriterionv2': {'weight_dict': {'loss_vfl': 1, 'loss_bbox': 5, 'loss_giou': 2}, 'losses': ['vfl', 'boxes'], 'alpha': 0.75, 'gamma': 2.0, 'matcher': {'type': 'HungarianMatcher', 'weight_dict': {'cost_class': 2, 'cost_bbox': 5, 'cost_giou': 2}, 'alpha': 0.25, 'gamma': 2.0}}, 'include': ['../dataset/coco_detection.yml', '../runtime.yml', './include/dataloader.yml', './include/optimizer.yml', './include/rtdetrv2_r50vd.yml'], 'config': 'configs/rtdetrv2/rtdetrv2_r18vd_120e_coco.yml', 'test_only': False, 'print_method': 'builtin', 'print_rank': 0}}
Start training
Load PResNet18 state_dict
Initial lr: [0.0001, 0.0001] building train_dataloader with batch_size=16... Traceback (most recent call last): File "RT-DETR-main/rtdetrv2_pytorch/tools/train.py", line 65, in main(args) File "RT-DETR-main/rtdetrv2_pytorch/tools/train.py", line 35, in main solver.fit() File "RT-DETR-main/rtdetrv2_pytorch/tools/../src/solver/det_solver.py", line 20, in fit self.train() File "RT-DETR-main/rtdetrv2_pytorch/tools/../src/solver/_solver.py", line 73, in train self.train_dataloader = dist_utils.warp_loader(self.cfg.train_dataloader, \ ^^^^^^^^^^^^^^^^^^^^^^^^^ File "RT-DETR-main/rtdetrv2_pytorch/tools/../src/core/yaml_config.py", line 74, in train_dataloader self._train_dataloader = self.build_dataloader('train_dataloader') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "RT-DETR-main/rtdetrv2_pytorch/tools/../src/core/yaml_config.py", line 170, in build_dataloader loader = create(name, global_cfg, batch_size=bs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "RT-DETR-main/rtdetrv2_pytorch/tools/../src/core/workspace.py", line 118, in create return create(name, global_cfg) ^^^^^^^^^^^^^^^^^^^^^^^^ File "RT-DETR-main/rtdetrv2_pytorch/tools/../src/core/workspace.py", line 151, in create raise ValueError(f'Missing inject for typestyle.') ValueError: Missing inject fortype style.`
命令行的输入是:export CUDA_VISIBLE_DEVICES=0
python tools/train.py -c configs/rtdetrv2/rtdetrv2_r18vd_120e_coco.yml
工作目录已经切到RT-DETR-main/rtdetrv2_pytorch/里了
非常感谢

@lyuwenyu
Copy link
Owner

lyuwenyu commented Dec 3, 2024

config里数据相关的你修改了那部分

@xiaocongxin
Copy link
Author

config里数据相关的你修改了那部分

谢谢,是我不小心把里面的type删掉了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants