Skip to content

fix(reidmodel): torch.squeeze removes batch dim for batch (+3 more) - #88

Closed
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/reidmodel-assorted-c5bff2e2
Closed

fix(reidmodel): torch.squeeze removes batch dim for batch (+3 more)#88
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/reidmodel-assorted-c5bff2e2

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Small fixes in reIDmodel.py:

fix: torch.squeeze removes batch dim for batch size 1

Fix: Replace:

    def forward(self, x):
        x = self.model.features(x)
        x = torch.squeeze(x)
        x = self.classifier(x)
        return x

with:

    def forward(self, x):
        x = self.model.features(x)
        x = x.view(x.size(0), -1)
        x = self.classifier(x)
        return x

fix: torch.squeeze removes batch dim when batch size is 1

Fix: Replace:

        x = torch.cat((x0,x1),1)
        x = torch.squeeze(x)
        x = self.classifier(x)
        return x

with:

        x = torch.cat((x0,x1),1)
        x = x.view(x.size(0), -1)
        x = self.classifier(x)
        return x

fix: PCB part classifier passes bool as dropout rate

Fix: Replace:

            setattr(self, name, ClassBlock(2048, class_num, True, False, 256))

with:

            setattr(self, name, ClassBlock(2048, class_num, droprate=0.5, relu=False, num_bottleneck=256))

fix: ft_net_dense fails on batch size 1 due to torch.squeeze

Fix: Replace:

        x = self.model.features(x)
        x = torch.squeeze(x)
        x = self.classifier(x)

with:

        x = self.model.features(x)
        x = x.view(x.size(0), -1)
        x = self.classifier(x)

Files changed

  • reIDmodel.py

@andrewwhitecdw
andrewwhitecdw force-pushed the bugfix/reidmodel-assorted-c5bff2e2 branch from a24ce84 to 39ebc20 Compare August 2, 2026 19:26
@andrewwhitecdw
andrewwhitecdw marked this pull request as ready for review August 3, 2026 22:06
@andrewwhitecdw

Copy link
Copy Markdown
Author

Closing this sweep-generated PR: sole commit is missing a valid Signed-off-by trailer. It does not meet the sweep requirements (single signed-off commit).

@andrewwhitecdw
andrewwhitecdw force-pushed the bugfix/reidmodel-assorted-c5bff2e2 branch 2 times, most recently from 0c57c5f to 5c51580 Compare August 24, 2026 18:17
Validated fix for:
- finding 618

Signed-off-by: Andrew White <andrewwhitecdw@users.noreply.github.com>
@andrewwhitecdw
andrewwhitecdw force-pushed the bugfix/reidmodel-assorted-c5bff2e2 branch from 5c51580 to 7c922a8 Compare August 24, 2026 18:19
@andrewwhitecdw

Copy link
Copy Markdown
Author

Closing this upstream PR — it was opened by automation without the required sweep-approved review and therefore does not comply with the sweep policy. A replacement fork-local PR is open at andrewwhitecdw#5 for review.

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

Successfully merging this pull request may close these issues.

1 participant