Skip to content

fix(test-2label): --PCB and --use_dense flags select (+1 more) - #90

Open
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/test-2label-assorted-03ddba26
Open

fix(test-2label): --PCB and --use_dense flags select (+1 more)#90
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/test-2label-assorted-03ddba26

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Small fixes in reid_eval/test_2label.py:

fix: --PCB and --use_dense flags select unsupported model

Fix: Replace:

model_structure = ft_netAB(config['ID_class'], norm=config['norm_id'], stride=config['ID_stride'], pool=config['pool'])

if opt.PCB:
    model_structure = PCB(config['ID_class'])

with:

if opt.use_dense or opt.PCB:
    raise NotImplementedError("Only ft_netAB is supported by this test script")

model_structure = ft_netAB(config['ID_class'], norm=config['norm_id'], stride=config['ID_stride'], pool=config['pool'])

fix: PCB test buffer uses 6 parts but PCB model defines 4

Fix: Apply patch:

--- a/reid_eval/test_2label.py
+++ b/reid_eval/test_2label.py
@@ -95,7 +95,7 @@ def extract_feature(model,dataloaders):
         if opt.use_dense:
             ff = torch.FloatTensor(n,1024).zero_()
         else:
             ff = torch.FloatTensor(n,1024).zero_()
         if opt.PCB:
-            ff = torch.FloatTensor(n,2048,6).zero_() # we have six parts
+            ff = torch.FloatTensor(n,2048,4).zero_() # we have four parts
         for i in range(2):
             if(i==1):
@@ -116,8 +116,8 @@ def extract_feature(model,dataloaders):
 
         # norm feature
         if opt.PCB:
-            # feature size (n,2048,6)
+            # feature size (n,2048,4)
             # 1. To treat every part equally, I calculate the norm for every 2048-dim part feature.
-            # 2. To keep the cosine score==1, sqrt(6) is added to norm the whole feature (2048*6).
-            fnorm = torch.norm(ff, p=2, dim=1, keepdim=True) * np.sqrt(6) 
+            # 2. To keep the cosine score==1, sqrt(4) is added to norm the whole feature (2048*4).
+            fnorm = torch.norm(ff, p=2, dim=1, keepdim=True) * np.sqrt(4) 
             ff = ff.div(fnorm.expand_as(ff))
             ff = ff.view(ff.size(0), -1)

Files changed

  • reid_eval/test_2label.py

@andrewwhitecdw
andrewwhitecdw marked this pull request as ready for review August 3, 2026 22:07
@andrewwhitecdw

Copy link
Copy Markdown
Author

Closing this sweep-generated PR: PR has 3 commits; sweep requires exactly one commit per PR. It does not meet the sweep requirements (single signed-off commit).

Signed-off-by: Andrew White <andrewwhitecdw@users.noreply.github.com>
Signed-off-by: andrewwhitecdw <andrewwhitecdw@users.noreply.github.com>
@andrewwhitecdw
andrewwhitecdw force-pushed the bugfix/test-2label-assorted-03ddba26 branch from 69e4a96 to 52d5376 Compare August 18, 2026 00:18
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