Author: Shiwei Liu, College of Artificial Intelligence, Nankai University
E-mail: 2011832@mail.nankai.edu.cn
This project is my final assignment for the course "Artificial Intelligence Technology" during my junior year at Nankai University.It is used to classify whether a given human lung X-ray image is diseased or not. I built a CNN by Pytorch to deal with this problem and it works well in this dataset (please download it in./chest_xray). After only 100 epochs training, it achieves 88% accuracy in validation dataset and 75% accuracy in test dataset. I also plot the "train and val loss" curve and test-results images.
- Create a conda environment by running this command(replace YOUR_ENV_NAME):
conda create -n YOUR_ENV_NAME python==3.9 - Install Pytorch which is suitable for your GPU or CPU(not recommended):
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 - Use
piptool to install other required package:pip install numpy pip install os pip install matplotlib
- Clone this project to your own PC:
git clone - Download dataset, and place file
chest_xrayin./Chest_Classify - Activate the conda environment created before
conda activate YOUR_ENV_NAMEand run this command (replace NUM_OF_EP):Trained module will be saved aspython main.py --epochs=NUM_OF_EP./model.pt.
When main.py finished the train function I use matplotlib to plot the curve of "train loss/accuracy" and "validation loss/accuracy":

You can write your own test.py to visualize the training result.
The overfitting situation is very serious. Maybe more dropout or a simpler network structure?
