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

[Bug] RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead #1967

Open
kirottu1 opened this issue Jan 19, 2025 · 0 comments

Comments

@kirottu1
Copy link

Branch

main branch (mmpretrain version)

Describe the bug

Hi. I am currently using mmdetection custom cascade rcnn model with custom dataset. While working with it I have faced with two bugs, first of which was running train.py on M1 CPU, which resulted in multiple errors but got fixed by changing library files to .cpu(). As I fixed it I have faced new issue, which is described in title. Error appears after 10 images getting processed. I have searched it up and saw that people already had it before, and fixed it py changing accuracy.py view() to reshape() and it worked for them, but now as I looked through the file I have this error though I am using reshape in accuracy.py. If anyone can help I will be really grateful.

mmdetection/configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco_200e.py

base = [
'../base/models/cascade_rcnn_r50_fpn.py',
'../base/datasets/coco_detection.py',
'../base/schedules/schedule_1x.py',
'../base/default_runtime.py'
]

Now you can simply rely on the default data paths:

data/coco/train2017/ + data/coco/annotations/instances_train2017.json, etc.

But override training epochs, optimizer, etc.:

custom_imports = dict(
imports=['configs.cascade_rcnn.debug_pipeline'],
allow_failed_imports=False
)

dataset_type = 'CocoDataset'
classes = ('handwrittentext', 'handwritten_text')
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
# Insert the debug pipeline step here
dict(type='DebugPipeline', prefix='[TRAIN DATA]'),
dict(type='Resize', scale=(1333, 800), keep_ratio=True),
dict(type='RandomFlip', prob=0.5),
dict(type='PackDetInputs')
]
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='Resize', scale=(1333, 800), keep_ratio=True),
dict(type='LoadAnnotations', with_bbox=True),
# Insert the debug pipeline step for validation/test
dict(type='DebugPipeline', prefix='[VAL/TEST DATA]'),
dict(
type='PackDetInputs',
meta_keys=('img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor')
)
]

train_dataloader = dict(
batch_size=2,
num_workers=2,
dataset=dict(
type=dataset_type,
metainfo=dict(classes=classes),
ann_file='annotations/instances_train2017.json',
data_prefix=dict(img='train2017/'),
pipeline=train_pipeline
)
)

val_dataloader = dict(
batch_size=1,
num_workers=2,
dataset=dict(
type=dataset_type,
metainfo=dict(classes=classes),
ann_file='annotations/instances_val2017.json',
data_prefix=dict(img='val2017/'),
pipeline=test_pipeline
)
)

test_dataloader = dict(
batch_size=1,
num_workers=2,
dataset=dict(
type=dataset_type,
metainfo=dict(classes=classes),
ann_file='annotations/instances_test2017.json',
data_prefix=dict(img='test2017/')
)
)

model = dict(
roi_head=dict(
bbox_head=[
dict(
type='Shared2FCBBoxHead',
num_classes=len(classes)
),
dict(
type='Shared2FCBBoxHead',
num_classes=len(classes)
),
dict(
type='Shared2FCBBoxHead',
num_classes=len(classes)
),
]
)

)

optim_wrapper = dict(
optimizer=dict(
type='SGD',
lr=0.001,
momentum=0.9,
weight_decay=0.0001,
)
)
param_scheduler = [
dict(
type='MultiStepLR',
begin=0,
end=200,
by_epoch=True,
milestones=[120, 160],
gamma=0.1
)
]
train_cfg = dict(type='EpochBasedTrainLoop', max_epochs=200, val_interval=10)
default_hooks = dict(checkpoint=dict(interval=10))

Here is my code for custom model and here is error

(openmmlab) (base) kirottu@nas-10-240-117-236 mmdetection % python tools/train.py configs/cascade_rcnn/cascade_rcnn_r50_fpn_1x_coco_200e.py

/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/mmengine/optim/optimizer/zero_optimizer.py:11: DeprecationWarning: TorchScript support for functional optimizers is deprecated and will be removed in a future PyTorch release. Consider using the torch.compile optimizer instead.
from torch.distributed.optim import
01/18 20:10:41 - mmengine - INFO -

