DEIM icon indicating copy to clipboard operation
DEIM copied to clipboard

NotImplementedError: Caught NotImplementedError in DataLoader worker process 0.

Open jakub-puma opened this issue 10 months ago • 6 comments

I'm trying to train using deim_rtdetrv2_r18vd_coco_120e.pth model. Dataset is COCO2017. I used this command to train

python train.py -c configs/deim_rtdetrv2/deim_r18vd_120e_coco.yml -r checkpoints/deim_rtdetrv2_r18vd_coco_120e.pth -d cuda:0

But I met this issue.

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': 'models/deim_rtdetrv2_r18vd_coco_120e.pth', 'tuning': None, 'epoches': 120, 'last_epoch': -1, 'lrsheduler': 'flatcosine', 'lr_gamma': 0.5, 'no_aug_epoch': 3, 'warmup_iter': 2000, 'flat_epoch': 64, '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': 4, 'output_dir': './output/deim_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': {'type': 'CocoDetection', 'img_folder': 'datasets\\coco8\\images\\train2017', 'ann_file': 'datasets\\coco8\\labels\\instances_train2017.json', 'return_masks': False, 'transforms': {'type': 'Compose', 'ops': [{'type': 'Mosaic', 'output_size': 320, 'rotation_range': 10, 'translation_range': [0.1, 0.1], 'scaling_range': [0.5, 1.5], 'probability': 1.0, 'fill_value': 0, 'use_cache': False, 'max_cached_images': 50, 'random_pop': True}, {'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': [4, 64, 117], 'ops': ['Mosaic', 'RandomPhotometricDistort', 'RandomZoomOut', 'RandomIoUCrop']}, 'mosaic_prob': 0.5}}, 'shuffle': True, 'num_workers': 4, 'drop_last': True, 'collate_fn': {'type': 'BatchImageCollateFunction', 'base_size': 640, 'base_size_repeat': 3, 'stop_epoch': 117, 'scales': None, 'mixup_prob': 0.5, 'mixup_epochs': [4, 64]}, 'total_batch_size': 16}, 'val_dataloader': {'type': 'DataLoader', 'dataset': {'type': 'CocoDetection', 'img_folder': 'datasets\\coco8\\images\\val2017', 'ann_file': 'datasets\\coco8\\labels\\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': 'BatchImageCollateFunction'}, 'total_batch_size': 64}, 'print_freq': 100, 'output_dir': './output/deim_rtdetrv2_r18vd_120e_coco', 'checkpoint_freq': 4, '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, 'start': 0}, 'epoches': 120, 'clip_max_norm': 0.1, 'optimizer': {'type': 'AdamW', 'params': [{'params': '^(?=.*(?:norm|bn)).*$', 'weight_decay': 0.0}], 'lr': 0.0002, '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': 'DEIM', 'criterion': 'DEIMCriterion', 'postprocessor': 'PostProcessor', 'use_focal_loss': True, 'eval_spatial_size': [640, 640], 'DEIM': {'backbone': 'PResNet', 'encoder': 'HybridEncoder', 'decoder': 'RTDETRTransformerv2'}, 'lrsheduler': 'flatcosine', 'lr_gamma': 0.5, 'warmup_iter': 2000, 'flat_epoch': 64, 'no_aug_epoch': 3, 'PResNet': {'depth': 18, 'variant': 'd', 'freeze_at': -1, 'return_idx': [1, 2, 3], 'num_stages': 4, 'freeze_norm': False, 'pretrained': True, 'local_model_dir': '../RT-DETR-main/rtdetrv2_pytorch/INK1k/'}, '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', 'version': 'rt_detrv2'}, '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', 'query_pos_method': 'as_reg', 'activation': 'silu', 'mlp_act': 'silu'}, 'PostProcessor': {'num_top_queries': 300}, 'DEIMCriterion': {'weight_dict': {'loss_vfl': 1, 'loss_bbox': 5, 'loss_giou': 2, 'loss_mal': 1}, 'losses': ['mal', 'boxes'], 'alpha': 0.75, 'gamma': 1.5, 'use_uni_set': False, 'matcher': {'type': 'HungarianMatcher', 'weight_dict': {'cost_class': 2, 'cost_bbox': 5, 'cost_giou': 2}, 'alpha': 0.25, 'gamma': 2.0}}, '__include__': ['./rtdetrv2_r18vd_120e_coco.yml', '../base/rt_deim.yml'], 'config': 'configs/deim_rtdetrv2/deim_r18vd_120e_coco.yml', 'resume': 'models/deim_rtdetrv2_r18vd_coco_120e.pth', 'test_only': False, 'print_method': 'builtin', 'print_rank': 0}}
Loaded PResNet18 from local file@../RT-DETR-main/rtdetrv2_pytorch/INK1k/ResNet18_vd_pretrained_from_paddle.pth.
Load PResNet18 state_dict
     ### Query Position Embedding@as_reg ###     
Initial lr: [0.0002, 0.0002]
building train_dataloader with batch_size=16...
     ### Transform @Mosaic ###
     ### Transform @RandomPhotometricDistort ###
     ### Transform @RandomZoomOut ###
     ### Transform @RandomIoUCrop ###
     ### Transform @SanitizeBoundingBoxes ###
     ### Transform @RandomHorizontalFlip ###
     ### Transform @Resize ###
     ### Transform @SanitizeBoundingBoxes ###
     ### Transform @ConvertPILImage ###
     ### Transform @ConvertBoxes ###
     ### Mosaic with [email protected] and ZoomOut/IoUCrop existed ###
     ### ImgTransforms Epochs: [4, 64, 117] ###
     ### Policy_ops@['Mosaic', 'RandomPhotometricDistort', 'RandomZoomOut', 'RandomIoUCrop'] ###
Traceback (most recent call last):
  File "E:\Data Research\DEIM\train.py", line 84, in <module>
    main(args)
  File "E:\Data Research\DEIM\train.py", line 54, in main
    solver.fit()
  File "E:\Data Research\DEIM\engine\solver\det_solver.py", line 25, in fit
    self.train()
  File "E:\Data Research\DEIM\engine\solver\_solver.py", line 87, in train
    self.cfg.train_dataloader, shuffle=self.cfg.train_dataloader.shuffle
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\engine\core\yaml_config.py", line 76, in train_dataloader
    self._train_dataloader = self.build_dataloader('train_dataloader')
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\engine\core\yaml_config.py", line 172, in build_dataloader
    loader = create(name, global_cfg, batch_size=bs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\engine\core\workspace.py", line 119, in create
    return create(name, global_cfg)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\engine\core\workspace.py", line 167, in create
    module_kwargs[k] = create(name, global_cfg)
                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\engine\core\workspace.py", line 185, in create
    return module(**module_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BatchImageCollateFunction.__init__() got an unexpected keyword argument 'scales'

So that I added this code snippet to workspace.py file at line 179 before return module(**module_kwargs).

if "scales" in module_kwargs:
    del module_kwargs["scales"]

return module(**module_kwargs)

Then I met this issue.

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': 'models/deim_rtdetrv2_r18vd_coco_120e.pth', 'tuning': None, 'epoches': 120, 'last_epoch': -1, 'lrsheduler': 'flatcosine', 'lr_gamma': 0.5, 'no_aug_epoch': 3, 'warmup_iter': 2000, 'flat_epoch': 64, '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': 4, 'output_dir': './output/deim_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': {'type': 'CocoDetection', 'img_folder': 'datasets\\coco8\\images\\train2017', 'ann_file': 'datasets\\coco8\\labels\\instances_train2017.json', 'return_masks': False, 'transforms': {'type': 'Compose', 'ops': [{'type': 'Mosaic', 'output_size': 320, 'rotation_range': 10, 'translation_range': [0.1, 0.1], 'scaling_range': [0.5, 1.5], 'probability': 1.0, 'fill_value': 0, 'use_cache': False, 'max_cached_images': 50, 'random_pop': True}, {'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': [4, 64, 117], 'ops': ['Mosaic', 'RandomPhotometricDistort', 'RandomZoomOut', 'RandomIoUCrop']}, 'mosaic_prob': 0.5}}, 'shuffle': True, 'num_workers': 4, 'drop_last': True, 'collate_fn': {'type': 'BatchImageCollateFunction', 'base_size': 640, 'base_size_repeat': 3, 'stop_epoch': 117, 'scales': None, 'mixup_prob': 0.5, 'mixup_epochs': [4, 64]}, 'total_batch_size': 16}, 'val_dataloader': {'type': 'DataLoader', 'dataset': {'type': 'CocoDetection', 'img_folder': 'datasets\\coco8\\images\\val2017', 'ann_file': 'datasets\\coco8\\labels\\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': 'BatchImageCollateFunction'}, 'total_batch_size': 64}, 'print_freq': 100, 'output_dir': './output/deim_rtdetrv2_r18vd_120e_coco', 'checkpoint_freq': 4, '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, 'start': 0}, 'epoches': 120, 'clip_max_norm': 0.1, 'optimizer': {'type': 'AdamW', 'params': [{'params': '^(?=.*(?:norm|bn)).*$', 'weight_decay': 0.0}], 'lr': 0.0002, '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': 'DEIM', 'criterion': 'DEIMCriterion', 'postprocessor': 'PostProcessor', 'use_focal_loss': True, 'eval_spatial_size': [640, 640], 'DEIM': {'backbone': 'PResNet', 'encoder': 'HybridEncoder', 'decoder': 'RTDETRTransformerv2'}, 'lrsheduler': 'flatcosine', 'lr_gamma': 0.5, 'warmup_iter': 2000, 'flat_epoch': 64, 'no_aug_epoch': 3, 'PResNet': {'depth': 18, 'variant': 'd', 'freeze_at': -1, 'return_idx': [1, 2, 3], 'num_stages': 4, 'freeze_norm': False, 'pretrained': True, 'local_model_dir': '../RT-DETR-main/rtdetrv2_pytorch/INK1k/'}, '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', 'version': 'rt_detrv2'}, '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', 'query_pos_method': 'as_reg', 'activation': 'silu', 'mlp_act': 'silu'}, 'PostProcessor': {'num_top_queries': 300}, 'DEIMCriterion': {'weight_dict': {'loss_vfl': 1, 'loss_bbox': 5, 'loss_giou': 2, 'loss_mal': 1}, 'losses': ['mal', 'boxes'], 'alpha': 0.75, 'gamma': 1.5, 'use_uni_set': False, 'matcher': {'type': 'HungarianMatcher', 'weight_dict': {'cost_class': 2, 'cost_bbox': 5, 'cost_giou': 2}, 'alpha': 0.25, 'gamma': 2.0}}, '__include__': ['./rtdetrv2_r18vd_120e_coco.yml', '../base/rt_deim.yml'], 'config': 'configs/deim_rtdetrv2/deim_r18vd_120e_coco.yml', 'resume': 'models/deim_rtdetrv2_r18vd_coco_120e.pth', 'test_only': False, 'print_method': 'builtin', 'print_rank': 0}}
Loaded PResNet18 from local file@../RT-DETR-main/rtdetrv2_pytorch/INK1k/ResNet18_vd_pretrained_from_paddle.pth.
Load PResNet18 state_dict
     ### Query Position Embedding@as_reg ###     
