Skip to content

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

Open
andrewwhitecdw wants to merge 3 commits 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 3 commits 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 and others added 3 commits July 27, 2026 07:25
Auditor: The diff is incomplete relative to the stated PR description. It only implements the model-selection guard (raising NotImplementedError for --PCB/--use_dense) but omits the second stated fix about the PCB test buffer size mismatch (2048x6 vs 2048x4). A PR titled with '+1 more' must deliver both fixes; otherwise the stated problem is not fully resolved.
Auditor: The diff disables --PCB and --use_dense by raising NotImplementedError rather than selecting a valid model, and the 6→4 part-size changes are in unreachable PCB-specific code, so the stated flag-selection issue is not actually fixed and the diff leaves inconsistent dead code.
@andrewwhitecdw
andrewwhitecdw marked this pull request as ready for review August 3, 2026 22:07
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