{"id":13410116,"url":"https://github.com/caiyu6666/DDAD-ASR","last_synced_at":"2025-03-14T15:31:55.984Z","repository":{"id":55026967,"uuid":"522790222","full_name":"caiyu6666/DDAD-ASR","owner":"caiyu6666","description":"[MedIA'2023] Dual-distribution discrepancy with self-supervised refinement for anomaly detection in medical images","archived":false,"fork":false,"pushed_at":"2023-03-17T10:31:10.000Z","size":6769,"stargazers_count":44,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-31T20:40:46.067Z","etag":null,"topics":["anomaly-detection","deep-learning","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caiyu6666.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-09T03:35:26.000Z","updated_at":"2024-02-28T22:00:46.000Z","dependencies_parsed_at":"2024-10-26T05:50:26.484Z","dependency_job_id":"c7be515b-f195-4016-9a8b-b02cac3db34c","html_url":"https://github.com/caiyu6666/DDAD-ASR","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiyu6666%2FDDAD-ASR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiyu6666%2FDDAD-ASR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiyu6666%2FDDAD-ASR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiyu6666%2FDDAD-ASR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caiyu6666","download_url":"https://codeload.github.com/caiyu6666/DDAD-ASR/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243600678,"owners_count":20317315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anomaly-detection","deep-learning","pytorch"],"created_at":"2024-07-30T20:01:05.055Z","updated_at":"2025-03-14T15:31:55.121Z","avatar_url":"https://github.com/caiyu6666.png","language":"Python","funding_links":[],"categories":["Papers"],"sub_categories":["Reconstruction based"],"readme":"\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003eDual-distribution discrepancy with self-supervised refinement for anomaly detection in medical images\u003c/h1\u003e\n  \u003cp align=\"center\"\u003e\n    Yu Cai, Hao Chen, Xin Yang, Yu Zhou, Kwang-Ting Cheng\n  \u003c/p\u003e\n  \u003ch3 align=\"center\"\u003e\u003ca href=\"https://doi.org/10.1016/j.media.2023.102794\"\u003ePaper\u003c/a\u003e\n  \u003cdiv align=\"center\"\u003e\u003c/div\u003e\n\u003c/p\u003e\n\n\n## Visualization on Med-AD\n\n\u003cp align=\"center\"\u003e\u003cimg width=100% src=\"./doc/imgs/vis.png\"\u003e\u003c/p\u003e\n\nFrom top to bottom: original image, ![](http://latex.codecogs.com/svg.latex?\\mathcal{A}_{rec}), DDAD-![](http://latex.codecogs.com/svg.latex?\\mathcal{A}_{intra}), DDAD-![](http://latex.codecogs.com/svg.latex?\\mathcal{A}_{inter}), DDAD-![](http://latex.codecogs.com/svg.latex?\\mathcal{R}_{dual}).\n\n\n\n\n\n## Data Preparation\n\n### Option 1\n\nDownload the well-processed Med-AD benchmark from: [Google Drive](https://drive.google.com/file/d/1ijdaVBNdkYP4h0ClYFYTq9fN1eHoOSa6/view?usp=sharing) | [OneDrive](https://hkustconnect-my.sharepoint.com/:u:/g/personal/ycaibt_connect_ust_hk/EdCbKrjjRMlKi-1AotcAfkoB_jmbTQ2gnQChltgh7l8xVQ?e=t17t2S). \u003cbr\u003e\n(The benchmark is organized using 4 public datasets, and should be **only applied for academic research**.)\n\n\n\n### Option 2\n\nOrganize the Med-AD benchmarks manually follow the [guidance](https://github.com/caiyu6666/DDAD-ASR/tree/main/data).\n\n\n\n## Environment\n\n- NVIDIA GeForce RTX 3090\n- Python 3.10\n- Pytorch 1.12.1\n\n### Packages\n\n```\nconda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch -c nvidia\npip install pillow\npip install joblib\npip install pydicom\npip install opencv-python\npip install scikit-learn\npip install tensorboard\npip install matplotlib \npip install tqdm\n```\n\n\n\n## Train and Evaluate\n\nAll scripts are available in `scripts/`, and configuration files are in `cfgs/`.\nTrain and evaluate the method on RSNA dataset using AE as the backbone: `./scripts/run_rsna_ae.sh`\n\n```python\npython main.py --config cfgs/RSNA_AE.yaml --mode a;\npython main.py --config cfgs/RSNA_AE.yaml --mode a;\npython main.py --config cfgs/RSNA_AE.yaml --mode a;  # ensemble 3 networks for module a (UDM)\npython main.py --config cfgs/RSNA_AE.yaml --mode b;\npython main.py --config cfgs/RSNA_AE.yaml --mode b;\npython main.py --config cfgs/RSNA_AE.yaml --mode b;  # ensemble 3 networks for module b (NDM)\npython main.py --config cfgs/RSNA_AE.yaml --mode eval;\npython main.py --config cfgs/RSNA_AE.yaml --mode r;\npython main.py --config cfgs/RSNA_AE.yaml --mode eval_r;\n```\n\nSimilarly, for training/evaluating on other datasets using other backbones, the following commands can be used:\n\n```\n./scripts/run_rsna_ae.sh\n./scripts/run_rsna_memae.sh\n./scripts/run_rsna_aeu.sh\n\n./scripts/run_vin_ae.sh\n./scripts/run_vin_memae.sh\n./scripts/run_vin_aeu.sh\n\n./scripts/run_brain_ae.sh\n...\n\n./scripts/run_lag_ae.sh\n...\n```\n\n\n\nThe trained models and results are available [here](https://github.com/caiyu6666/DDAD-ASR/releases/tag/downloads).\n\n\n\n## Qualitative Analysis\n\n### AS histograms\n\n\u003cimg src='./doc/imgs/rec_hist.png' width=\"24%\"/\u003e\u003cimg src='./doc/imgs/intra_hist.png' width=\"24%\"/\u003e \u003cimg src='./doc/imgs/inter_hist.png' width=\"24%\"/\u003e\u003cimg src='./doc/imgs/R-intra_hist.png' width=\"24%\"/\u003e\u003cimg src='./doc/imgs/R-dual_hist.png' width=\"24%\"/\u003e\n\n\n\n## Contact\n\nIf any questions, feel free to contact: [yu.cai@connect.ust.hk](mailto:yu.cai@connect.ust.hk)\n\n\n\n## Acknowledgement\n\nWe really appreciate these wonderful open-source codes and datasets!\n\n### Codes\n\n1. https://github.com/dbbbbm/UAE\n2. https://github.com/donggong1/memae-anomaly-detection\n\n### Datasets\n\n1. [RSNA Pneumonia Detection Challenge dataset](https://www.kaggle.com/c/rsna-pneumonia-detection-challenge)\n2. [Vin-BigData Chest X-ray Abnormalities Detection dataset (VinDr-CXR)](https://www.kaggle.com/c/vinbigdata-chest-xray-abnormalities-detection)\n3. [Brain Tumor MRI dataset](https://www.kaggle.com/datasets/masoudnickparvar/brain-tumor-mri-dataset)\n4. [Large-scale Attention-based Glaucoma (LAG) dataset](https://github.com/smilell/AG-CNN)\n\n\n\n## Citation\n\nIf this work is helpful for you, please cite our papers:\n\n```\n@article{CAI2023102794,\ntitle = {Dual-distribution discrepancy with self-supervised refinement for anomaly detection in medical images},\njournal = {Medical Image Analysis},\nvolume = {86},\npages = {102794},\nyear = {2023},\nissn = {1361-8415},\ndoi = {https://doi.org/10.1016/j.media.2023.102794},\nauthor = {Yu Cai and Hao Chen and Xin Yang and Yu Zhou and Kwang-Ting Cheng},\n}\n\n@inproceedings{cai2022dual,\n  title={Dual-Distribution Discrepancy for Anomaly Detection in Chest X-Rays},\n  author={Cai, Yu and Chen, Hao and Yang, Xin and Zhou, Yu and Cheng, Kwang-Ting},\n  booktitle={International Conference on Medical Image Computing and Computer-Assisted Intervention},\n  pages={584--593},\n  year={2022},\n  organization={Springer}\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaiyu6666%2FDDAD-ASR","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaiyu6666%2FDDAD-ASR","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaiyu6666%2FDDAD-ASR/lists"}