System environment:
sys.platform: darwin
Python: 3.11.7 (main, Dec 15 2023, 12:09:56) [Clang 14.0.6 ]
CUDA available: False
MUSA available: False
numpy_random_seed: 476397440
GCC: Apple clang version 16.0.0 (clang-1600.0.26.4)
PyTorch: 2.5.1
PyTorch compiling details: PyTorch built with:

  • GCC 4.2

  • C++ Version: 201703

  • clang 14.0.3

  • OpenMP 201811

  • LAPACK is enabled (usually provided by MKL)

  • NNPACK is enabled

  • CPU capability usage: NO AVX

  • Build settings: BLAS_INFO=accelerate, BUILD_TYPE=Release, CXX_COMPILER=/Applications/Xcode_14.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++, CXX_FLAGS= -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DLIBKINETO_NOROCTRACER -DLIBKINETO_NOXPUPTI=ON -DUSE_PYTORCH_QNNPACK -DAT_BUILD_ARM_VEC256_WITH_SLEEF -DUSE_XNNPACK -DUSE_PYTORCH_METAL_EXPORT -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DUSE_COREML_DELEGATE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=braced-scalar-init -Werror=range-loop-construct -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-unused-parameter -Wno-strict-overflow -Wno-strict-aliasing -Wvla-extension -Wsuggest-override -Wnewline-eof -Winconsistent-missing-override -Winconsistent-missing-destructor-override -Wno-pass-failed -Wno-error=old-style-cast -Wconstant-conversion -Wno-missing-braces -Qunused-arguments -fcolor-diagnostics -faligned-new -Wno-unused-but-set-variable -fno-math-errno -fno-trapping-math -Werror=format -DUSE_MPS -Wno-unused-private-field -Wno-missing-braces, LAPACK_INFO=accelerate, TORCH_VERSION=2.5.1, USE_CUDA=OFF, USE_CUDNN=OFF, USE_CUSPARSELT=OFF, USE_EIGEN_FOR_BLAS=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=OFF, USE_MKLDNN=OFF, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF,

    TorchVision: 0.20.1
    OpenCV: 4.10.0
    MMEngine: 0.10.5

Runtime environment:
cudnn_benchmark: False
mp_cfg: {'mp_start_method': 'fork', 'opencv_num_threads': 0}
dist_cfg: {'backend': 'nccl'}
seed: 476397440
Distributed launcher: none
Distributed training: False
GPU number: 1

