feat: add ImageNet mean replacement strategy#19
Conversation
Co-authored-by: Copilot <copilot@github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds a new ImageNet Mean Replacement
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a new ImageNet mean replacement strategy, which replaces masked regions with the dataset-level ImageNet mean color. The changes include implementing the imagenet_mean_replacement function, exposing it in the package API, adding a configuration file, and updating the README. Feedback on the implementation suggests simplifying the imagenet_mean_replacement function by using torch.zeros_like(image) instead of manually unpacking the shape and expanding a new zero tensor.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new obfuscation/replacement strategy that fills masked regions with the ImageNet dataset mean; under the project’s standard ImageNet normalization this is equivalent to a zero tensor, providing a simple dataset-level baseline replacement.
Changes:
- Added
imagenet_mean_replacementstrategy inciao/data/replacement.py(implemented astorch.zeros_like(image)). - Exported the new replacement strategy from
ciao/data/__init__.pyand added a Hydra config atconfigs/replacement/imagenet_mean.yaml. - Documented the new replacement option in
README.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| README.md | Adds the “ImageNet Mean” replacement option to user-facing documentation and lists the new config file in the structure overview. |
| configs/replacement/imagenet_mean.yaml | Introduces a Hydra config entry targeting the new replacement callable. |
| ciao/data/replacement.py | Implements the ImageNet-mean replacement strategy (currently zero tensor in normalized space). |
| ciao/data/init.py | Re-exports the new replacement function via imports and __all__. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Context:
Adds a new masking replacement strategy that substitutes occluded regions with the ImageNet dataset mean. Under standard ImageNet normalization, this maps to a zero tensor — equivalent to replacing with the mean color.
What's Changed / Added:
ciao/data/replacement.py: Introducedimagenet_mean_replacementfunction, which returns a zero tensor of the same shape as the input (mean color after ImageNet normalization).ciao/data/__init__.py: Exported the new replacement function.configs/replacement/imagenet_mean.yaml: Added config entry for the new strategy.README.md: Noted the new replacement option.Related Task:
XAI-29
Summary by CodeRabbit
New Features
Documentation