Initial lr: [0.0002, 0.0002]
building train_dataloader with batch_size=16...
     ### Transform @Mosaic ###
     ### Transform @RandomPhotometricDistort ###
     ### Transform @RandomZoomOut ###
     ### Transform @RandomIoUCrop ###
     ### Transform @SanitizeBoundingBoxes ###
     ### Transform @RandomHorizontalFlip ###
     ### Transform @Resize ###
     ### Transform @SanitizeBoundingBoxes ###
     ### Transform @ConvertPILImage ###
     ### Transform @ConvertBoxes ###
     ### Mosaic with [email protected] and ZoomOut/IoUCrop existed ###
     ### ImgTransforms Epochs: [4, 64, 117] ###
     ### Policy_ops@['Mosaic', 'RandomPhotometricDistort', 'RandomZoomOut', 'RandomIoUCrop'] ###
     ### Using MixUp with [email protected] in [4, 64] epochs ###
     ### Multi-scale Training until 117 epochs ###
     ### Multi-scales@ [480, 512, 544, 576, 608, 640, 640, 640, 800, 768, 736, 704, 672] ###
building val_dataloader with batch_size=64...
     ### Transform @Resize ###
     ### Transform @ConvertPILImage ###
Resume checkpoint from models/deim_rtdetrv2_r18vd_coco_120e.pth
Load model.state_dict
Not load criterion.state_dict
Not load postprocessor.state_dict
Load ema.state_dict from model.state_dict
Not load optimizer.state_dict
Not load lr_scheduler.state_dict
Not load lr_warmup_scheduler.state_dict

------------------------------------- Calculate Flops Results -------------------------------------
Notations:
number of parameters (Params), number of multiply-accumulate operations(MACs),
number of floating-point operations (FLOPs), floating-point operations per second (FLOPS),
fwd FLOPs (model forward propagation FLOPs), bwd FLOPs (model backward propagation FLOPs),
default model backpropagation takes 2.00 times as much computation as forward propagation.

Total Training Params:                                                  19.98 M
fwd MACs:                                                               30.0313 GMACs
fwd FLOPs:                                                              60.2087 GFLOPS
fwd+bwd MACs:                                                           90.0938 GMACs
fwd+bwd FLOPs:                                                          180.626 GFLOPS
---------------------------------------------------------------------------------------------------
{'Model FLOPs:60.2087 GFLOPS   MACs:30.0313 GMACs   Params:19979152'}
------------------------------------------Start training-------------------------------------------
     ## Using Self-defined Scheduler-flatcosine ##
[0.0002, 0.0002] [0.0001, 0.0001] 0 2000 0 0
number of trainable parameters: 20183440
>>>>>> iterable :  0
Traceback (most recent call last):
  File "E:\Data Research\DEIM\train.py", line 84, in <module>
    main(args)
  File "E:\Data Research\DEIM\train.py", line 54, in main
    solver.fit()
  File "E:\Data Research\DEIM\engine\solver\det_solver.py", line 108, in fit
    test_stats, coco_evaluator = evaluate(
                                 ^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\engine\solver\det_engine.py", line 140, in evaluate
    for samples, targets in metric_logger.log_every(data_loader, 10, header):
  File "E:\Data Research\DEIM\engine\misc\logger.py", line 215, in log_every
    for obj in iterable:
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\utils\data\dataloader.py", line 708, in __next__
    data = self._next_data()
           ^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\utils\data\dataloader.py", line 1480, in _next_data
    return self._process_data(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\utils\data\dataloader.py", line 1505, in _process_data
    data.reraise()
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\_utils.py", line 733, in reraise
    raise exception
NotImplementedError: Caught NotImplementedError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\utils\data\_utils\worker.py", line 349, in _worker_loop
    data = fetcher.fetch(index)  # type: ignore[possibly-undefined]
           ^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\utils\data\_utils\fetch.py", line 52, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\utils\data\_utils\fetch.py", line 52, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
            ~~~~~~~~~~~~^^^^^
  File "E:\Data Research\DEIM\engine\data\dataset\coco_dataset.py", line 45, in __getitem__
    img, target, _ = self._transforms(img, target, self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\nn\modules\module.py", line 1739, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\nn\modules\module.py", line 1750, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\engine\data\transforms\container.py", line 58, in forward
    return self.get_forward(self.policy['name'])(*inputs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\engine\data\transforms\container.py", line 71, in default_forward
    sample = transform(sample)
             ^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\nn\modules\module.py", line 1739, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torch\nn\modules\module.py", line 1750, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torchvision\transforms\v2\_transform.py", line 68, in forward
    flat_outputs = [
                   ^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torchvision\transforms\v2\_transform.py", line 69, in <listcomp>
    self.transform(inpt, params) if needs_transform else inpt
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Data Research\DEIM\.venv\Lib\site-packages\torchvision\transforms\v2\_transform.py", line 55, in transform
    raise NotImplementedError
NotImplementedError

Please help me this problem asap.

jakub-puma avatar Feb 18 '25 00:02 jakub-puma

I have encountered the same problem. Have you solved it now?

ss989462 avatar Mar 01 '25 12:03 ss989462

Hi, thank you so much for your interest in our work! It looks like the issue might be related to data transformation. The raise NotImplementedError suggests that there might be some transformation operators that your current version doesn’t support. If this issue persists, you could first try aligning with the recommended runtime environment we suggest. If it still occurs after that, please provide more detailed information so we can assist you better in resolving it.

ShihuaHuang95 avatar Mar 04 '25 03:03 ShihuaHuang95

Hi! I have encountered the same issue, I am running Python 3.11.11 and using a virtual environment with only your required packages installed (pip install -r requirements.txt). This error happens when I try to train a DEIM-FINE model on a custom dataset.

To test things a bit, I also tried to launch a training on the COCO datasets, downloaded from the official coco website, but I ended up with a different error (copy-pasting only the last part):

[rank0]:   File "/home/username/DEIM/engine/deim/hybrid_encoder.py", line 242, in with_pos_embed
[rank0]:     return tensor if pos_embed is None else tensor + pos_embed
[rank0]:                                             ~~~~~~~^~~~~~~~~~~
[rank0]: RuntimeError: The size of tensor a (400) must match the size of tensor b (169) at non-singleton dimension 1
E0311 16:06:36.110000 246384 torch/distributed/elastic/multiprocessing/api.py:869] failed (exitcode: 1) local_rank: 0 (pid: 246391) of binary: /home/username/DEIM/venv/bin/python3.11
Traceback (most recent call last):
  File "/home/username/DEIM/venv/bin/torchrun", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/username/DEIM/venv/lib/python3.11/site-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 355, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/home/username/DEIM/venv/lib/python3.11/site-packages/torch/distributed/run.py", line 918, in main
    run(args)
  File "/home/username/DEIM/venv/lib/python3.11/site-packages/torch/distributed/run.py", line 909, in run
    elastic_launch(
  File "/home/username/DEIM/venv/lib/python3.11/site-packages/torch/distributed/launcher/api.py", line 138, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/DEIM/venv/lib/python3.11/site-packages/torch/distributed/launcher/api.py", line 269, in launch_agent
    raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
============================================================
train.py FAILED
------------------------------------------------------------

vittorio-prodomo avatar Mar 11 '25 15:03 vittorio-prodomo

Hi ! I encountered the same issue and I figured out that I had the issue only when using torchvision with version above 0.21.

I managed to fix this issue by either downgrading torchvision or modifying engine/data/transforms/_transforms.py.

In order to allow support of latest torchvision versions, I submitted the following PR: https://github.com/ShihuaHuang95/DEIM/pull/47

EnriqueGlv avatar Mar 13 '25 15:03 EnriqueGlv

thank you

dafenqi521 avatar Mar 26 '25 09:03 dafenqi521

Hi ! I encountered the same issue and I figured out that I had the issue only when using torchvision with version above 0.21.

I managed to fix this issue by either downgrading torchvision or modifying engine/data/transforms/_transforms.py.

In order to allow support of latest torchvision versions, I submitted the following PR: #47

its useful.

faicaiwawa avatar Apr 25 '25 06:04 faicaiwawa