-
Notifications
You must be signed in to change notification settings - Fork 435
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
Implement XAI for tiling detection #2240
Implement XAI for tiling detection #2240
Conversation
Could you add and update unit test? |
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.
Thanks for good enhancement! I left some comments. please take a look.
otx/algorithms/common/adapters/mmcv/hooks/recording_forward_hook.py
Outdated
Show resolved
Hide resolved
otx/algorithms/common/adapters/mmcv/hooks/recording_forward_hook.py
Outdated
Show resolved
Hide resolved
otx/algorithms/detection/adapters/mmdet/hooks/det_class_probability_map_hook.py
Outdated
Show resolved
Hide resolved
Overally LGTM, As Eunwoo said, could you add unit test to cover your PR? And is there no need to add intg or e2e test for this feature? |
Thank you for a PR! |
Could you resolve conflicts? |
@eunwoosh @jaegukhyun @negvet @sovrasov |
8f50247
to
988816c
Compare
Could you check fail test cases? |
Summary
This PR implements the functionality to use saliency maps for tiles and merge them in the unite saliency map. The current approach is to resize a whole image and use its saliency map, which suffers from the lack of details.
The results of the new approach and the current one are below.
Also, the exact same merging mechanism was applied for Mask RCNN (Instance Segmentation) Pytorch inference:
![image](https://private-user-images.githubusercontent.com/33455576/249899023-5dcc1fef-80bc-419d-b4e5-8eb620c677c1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgzMTYzMzksIm5iZiI6MTcxODMxNjAzOSwicGF0aCI6Ii8zMzQ1NTU3Ni8yNDk4OTkwMjMtNWRjYzFmZWYtODBiYy00MTlkLWI0ZTUtOGViNjIwYzY3N2MxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjEzVDIyMDAzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdmNTA4ZDU4ZGVjMjNkYTU4MTUxYTIyMzhkZjIxZGUyNGIwOWJhMzZjN2M1OWFjMzIyMDAxMjRhNzAwYjYwMTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.CzAZ-4i8SRltwah_TT_oHLWnSOFklLs9P1eFhtXF5Is)
For Mask RCNN (Instance Segmentation) OpenVINO inference saliency maps aren't returned for each tole. So, the merged masks for the united image were used.
![image](https://private-user-images.githubusercontent.com/33455576/249899077-a9785e63-8635-42a0-9a3b-adbb3653220a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgzMTYzMzksIm5iZiI6MTcxODMxNjAzOSwicGF0aCI6Ii8zMzQ1NTU3Ni8yNDk4OTkwNzctYTk3ODVlNjMtODYzNS00MmEwLTlhM2ItYWRiYjM2NTMyMjBhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjEzVDIyMDAzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRiNzUwZTI1ZWU4MTEwOTE4OTRmZGU3ZjdjOTkwY2FlM2ZjZDFmYWU2NDE1MDk5NWMwMmUyYjhhZGI3MTYwZTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.V5286bbb4GVA0DNckuayaqoMBDesoLzx_YpoBakJMhw)
What was added:
Merging saliency maps functionality, using both saliency maps from tiles and a whole image, add non-linear normalization afterward
Add implementation for PyTorch inference and OpenVINO inference for all detection models
Add implementation to merge saliency maps for Pytorch task for Instance Segmentation task (Mask RCNN)
Updated saliency map generation for OpenVINO inference task for Instance Segmentation
Add parameter in BaseRecordingForwardHook whether to return normalized saliency maps
Add parameter in DetClassProbabilityMapHook whether to use softmax in saliency maps postprocessing
Fixed the issue there during workplace creation for Mask RCNN model
deployment_tile_classifier.py
config file wasn't createdUnit tests
e2e tests
CVS-108355
Checklist
License
Feel free to contact the maintainers if that's a concern.