The main problem that faces the world right now in terms of this new coronavirus is that the official testing kits are really limited in the world especially in developing countries and knowing where the virus is in any community is a huge part of our fight against this virus, so I decided to find a way that can detect covid-19 from resources that already exist in every hospital thus, my idea is to detect covid-19 patients from a chest x-ray image using deep learning and neural networks.
Step-by-step manual:1- Setting up the Argon:
The circuit board og the Argon device is very simple as we only need it to show results from our model with 2 different LEDs, so the circuit board is:
then we upload a code to the device that has an online function that takes a string as an argument and if the string is 1 we flash the red LED or if the result is 0 we flash the blue LED. 1 and 0 we get it from the model prediction as 1 test positive and 0 test negative.
2- Trainning the model:
To train the model we use Tensorflow and Keras. Tensorflow is an open source machine learning platform and Keras is a neural network library written in python.
Adrian Rosebrock made an amazing guide on how to train the model and I recommend you follow his guide to understand more about it as it is a big part of this project. Guide: https://www.pyimagesearch.com/2020/03/16/detecting-covid-19-in-x-ray-images-with-keras-tensorflow-and-deep-learning/
After you followed his guide you should have already downloaded Tensorflow and Keras on your computer to evetually train the model. Then you should have a file labelled "covid19.model".
Moreover, if you need more chest x-ray images datasets (to train the model with) you need to go to Dr. Joseph Cohen GitHub : https://github.com/ieee8023/covid-chestxray-dataset
3- Setting up the Raspberry Pi:
Downloading a Tensorflow and Keras on raspberry devices is bit of a headache but I hope I will make it easy for you. First, you need to run these command to eventually download tensorflow and keras on RPi. Commands:
- Install the last version of Opencv that support RPi:
pip3 install opencv-python==3.4.6.27
- Then run these commands:
sudo apt-get install python3-numpy
sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev
sudo apt-get install python3-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install gfortran
sudo apt-get install python3-setuptools
sudo apt-get install python3-scipy
sudo apt-get update
sudo apt-get install python3-h5py
sudo apt-get install libqtgui4
sudo apt-get install python3-pyqt5
sudo apt-get install libqt4-test
- Lastly, download tensorflow and keras manually:
This version is for RPi model 3, check your model and download the matching version of Tensorflow from: https://github.com/lhelontra/tensorflow-on-arm/releases/tag/v2.2.0
pip3 install tensorflow-1.13.1-cp35-none-linux_armv7l.whl
pip3 install tensorflow
wget
https://www.piwheels.org/simple/scipy/scipy-1.4.1-cp37-cp37m-linux_armv7l.whl
pip3 install scipy-1.2.1-cp35-cp35m-linux_armv7l.whl
pip3 install scipy
pip3 install Keras
Now the RPi is ready to go to the next step.
3- GUI python script:
Transfer the model file to RPi and put it on the same file as GUI script.
This script is written in python and its job is to greet the user with a GUI and from it the user can enter a new chest x-ray image.
we load the model and compile it.
This function takes the user chosen file and then prepare it to enter it to the trained model to make a prediction. Based on that prediction we call the Argon device function to power on the red LED if they tested positive or the blue one if they tested negative.
Replace your-device-ID-goes-here with your actual device ID and replace your-access-token-goes-here with your actual access token
4- Connecting the devices together:
So the system has 3 components Argon device, Raspberry Pi, and your computer. We connect to the RPi using Remote desktop connection if your using windows or SSH to execute the GUI python script and the goal of doing it this way is that anyone can connect to it. RPi calls a function online on the Argon device to display the results.
Consider training the model with more data like geographical location, patient health past and population mass. Furthermore, make the RPi a server so anyone from anywhere can access it, not just from your local network.
Note: this project is part of assignment submitted to Deakin University, School of IT, Unit SIT210 - Embedded Systems Development.
Comments