Skip to content

Modify the input size of SSD, ValueError: Expected input batch_size (221140) to match target batch_size (221076). #7264

@Yangr116

Description

@Yangr116

Thanks for your nice work for the detection area!
Recently, I met an error when revising the input size of SSD.
I revised the input size from (512, 512) to (1536, 1536), and the anchor generator from :

        anchor_generator=dict(
            type='SSDAnchorGenerator',
            scale_major=False,
            input_size=512,
            basesize_ratio_range=(0.1, 0.9),
            strides=[8, 16, 32, 64, 128, 256, 512],
            ratios=[[2], [2, 3], [2, 3], [2, 3], [2, 3], [2], [2]])

to

        anchor_generator=dict(
            type='SSDAnchorGenerator',
            scale_major=False,
            # input_size=input_size,
            min_sizes = [61, 153, 399, 645, 890, 1136, 1382],
            max_sizes = [153, 399, 645, 890, 1136, 1382, 1628],
            basesize_ratio_range=(0.1, 0.9),
            strides=[8, 16, 32, 64, 128, 256, 512],
            ratios=[[2], [2, 3], [2, 3], [2, 3], [2, 3], [2], [2]])

When calculating cls loss, there was an error ValueError: Expected input batch_size (221140) to match target batch_size (221076), where cls_score.shape[0]= 221140 and labels.shape[0]=221076.

How should I modify the input size successfully in SSD? Looking for your reply, thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions