{"id":13936626,"url":"https://github.com/ayush1997/Xvision","last_synced_at":"2025-07-19T22:31:12.871Z","repository":{"id":74822398,"uuid":"77830296","full_name":"ayush1997/Xvision","owner":"ayush1997","description":"Chest Xray image analysis using Deep learning !","archived":false,"fork":false,"pushed_at":"2019-10-01T09:25:07.000Z","size":7640,"stargazers_count":304,"open_issues_count":1,"forks_count":126,"subscribers_count":28,"default_branch":"master","last_synced_at":"2024-08-08T23:24:04.423Z","etag":null,"topics":["chest-xray-images","computer-vision","deep-learning","medical-imaging","python","tensorflow","transfer-learning","vggnet"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ayush1997.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-01-02T11:56:15.000Z","updated_at":"2024-05-06T09:17:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4f8e3ef-014a-4790-80b0-1c8be115e0f7","html_url":"https://github.com/ayush1997/Xvision","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayush1997%2FXvision","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayush1997%2FXvision/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayush1997%2FXvision/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayush1997%2FXvision/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ayush1997","download_url":"https://codeload.github.com/ayush1997/Xvision/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226686729,"owners_count":17666928,"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":["chest-xray-images","computer-vision","deep-learning","medical-imaging","python","tensorflow","transfer-learning","vggnet"],"created_at":"2024-08-07T23:02:52.120Z","updated_at":"2024-11-27T04:31:15.526Z","avatar_url":"https://github.com/ayush1997.png","language":"Python","funding_links":[],"categories":["X-ray, 2d images","Python"],"sub_categories":[],"readme":"# Xvision\n\nChest Xray image analysis using **Deep Learning** and  exploiting **Deep Transfer Learning** technique for it with Tensorflow.\n\nThe **maxpool-5** layer of a pretrained **VGGNet-16(Deep Convolutional Neural Network)** model has been used as the feature extractor here and then further trained on a **2-layer Deep neural network** with **SGD optimizer** and **Batch Normalization** for classification of **Normal vs Nodular** Chest Xray Images.\n\n## Nodular vs Normal Chest Xray\n\u003cimg src=\"https://github.com/ayush1997/Xvision/blob/master/image/node.jpg\" width=\"300\" height=\"300\" /\u003e\n\u003cimg src=\"https://github.com/ayush1997/Xvision/blob/master/image/normal.jpg\" width=\"300\" height=\"300\" /\u003e\n\n## Some specifications\n\n| Property      |Values         |\n| ------------- | ------------- |\n| Pretrained Model | VggNet-16  |\n| Optimizer used  | stochastic gradient descent(SGD)  |\n| Learning rate  | 0.01|  \n|Mini Batch Size| 20 |\n| Epochs | 20 |\n|2 Layers| 512x512 |\n|GPU trained on| Nvidia GEFORCE 920M|\n\n## Evaluation\n### Confusion Matrix and Training Error Graph\n\n\u003cimg src=\"https://github.com/ayush1997/Xvision/blob/master/image/cfm.jpg\" width=\"450\" height=\"400\" /\u003e\n\u003cimg src=\"https://github.com/ayush1997/Xvision/blob/master/image/nodule.jpg\" width=\"400\" height=\"400\" /\u003e\n\n|     |  **Normal** | **Nodule** |\n|------|---------|---------|\n| **Precision**| 0.7755102| 0.55555556 |\n|**Recall**| 0.76 | 0.57692308 |\n\n**Accuracy** : **69.3333 %**\n\n## DataSet\n[openi.nlm.nih.gov](https://openi.nlm.nih.gov/gridquery.php?q=\u0026it=x,xg\u0026sub=x\u0026m=1\u0026n=101) has a large base of Xray,MRI, CT scan images publically available.Specifically Chest Xray Images have been scraped, Normal and Nodule labbeled images are futher extrated for this task.\n\n## How to use ?\nThe above code can be used for **Deep Transfer Learning** on any Image dataset to train using VggNet as the PreTrained network. \n### Steps to follow \n\n1. Download Data- the script download images and saves corresponding disease label in json format.\n\n  ```python scraper.py \u003cpath/to/folder/to/save/images\u003e```\n\n2. Follow the ```scraper/process.ipynb``` notebook for Data processing and generate\n\n  * Training images folder - All images for training\n  * Testing images Folder - All images for testing\n  * Training image labels file - Pickled file with training labels\n  * Testing image labels file - Pickled file with testing labels\n\n3. Extract features(**CNN Codes**) from the **maxpool:5** layer of PreTrained CovNet(VggNet) and save them beforehand for faster training of Neural network.\n\n    ```python train.py \u003cTraining images folder\u003e \u003cTesting image folder\u003e \u003cTrain images codes folder \u003e \u003cTest images codes folder\u003e```\n    \n    * Train images codes folder - Path where training images codes will be stored\n    * Test images codes folder - Path where testing images codes will be stored\n    \n\n4.  The extracted features are now used for training our **2-Layer Neural Network** from scratch.The computed models are saved as tensorflow checkpoint after every **Epoch**.\n\n    ```python train_model.py \u003cTraining images folder\u003e \u003cTrain images codes folder\u003e \u003cTraining image labels file\u003e \u003cFolder to         save models\u003e```\n\n5.  Finally the saved models are used for making predictions.Confusion Matrix is used as the Performance Metrics for this classifcation task.\n\n    ```python test_model.py \u003cTesting images folder\u003e \u003cTest images codes folder\u003e \u003cTesting image labels file\u003e \u003cFolder with saved models\u003e```\n    \n    \n    \n## Some Predictions\n\n![Alt text](https://github.com/ayush1997/Xvision/blob/master/image/pred.jpg \"Optional Title\")\n\n## References\n\n\u003e 1. [Learning to Read Chest X-Rays: Recurrent Neural Cascade Model for Automated Image Annotation](https://arxiv.org/pdf/1603.08486.pdf)\n\n\u003e 2. [Deep Convolutional Neural Networks for Computer-Aided Detection: CNN Architectures,\nDataset Characteristics and Transfer Learning](https://arxiv.org/pdf/1602.03409.pdf)\n\n## Contribute\n\nIf you want to contribute and add new feature feel free to send Pull request [here](https://github.com/ayush1997/Xvision/pulls) :D\n\nTo report any bugs or request new features, head over to the [Issues page](https://github.com/ayush1997/Xvision/issues)\n\n## To-do\n\n- [ ] Implement saliency map or use Deconv for better visualizations. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayush1997%2FXvision","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayush1997%2FXvision","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayush1997%2FXvision/lists"}