01/18 20:10:41 - mmengine - INFO - Config:
auto_scale_lr = dict(base_batch_size=16, enable=False)
backend_args = None
classes = (
'handwrittentext',
'handwritten_text',
)
custom_imports = dict(
allow_failed_imports=False,
imports=[
'configs.cascade_rcnn.debug_pipeline',
])
data_root = 'data/coco/'
dataset_type = 'CocoDataset'
default_hooks = dict(
checkpoint=dict(interval=10, type='CheckpointHook'),
logger=dict(interval=50, type='LoggerHook'),
param_scheduler=dict(type='ParamSchedulerHook'),
sampler_seed=dict(type='DistSamplerSeedHook'),
timer=dict(type='IterTimerHook'),
visualization=dict(type='DetVisualizationHook'))
default_scope = 'mmdet'
env_cfg = dict(
cudnn_benchmark=False,
dist_cfg=dict(backend='nccl'),
mp_cfg=dict(mp_start_method='fork', opencv_num_threads=0))
launcher = 'none'
load_from = None
log_level = 'INFO'
log_processor = dict(by_epoch=True, type='LogProcessor', window_size=50)
model = dict(
backbone=dict(
depth=50,
frozen_stages=1,
init_cfg=dict(checkpoint='torchvision://resnet50', type='Pretrained'),
norm_cfg=dict(requires_grad=True, type='BN'),
norm_eval=True,
num_stages=4,
out_indices=(
0,
1,
2,
3,
),
style='pytorch',
type='ResNet'),
data_preprocessor=dict(
bgr_to_rgb=True,
mean=[
123.675,
116.28,
103.53,
],
pad_size_divisor=32,
std=[
58.395,
57.12,
57.375,
],
type='DetDataPreprocessor'),
neck=dict(
in_channels=[
256,
512,
1024,
2048,
],
num_outs=5,
out_channels=256,
type='FPN'),
roi_head=dict(
bbox_head=[
dict(num_classes=2, type='Shared2FCBBoxHead'),
dict(num_classes=2, type='Shared2FCBBoxHead'),
dict(num_classes=2, type='Shared2FCBBoxHead'),
],
bbox_roi_extractor=dict(
featmap_strides=[
4,
8,
16,
32,
],
out_channels=256,
roi_layer=dict(output_size=7, sampling_ratio=0, type='RoIAlign'),
type='SingleRoIExtractor'),
num_stages=3,
stage_loss_weights=[
1,
0.5,
0.25,
],
type='CascadeRoIHead'),
rpn_head=dict(
anchor_generator=dict(
ratios=[
0.5,
1.0,
2.0,
],
scales=[
8,
],
strides=[
4,
8,
16,
32,
64,
],
type='AnchorGenerator'),
bbox_coder=dict(
target_means=[
0.0,
0.0,
0.0,
0.0,
],
target_stds=[
1.0,
1.0,
1.0,
1.0,
],
type='DeltaXYWHBBoxCoder'),
feat_channels=256,
in_channels=256,
loss_bbox=dict(
beta=0.1111111111111111, loss_weight=1.0, type='SmoothL1Loss'),
loss_cls=dict(
loss_weight=1.0, type='CrossEntropyLoss', use_sigmoid=True),
type='RPNHead'),
test_cfg=dict(
rcnn=dict(
max_per_img=100,
nms=dict(iou_threshold=0.5, type='nms'),
score_thr=0.05),
rpn=dict(
max_per_img=1000,
min_bbox_size=0,
nms=dict(iou_threshold=0.7, type='nms'),
nms_pre=1000)),
train_cfg=dict(
rcnn=[
dict(
assigner=dict(
ignore_iof_thr=-1,
match_low_quality=False,
min_pos_iou=0.5,
neg_iou_thr=0.5,
pos_iou_thr=0.5,
type='MaxIoUAssigner'),
debug=False,
pos_weight=-1,
sampler=dict(
add_gt_as_proposals=True,
neg_pos_ub=-1,
num=512,
pos_fraction=0.25,
type='RandomSampler')),
dict(
assigner=dict(
ignore_iof_thr=-1,
match_low_quality=False,
min_pos_iou=0.6,
neg_iou_thr=0.6,
pos_iou_thr=0.6,
type='MaxIoUAssigner'),
debug=False,
pos_weight=-1,
sampler=dict(
add_gt_as_proposals=True,
neg_pos_ub=-1,
num=512,
pos_fraction=0.25,
type='RandomSampler')),
dict(
assigner=dict(
ignore_iof_thr=-1,
match_low_quality=False,
min_pos_iou=0.7,
neg_iou_thr=0.7,
pos_iou_thr=0.7,
type='MaxIoUAssigner'),
debug=False,
pos_weight=-1,
sampler=dict(
add_gt_as_proposals=True,
neg_pos_ub=-1,
num=512,
pos_fraction=0.25,
type='RandomSampler')),
],
rpn=dict(
allowed_border=0,
assigner=dict(
ignore_iof_thr=-1,
match_low_quality=True,
min_pos_iou=0.3,
neg_iou_thr=0.3,
pos_iou_thr=0.7,
type='MaxIoUAssigner'),
debug=False,
pos_weight=-1,
sampler=dict(
add_gt_as_proposals=False,
neg_pos_ub=-1,
num=256,
pos_fraction=0.5,
type='RandomSampler')),
rpn_proposal=dict(
max_per_img=2000,
min_bbox_size=0,
nms=dict(iou_threshold=0.7, type='nms'),
nms_pre=2000)),
type='CascadeRCNN')
optim_wrapper = dict(
optimizer=dict(lr=0.001, momentum=0.9, type='SGD', weight_decay=0.0001),
type='OptimWrapper')
param_scheduler = [
dict(
begin=0,
by_epoch=True,
end=200,
gamma=0.1,
milestones=[
120,
160,
],
type='MultiStepLR'),
]
resume = False
test_cfg = dict(type='TestLoop')
test_dataloader = dict(
batch_size=1,
dataset=dict(
ann_file='annotations/instances_test2017.json',
backend_args=None,
data_prefix=dict(img='test2017/'),
data_root='data/coco/',
metainfo=dict(classes=(
'handwrittentext',
'handwritten_text',
)),
pipeline=[
dict(backend_args=None, type='LoadImageFromFile'),
dict(keep_ratio=True, scale=(
1333,
800,
), type='Resize'),
dict(type='LoadAnnotations', with_bbox=True),
dict(
meta_keys=(
'img_id',
'img_path',
'ori_shape',
'img_shape',
'scale_factor',
),
type='PackDetInputs'),
],
test_mode=True,
type='CocoDataset'),
drop_last=False,
num_workers=2,
persistent_workers=True,
sampler=dict(shuffle=False, type='DefaultSampler'))
test_evaluator = dict(
ann_file='data/coco/annotations/instances_val2017.json',
backend_args=None,
format_only=False,
metric='bbox',
type='CocoMetric')
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(keep_ratio=True, scale=(
1333,
800,
), type='Resize'),
dict(type='LoadAnnotations', with_bbox=True),
dict(prefix='[VAL/TEST DATA]', type='DebugPipeline'),
dict(
meta_keys=(
'img_id',
'img_path',
'ori_shape',
'img_shape',
'scale_factor',
),
type='PackDetInputs'),
]
train_cfg = dict(max_epochs=200, type='EpochBasedTrainLoop', val_interval=10)
train_dataloader = dict(
batch_sampler=dict(type='AspectRatioBatchSampler'),
batch_size=2,
dataset=dict(
ann_file='annotations/instances_train2017.json',
backend_args=None,
data_prefix=dict(img='train2017/'),
data_root='data/coco/',
filter_cfg=dict(filter_empty_gt=True, min_size=32),
metainfo=dict(classes=(
'handwrittentext',
'handwritten_text',
)),
pipeline=[
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(prefix='[TRAIN DATA]', type='DebugPipeline'),
dict(keep_ratio=True, scale=(
1333,
800,
), type='Resize'),
dict(prob=0.5, type='RandomFlip'),
dict(type='PackDetInputs'),
],
type='CocoDataset'),
num_workers=2,
persistent_workers=True,
sampler=dict(shuffle=True, type='DefaultSampler'))
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(prefix='[TRAIN DATA]', type='DebugPipeline'),
dict(keep_ratio=True, scale=(
1333,
800,
), type='Resize'),
dict(prob=0.5, type='RandomFlip'),
dict(type='PackDetInputs'),
]
val_cfg = dict(type='ValLoop')
val_dataloader = dict(
batch_size=1,
dataset=dict(
ann_file='annotations/instances_val2017.json',
backend_args=None,
data_prefix=dict(img='val2017/'),
data_root='data/coco/',
metainfo=dict(classes=(
'handwrittentext',
'handwritten_text',
)),
pipeline=[
dict(type='LoadImageFromFile'),
dict(keep_ratio=True, scale=(
1333,
800,
), type='Resize'),
dict(type='LoadAnnotations', with_bbox=True),
dict(prefix='[VAL/TEST DATA]', type='DebugPipeline'),
dict(
meta_keys=(
'img_id',
'img_path',
'ori_shape',
'img_shape',
'scale_factor',
),
type='PackDetInputs'),
],
test_mode=True,
type='CocoDataset'),
drop_last=False,
num_workers=2,
persistent_workers=True,
sampler=dict(shuffle=False, type='DefaultSampler'))
val_evaluator = dict(
ann_file='data/coco/annotations/instances_val2017.json',
backend_args=None,
format_only=False,
metric='bbox',
type='CocoMetric')
vis_backends = [
dict(type='LocalVisBackend'),
]
visualizer = dict(
name='visualizer',
type='DetLocalVisualizer',
vis_backends=[
dict(type='LocalVisBackend'),
])
work_dir = './work_dirs/cascade_rcnn_r50_fpn_1x_coco_200e'

