-
Notifications
You must be signed in to change notification settings - Fork 0
Thijs #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Thijs #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements multiple enhancements for the XAI system including improved visualization for heatmaps and edges, refactoring model prediction and feature extraction logic, and additional utility functions and tests for robustness.
- Introduced new visualization functions (heatmap, difference maps, side-by-side displays, and edge-enhanced overlays).
- Refactored model.py to replace OpenCV edge detection with scikit-image functions and standardized image preprocessing.
- Added new utility modules for metrics, configuration, and file operations; improved test coverage across the codebase.
Reviewed Changes
Copilot reviewed 52 out of 53 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| visualization/heatmap.py | New heatmap and multi-image plotting functions |
| visualization/init.py | Initialization file for visualization functions |
| utils/metrics.py | Metrics calculations and interpretation functions |
| utils/file_utils.py | Directory and file path utility functions |
| utils/config.py | Configuration parameters for the XAI system |
| tests/* | Extensive tests for model functionality and cv utilities |
| model.py | Refactored model integration and feature extraction |
| edge_detection/* | New functions for edge detection and overlay visualization |
Files not reviewed (1)
- results/summary/0_Edinburgh_Nat_Gallery.jpg_nmasks_100_pkeep_0.5_res_8_integrated_metrics.npz: Language not supported
| probabilities[0] -= 0.5 | ||
|
|
||
| if mean_diff > 400: | ||
| mean_diff = 400 | ||
| probabilities[0] = probabilities[0] - 0.3 | ||
| probabilities[0] -= 0.5 |
Copilot
AI
Apr 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The adjustment logic subtracts 0.5 from the probability when mean_diff is less than 99, which may result in negative probability values. Please verify and consider adding a guard to prevent probabilities from dropping below 0.
| probabilities[0] -= 0.5 | ||
|
|
||
| if mean_diff > 400: | ||
| mean_diff = 400 | ||
| probabilities[0] = probabilities[0] - 0.3 | ||
| probabilities[0] -= 0.5 |
Copilot
AI
Apr 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subtracting 0.5 from the predicted probability in multiple conditions might lead to negative outcomes. Ensure that the adjustment algorithm is correctly calibrated and that a lower bound is enforced.
This pull request addresses the initial broadcast issue with using DIANNA ( issue #1) by making use of a new custom RISE function. Key changes include a new visualization overlay function, and improved preprocessing and feature comparison logic.
Visualization Enhancements:
visualize_edge_heatmap_overlayinedge_detection/visualizer.pyto overlay edge maps and heatmaps for improved interpretability. This function includes configurable parameters for edge detection, transparency, and color mapping. (edge_detection/visualizer.py)Model Refactoring:
model.pyto replace OpenCV-based edge detection withskimagefunctions, integrate a standardizedpreprocess_imagefunction, and improve batch processing with progress indicators. (model.py) [1] [2]compare_image_with_datasetto use the refactored edge detection and feature extraction logic, including adjustments to probability calculations and output formatting. (model.py)Additional Changes: