Browse Source
Fix: ResNet BatchNorm discrepancies and comparison script issues
Fix: ResNet BatchNorm discrepancies and comparison script issues
- **C++ ResNet BatchNorm Fix**: Remove manual float64 BatchNorm computation and use standard float32 forward() to match Python behavior - Replace manual BatchNorm calculation with bn->forward(x) for both training and eval modes - This resolves major discrepancies in Layer1-4 outputs, achieving perfect cosine similarity (1.0000) - **Python Comparison Script Fix**: Remove unsupported output layer requests that caused "output_layer is wrong" errors - Only request layers that Python ResNet actually supports: ['conv1', 'layer1', 'layer2', 'layer3', 'layer4'] - Remove requests for intermediate debug layers (bn1_output, conv1_pre_bn, etc.) - Update layer mapping logic to gracefully skip unsupported layers - Fix Conv1 mapping from 'conv1_pre_bn' to 'conv1' - **Test Models Fix**: Remove invalid debug method calls that caused build errors - Remove calls to non-existent debug_get_conv3_1t_output() and debug_get_conv4_1t_output() - Restore correct BBRegressor processing using valid methods (get_iou_feat, get_modulation, predict_iou) **Results:** - ResNet Layer1-4 and Features now have perfect cosine similarity (1.0000) - Build errors resolved, comparison script runs successfully - BatchNorm running_mean, running_var, and num_batches_tracked fixes working correctly - Conv1 still has issues (0.5291 cosine similarity) - separate investigation neededresnet
2 changed files with 21 additions and 129 deletions
Write
Preview
Loading…
Cancel
Save
Reference in new issue