01/18 20:10:42 - mmengine - INFO - Distributed training is not used, all SyncBatchNorm (SyncBN) layers in the model will be automatically reverted to BatchNormXd layers if they are used.
01/18 20:10:42 - mmengine - INFO - Hooks will be executed in the following order:
before_run:
(VERY_HIGH ) RuntimeInfoHook
(BELOW_NORMAL) LoggerHook

before_train:
(VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(VERY_LOW ) CheckpointHook

before_train_epoch:
(VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(NORMAL ) DistSamplerSeedHook

before_train_iter:
(VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook

after_train_iter:
(VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook
(LOW ) ParamSchedulerHook
(VERY_LOW ) CheckpointHook

after_train_epoch:
(NORMAL ) IterTimerHook
(LOW ) ParamSchedulerHook
(VERY_LOW ) CheckpointHook

before_val:
(VERY_HIGH ) RuntimeInfoHook

before_val_epoch:
(NORMAL ) IterTimerHook

before_val_iter:
(NORMAL ) IterTimerHook

after_val_iter:
(NORMAL ) IterTimerHook
(NORMAL ) DetVisualizationHook
(BELOW_NORMAL) LoggerHook

after_val_epoch:
(VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook
(LOW ) ParamSchedulerHook
(VERY_LOW ) CheckpointHook

after_val:
(VERY_HIGH ) RuntimeInfoHook

after_train:
(VERY_HIGH ) RuntimeInfoHook
(VERY_LOW ) CheckpointHook

before_test:
(VERY_HIGH ) RuntimeInfoHook

before_test_epoch:
(NORMAL ) IterTimerHook

before_test_iter:
(NORMAL ) IterTimerHook

after_test_iter:
(NORMAL ) IterTimerHook
(NORMAL ) DetVisualizationHook
(BELOW_NORMAL) LoggerHook

after_test_epoch:
(VERY_HIGH ) RuntimeInfoHook
(NORMAL ) IterTimerHook
(BELOW_NORMAL) LoggerHook

after_test:
(VERY_HIGH ) RuntimeInfoHook

after_run:
(BELOW_NORMAL) LoggerHook

loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
01/18 20:10:43 - mmengine - INFO - load model from: torchvision://resnet50
01/18 20:10:43 - mmengine - INFO - Loads checkpoint by torchvision backend from path: torchvision://resnet50
01/18 20:10:43 - mmengine - WARNING - The model and loaded state dict do not match exactly

unexpected key in source state_dict: fc.weight, fc.bias

01/18 20:10:44 - mmengine - WARNING - "FileClient" will be deprecated in future. Please use io functions in https://mmengine.readthedocs.io/en/latest/api/fileio.html#file-io
01/18 20:10:44 - mmengine - WARNING - "HardDiskBackend" is the alias of "LocalBackend" and the former will be deprecated in future.
01/18 20:10:44 - mmengine - INFO - Checkpoints will be saved to /Users/kirottu/coding xd/cascade-code/mmdetection/work_dirs/cascade_rcnn_r50_fpn_1x_coco_200e.
[TRAIN DATA]: Now processing image: data/coco/train2017/train_037_jpg.rf.821ecc5bcc5cbafd2ab76f5cee7dda61.jpg
[TRAIN DATA]: Now processing image: data/coco/train2017/train_026_jpg.rf.8b3651f60ad2e63c9aa82831a4a8c79e.jpg
[TRAIN DATA]: Image numpy array shape = (640, 640, 3)
[TRAIN DATA]: Is numpy array contiguous? True
[TRAIN DATA]: Bboxes shape = torch.Size([16, 4])
[TRAIN DATA]: Image numpy array shape = (640, 640, 3)
[TRAIN DATA]: Is numpy array contiguous? True
[TRAIN DATA]: Bboxes shape = torch.Size([9, 4])
[TRAIN DATA]: Now processing image: data/coco/train2017/train_034_jpg.rf.2c531cc713c34a966db0577316f37966.jpg
[TRAIN DATA]: Image numpy array shape = (640, 640, 3)
[TRAIN DATA]: Is numpy array contiguous? True
[TRAIN DATA]: Bboxes shape = torch.Size([11, 4])
[TRAIN DATA]: Now processing image: data/coco/train2017/train_025_jpg.rf.0cab4128c75baecacefb3bc06d178b55.jpg
[TRAIN DATA]: Image numpy array shape = (640, 640, 3)
[TRAIN DATA]: Is numpy array contiguous? True
[TRAIN DATA]: Bboxes shape = torch.Size([13, 4])
[TRAIN DATA]: Now processing image: data/coco/train2017/train_036_jpg.rf.44951058e657bbe54289998d9201b00b.jpg
[TRAIN DATA]: Image numpy array shape = (640, 640, 3)
[TRAIN DATA]: Is numpy array contiguous? True
[TRAIN DATA]: Bboxes shape = torch.Size([6, 4])
[TRAIN DATA]: Now processing image: data/coco/train2017/train_043_jpg.rf.82a3ccae74be8fa9de88cbda7683396a.jpg
[TRAIN DATA]: Image numpy array shape = (640, 640, 3)
[TRAIN DATA]: Is numpy array contiguous? True
[TRAIN DATA]: Bboxes shape = torch.Size([14, 4])
[TRAIN DATA]: Now processing image: data/coco/train2017/train_035_jpg.rf.3c125ab645edee4782203d1397f3ae96.jpg
[TRAIN DATA]: Image numpy array shape = (640, 640, 3)
[TRAIN DATA]: Is numpy array contiguous? True
[TRAIN DATA]: Bboxes shape = torch.Size([8, 4])
[TRAIN DATA]: Now processing image: data/coco/train2017/train_033_jpg.rf.5b1fc54fce4c35e14dfe114ac8b98532.jpg
[TRAIN DATA]: Image numpy array shape = (640, 640, 3)
[TRAIN DATA]: Is numpy array contiguous? True
[TRAIN DATA]: Bboxes shape = torch.Size([18, 4])
[TRAIN DATA]: Now processing image: data/coco/train2017/train_054_jpg.rf.f4e8cd536e03d3e28473856a13d9978b.jpg
[TRAIN DATA]: Image numpy array shape = (640, 640, 3)
[TRAIN DATA]: Is numpy array contiguous? True
[TRAIN DATA]: Bboxes shape = torch.Size([7, 4])
[TRAIN DATA]: Now processing image: data/coco/train2017/train_041_jpg.rf.7711b2205ae5ced5ba2a874624a47509.jpg
[TRAIN DATA]: Image numpy array shape = (640, 640, 3)
[TRAIN DATA]: Is numpy array contiguous? True
[TRAIN DATA]: Bboxes shape = torch.Size([14, 4])
Traceback (most recent call last):
File "/Users/kirottu/coding xd/cascade-code/mmdetection/tools/train.py", line 121, in
main()
File "/Users/kirottu/coding xd/cascade-code/mmdetection/tools/train.py", line 117, in main
runner.train()
File "/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/mmengine/runner/runner.py", line 1777, in train
model = self.train_loop.run() # type: ignore
^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/mmengine/runner/loops.py", line 98, in run
self.run_epoch()
File "/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/mmengine/runner/loops.py", line 115, in run_epoch
self.run_iter(idx, data_batch)
File "/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/mmengine/runner/loops.py", line 131, in run_iter
outputs = self.runner.model.train_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/mmengine/model/base_model/base_model.py", line 116, in train_step
optim_wrapper.update_params(parsed_losses)
File "/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/mmengine/optim/optimizer/optimizer_wrapper.py", line 196, in update_params
self.backward(loss)
File "/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/mmengine/optim/optimizer/optimizer_wrapper.py", line 220, in backward
loss.backward(**kwargs)
File "/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/torch/_tensor.py", line 581, in backward
torch.autograd.backward(
File "/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/torch/autograd/init.py", line 347, in backward
_engine_run_backward(
File "/opt/anaconda3/envs/openmmlab/lib/python3.11/site-packages/torch/autograd/graph.py", line 825, in _engine_run_backward
return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

Environment

.

Other information

No response

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

1 participant