The Acute Lymphoblastic Leukemia Jetson Nano Classifier is a Convolutional Neural Network (CNN) developed using Intel® oneAPI AI Analytics Toolkit and Intel® Optimization for Tensorflow* to accelerate the training process, and TensorRT for high performance inference on the NVIDIA® Jetson Nano™.
In this project you will do the following.
- Train a custom CNN for Acute Lymphoblastic Leukemia on your development machine.
- Convert the Tensorflow SavedModel to TFRT format
- Convert the Tensorflow SavedModel to ONNX format
- Convert the Tensorflow ONNX model to TensorRT format
- Test the CNN on your development machine.
- Download or create a custom docker container for your NVIDIA Jetson Nano.
- Run the CNN on your NVIDIA Jetson Nano using Tensorflow.
- Run the CNN on your NVIDIA Jetson Nano using TFRT.
- Run the CNN on your NVIDIA Jetson Nano using TensorRT.
The NVIDIA® Jetson Nano™ is a small, powerful computer that is capable of running multiple neural networks in parallel for applications like image classification, object detection, segmentation, and speech processing.Motivation
The motivation behind this project was to test the capabilities of the NVIDIA® Jetson Nano™ for the classification of Acute Lymphoblastic Leukemia on the edge. This project is also a submission for the NVIDIA Jetson AI Specialist Certification.
DISCLAIMERThis project should be used for research purposes only. The purpose of the project is to show the potential of Artificial Intelligence for medical support systems such as diagnostic systems.
Although the model is accurate and shows good results both on paper and in real world testing, it is trained on a small amount of data and needs to be trained on larger datasets to really evaluate it's accuracy.
Developers that have contributed to this repository have experience in using Artificial Intelligence for detecting certain types of cancer. They are not doctors, medical or cancer experts.
Acute Lymphoblastic LeukemiaAcute lymphoblastic leukemia (ALL), also known as Acute Lymphocytic Leukemia, is a cancer that affects the lymphoid blood cell lineage. It is the most common leukemia in children, and it accounts for 10-20% of acute leukemias in adults. The prognosis for both adult and especially childhood ALL has improved substantially since the 1970s. The 5- year survival is approximately 95% in children. In adults, the 5-year survival varies between 25% and 75%, with more favorable results in younger than in older patients.
For more information about Acute Lymphoblastic Leukemia please visit our Leukemia Information Page
ALL-IDBYou need to be granted access to use the Acute Lymphoblastic Leukemia Image Database for Image Processing dataset. You can find the application form and information about getting access to the dataset on this page as well as information on how to contribute back to the project here. If you are not able to obtain a copy of the dataset please feel free to try this tutorial on your own dataset, we would be very happy to find additional AML & ALL datasets.
Getting StartedClone the repositoryClone the ALL Jetson Nano Classifier repository from the Peter Moss Acute Myeloid & Lymphoblastic Leukemia AI Research Project Github Organization.
To clone the repository and install the project, make sure you have Git installed. Now navigate to the directory you would like to clone the project to and then use the following command.
git clone https://github.com/AMLResearchProject/ALL-Jetson-Nano-Classifier.git
This will clone the ALL Jetson Nano Classifier repository.
ls
Using the ls command in your home directory should show you the following.
ALL-Jetson-Nano-Classifier
Navigate to the ALL-Jetson-Nano-Classifier directory, this is your project root directory for this tutorial.
Developer forksDevelopers from the Github community that would like to contribute to the development of this project should first create a fork, and clone that repository. For detailed information please view the research project CONTRIBUTING guide. You should pull the latest code from the development branch.
git clone -b "develop" https://github.com/AMLResearchProject/ALL-Jetson-Nano-Classifier.git
The -b "develop" parameter ensures you get the code from the latest develop branch.
InstallationFirst you will install the Intel® oneAPI Basekit,Intel® oneAPI AI Analytics Toolkit and the Intel oneAPI GPU drivers.
WARNING: This script assumes you have not already installed the oneAPI Basekit.
WARNING: This script assumes you have not already installed the oneAPI AI Analytics Toolkit.
WARNING: This script assumes you have an Intel GPU.
WARNING: This script assumes you have already installed the Intel GPU drivers.
HINT: If any of the above are not relevant to you, please comment out the relevant sections below before running this installation script.
From the project root run the following command in terminal:
sh scripts/oneapi.sh
You are now ready to install the ALL Jetson Nano Classifier trainer. All software requirements are included in scripts/install.sh. You can run this file on your machine from the project root in terminal.
Before you begin make sure you have activated the all-jetson-nano Conda environment.
conda activate all-jetson-nano
Then use the following command to install the required software:
sh scripts/install.sh
Start Jupyter NotebooksNow you need to start Jupyter Notebooks. In your project root execute the following command, replacing the IP and port as desired.
jupyter notebook --ip YourIP --port 8888
Open The Training NotebookNavigate to the URL provided when starting Jupyter Notebooks and you should be in the project root. Now navigate to notebooks/classifier.ipynb. With everything set up you can now begin training. Run the Jupyter Notebook and wait for it to finish.
Here we trained a deep learning model for Acute Lymphoblastic Leukemia detection utilizing Intel® Optimization for Tensorflow* from the Intel® oneAPI AI Analytics Toolkit to optimize and accelarate training. We introduced a 6 layer deep learning model and applied data augmentation to increase the training data.
We trained our model with a target of 150 epochs and used early stopping to avoid overfitting. The model trained for 37 epochs resulting in a fairly good fit, accuracy/precision/recall and AUC are satisfying. In addition the model reacts well during testing classifying each of the twenty unseen test images correctly.
We see that the TFRT model performs considerably better than the Tensorflow model, improving classification time by 0.35 seconds.
NVIDIA Jetson NanoThis project requires an NVIDIA Jetson Nano Developer Kit and the Jetson Nano Developer Kit SD Card Image. For information on how to set up your Jetson Nano prior to starting this tutorial visit Getting Started with Jetson Nano Developer Kit
SoftwareWe have prepared a Docker image for this project to allow easy installation on the NVIDIA Jetson Nano. To download the image visit the petermossleukemiaairesearch/all-jetson-nano repository.
PrerequisitesYou will need to ensure you have followed the provided guides below:
SetupThe first thing you need to do is transfer the trained model and data from your development/training machine to your home directory on the Jetson Nano. The remainder of this tutorial assumes you have copied the entire ALL-Jetson-Nano-Classifier directory to your home directory on the Jetson Nano.
In your home directory on your Jetson Nano, ensure that you have completed this step.
ls
You should see the following output:
ALL-Jetson-Nano-Classifier
You should now ensure that you have the following:
- The test data is in the model/data/test directory
- The model/saved directory is not empty and contains the saved_model.pb file, assets and variables directories.
- The model/tfrt directory is not empty and contains the saved_model.pb file, assets and variables directories.
- The all_jetson_nano.json file is in the model directory
- The all_jetson_nano.h5 file is in the model directory
- The all_jetson_nano.onnx file is in the model directory
Now you are ready to use the ALL Jetson Nano Classifier docker image on your Jetson Nano.
Open terminal on your Jetson Nano or login using ssh and use the following command to download the image, start the container and mount the ALL-Jetson-Nano-Classifier directory as a volume in the container. Ensure you change YourUser with the user you are logged into the nano on.
sudo docker run -it --name all-jetson-nano --rm --runtime nvidia --network host -v /home/YourUser/ALL-Jetson-Nano-Classifier:/ALL-Jetson-Nano-Classifier petermossleukemiaairesearch/all-jetson-nano:v1
If you want to create your own Docker image, steps have been provided in the scripts/docker.txt file.
Docker ContainerDuring the NVIDIA Jetson Nano Installation you download the ALL Jetson Nano Classifier Docker Image and started it. You should make sure you are inside the Docker container before you continue this tutorial.
Running The Tensorflow ModelNow you are ready to run the Tensorflow model. You will use the 20 images that were removed from the training data in the previous tutorials.
To run the classifier in use the following command:
python3 classifier.py classify
You should see the following which shows you the network architecture:
Model: "AllJetsonNano"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
average_pooling2d (AveragePo (None, 50, 50, 3) 0
_________________________________________________________________
conv2d (Conv2D) (None, 46, 46, 30) 2280
_________________________________________________________________
depthwise_conv2d (DepthwiseC (None, 17, 17, 30) 27030
_________________________________________________________________
flatten (Flatten) (None, 8670) 0
_________________________________________________________________
dense (Dense) (None, 2) 17342
_________________________________________________________________
softmax (Activation) (None, 2) 0
=================================================================
Total params: 46,652
Trainable params: 46,652
Non-trainable params: 0
_________________________________________________________________
Finally the application will start processing the test images and the results will be displayed in the console. The first classification will take longer due to loading the required dynamic libraries.
2021-08-22 18:01:15,260 - Classifier - INFO - Loaded test image model/data/test/Im041_0.jpg
2021-08-22 18:01:16.234253: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.10
2021-08-22 18:01:17.260057: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-08-22 18:01:26,193 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 10.915842771530151 seconds.
2021-08-22 18:01:28,123 - Classifier - INFO - Loaded test image model/data/test/Im028_1.jpg
2021-08-22 18:01:28,798 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.6637485027313232 seconds.
2021-08-22 18:01:31,314 - Classifier - INFO - Loaded test image model/data/test/Im053_1.jpg
2021-08-22 18:01:31,490 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.16409754753112793 seconds.
2021-08-22 18:01:32,955 - Classifier - INFO - Loaded test image model/data/test/Im047_0.jpg
2021-08-22 18:01:33,130 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.16338133811950684 seconds.
2021-08-22 18:01:33,202 - Classifier - INFO - Loaded test image model/data/test/Im026_1.jpg
2021-08-22 18:01:33,367 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.16285347938537598 seconds.
2021-08-22 18:01:35,027 - Classifier - INFO - Loaded test image model/data/test/Im106_0.jpg
2021-08-22 18:01:35,211 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.17293715476989746 seconds.
2021-08-22 18:01:35,485 - Classifier - INFO - Loaded test image model/data/test/Im088_0.jpg
2021-08-22 18:01:35,659 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.16274356842041016 seconds.
2021-08-22 18:01:36,228 - Classifier - INFO - Loaded test image model/data/test/Im074_0.jpg
2021-08-22 18:01:36,401 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.16106271743774414 seconds.
2021-08-22 18:01:36,629 - Classifier - INFO - Loaded test image model/data/test/Im057_1.jpg
2021-08-22 18:01:36,818 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.1783151626586914 seconds.
2021-08-22 18:01:37,055 - Classifier - INFO - Loaded test image model/data/test/Im101_0.jpg
2021-08-22 18:01:37,236 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.170271635055542 seconds.
2021-08-22 18:01:37,300 - Classifier - INFO - Loaded test image model/data/test/Im024_1.jpg
2021-08-22 18:01:37,464 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.16158628463745117 seconds.
2021-08-22 18:01:37,531 - Classifier - INFO - Loaded test image model/data/test/Im006_1.jpg
2021-08-22 18:01:37,706 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.17259979248046875 seconds.
2021-08-22 18:01:38,329 - Classifier - INFO - Loaded test image model/data/test/Im035_0.jpg
2021-08-22 18:01:38,527 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.1852095127105713 seconds.
2021-08-22 18:01:38,590 - Classifier - INFO - Loaded test image model/data/test/Im031_1.jpg
2021-08-22 18:01:38,753 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.1616823673248291 seconds.
2021-08-22 18:01:38,971 - Classifier - INFO - Loaded test image model/data/test/Im069_0.jpg
2021-08-22 18:01:39,144 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.16157913208007812 seconds.
2021-08-22 18:01:39,495 - Classifier - INFO - Loaded test image model/data/test/Im063_1.jpg
2021-08-22 18:01:39,677 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.1709306240081787 seconds.
2021-08-22 18:01:39,900 - Classifier - INFO - Loaded test image model/data/test/Im060_1.jpg
2021-08-22 18:01:41,829 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 1.917875051498413 seconds.
2021-08-22 18:01:41,892 - Classifier - INFO - Loaded test image model/data/test/Im020_1.jpg
2021-08-22 18:01:42,057 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.1628572940826416 seconds.
2021-08-22 18:01:44,639 - Classifier - INFO - Loaded test image model/data/test/Im095_0.jpg
2021-08-22 18:01:44,828 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.17487740516662598 seconds.
2021-08-22 18:01:45,801 - Classifier - INFO - Loaded test image model/data/test/Im099_0.jpg
2021-08-22 18:01:45,987 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.17336750030517578 seconds.
2021-08-22 18:01:45,987 - Classifier - INFO - Images Classified: 20
2021-08-22 18:01:45,988 - Classifier - INFO - True Positives: 10
2021-08-22 18:01:45,988 - Classifier - INFO - False Positives: 0
2021-08-22 18:01:45,988 - Classifier - INFO - True Negatives: 10
2021-08-22 18:01:45,989 - Classifier - INFO - False Negatives: 0
2021-08-22 18:01:45,989 - Classifier - INFO - Total Time Taken: 16.357818841934204
Running The TFRT ModelNow you will run the TFRT model:
python3 classifier.py classify_tfrt
You will see the following output:
2021-08-22 18:02:50,101 - Classifier - INFO - Loaded test image model/data/test/Im041_0.jpg
2021-08-22 18:02:50.198938: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.10
2021-08-22 18:02:51.947017: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-08-22 18:02:58,320 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 8.210758924484253 seconds.
2021-08-22 18:02:58,938 - Classifier - INFO - Loaded test image model/data/test/Im028_1.jpg
2021-08-22 18:02:58,951 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.008095026016235352 seconds.
2021-08-22 18:03:04,524 - Classifier - INFO - Loaded test image model/data/test/Im053_1.jpg
2021-08-22 18:03:04,545 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.007901668548583984 seconds.
2021-08-22 18:03:04,830 - Classifier - INFO - Loaded test image model/data/test/Im047_0.jpg
2021-08-22 18:03:04,849 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.006689786911010742 seconds.
2021-08-22 18:03:04,920 - Classifier - INFO - Loaded test image model/data/test/Im026_1.jpg
2021-08-22 18:03:04,929 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.007235288619995117 seconds.
2021-08-22 18:03:05,379 - Classifier - INFO - Loaded test image model/data/test/Im106_0.jpg
2021-08-22 18:03:05,398 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.007020711898803711 seconds.
2021-08-22 18:03:05,880 - Classifier - INFO - Loaded test image model/data/test/Im088_0.jpg
2021-08-22 18:03:05,897 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.006475210189819336 seconds.
2021-08-22 18:03:06,688 - Classifier - INFO - Loaded test image model/data/test/Im074_0.jpg
2021-08-22 18:03:06,705 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.006563425064086914 seconds.
2021-08-22 18:03:07,274 - Classifier - INFO - Loaded test image model/data/test/Im057_1.jpg
2021-08-22 18:03:07,292 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.006519794464111328 seconds.
2021-08-22 18:03:07,509 - Classifier - INFO - Loaded test image model/data/test/Im101_0.jpg
2021-08-22 18:03:07,527 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.006318807601928711 seconds.
2021-08-22 18:03:07,590 - Classifier - INFO - Loaded test image model/data/test/Im024_1.jpg
2021-08-22 18:03:07,598 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.006488323211669922 seconds.
2021-08-22 18:03:07,660 - Classifier - INFO - Loaded test image model/data/test/Im006_1.jpg
2021-08-22 18:03:07,668 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.006326436996459961 seconds.
2021-08-22 18:03:07,966 - Classifier - INFO - Loaded test image model/data/test/Im035_0.jpg
2021-08-22 18:03:07,983 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.006209611892700195 seconds.
2021-08-22 18:03:08,046 - Classifier - INFO - Loaded test image model/data/test/Im031_1.jpg
2021-08-22 18:03:08,054 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.006255626678466797 seconds.
2021-08-22 18:03:08,268 - Classifier - INFO - Loaded test image model/data/test/Im069_0.jpg
2021-08-22 18:03:08,290 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.006395816802978516 seconds.
2021-08-22 18:03:08,586 - Classifier - INFO - Loaded test image model/data/test/Im063_1.jpg
2021-08-22 18:03:08,604 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.006394624710083008 seconds.
2021-08-22 18:03:08,799 - Classifier - INFO - Loaded test image model/data/test/Im060_1.jpg
2021-08-22 18:03:08,817 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.006200551986694336 seconds.
2021-08-22 18:03:08,879 - Classifier - INFO - Loaded test image model/data/test/Im020_1.jpg
2021-08-22 18:03:08,888 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.006281137466430664 seconds.
2021-08-22 18:03:09,188 - Classifier - INFO - Loaded test image model/data/test/Im095_0.jpg
2021-08-22 18:03:09,205 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.006270170211791992 seconds.
2021-08-22 18:03:09,413 - Classifier - INFO - Loaded test image model/data/test/Im099_0.jpg
2021-08-22 18:03:09,430 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.0063779354095458984 seconds.
2021-08-22 18:03:09,430 - Classifier - INFO - Images Classified: 20
2021-08-22 18:03:09,431 - Classifier - INFO - True Positives: 10
2021-08-22 18:03:09,431 - Classifier - INFO - False Positives: 0
2021-08-22 18:03:09,431 - Classifier - INFO - True Negatives: 10
2021-08-22 18:03:09,431 - Classifier - INFO - False Negatives: 0
2021-08-22 18:03:09,432 - Classifier - INFO - Total Time Taken: 8.33677887916565
Running The TensorRT ModelNow you will run the TensorRT model:
python3 classifier.py classify_tensorrt
You will see the following output:
2021-08-22 18:04:13,896 - Classifier - INFO - Loaded test image model/data/test/Im041_0.jpg
2021-08-22 18:04:13,941 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.03255295753479004 seconds.
2021-08-22 18:04:14,115 - Classifier - INFO - Loaded test image model/data/test/Im028_1.jpg
2021-08-22 18:04:14,123 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.002234220504760742 seconds.
2021-08-22 18:04:14,829 - Classifier - INFO - Loaded test image model/data/test/Im053_1.jpg
2021-08-22 18:04:14,842 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.0021958351135253906 seconds.
2021-08-22 18:04:15,070 - Classifier - INFO - Loaded test image model/data/test/Im047_0.jpg
2021-08-22 18:04:15,083 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.0021576881408691406 seconds.
2021-08-22 18:04:15,157 - Classifier - INFO - Loaded test image model/data/test/Im026_1.jpg
2021-08-22 18:04:15,161 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.0022268295288085938 seconds.
2021-08-22 18:04:15,739 - Classifier - INFO - Loaded test image model/data/test/Im106_0.jpg
2021-08-22 18:04:15,752 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.0021431446075439453 seconds.
2021-08-22 18:04:16,051 - Classifier - INFO - Loaded test image model/data/test/Im088_0.jpg
2021-08-22 18:04:16,064 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.002117633819580078 seconds.
2021-08-22 18:04:16,453 - Classifier - INFO - Loaded test image model/data/test/Im074_0.jpg
2021-08-22 18:04:16,466 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.002123594284057617 seconds.
2021-08-22 18:04:16,924 - Classifier - INFO - Loaded test image model/data/test/Im057_1.jpg
2021-08-22 18:04:16,940 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.0021796226501464844 seconds.
2021-08-22 18:04:17,393 - Classifier - INFO - Loaded test image model/data/test/Im101_0.jpg
2021-08-22 18:04:17,406 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.0023069381713867188 seconds.
2021-08-22 18:04:17,473 - Classifier - INFO - Loaded test image model/data/test/Im024_1.jpg
2021-08-22 18:04:17,477 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.0021584033966064453 seconds.
2021-08-22 18:04:17,539 - Classifier - INFO - Loaded test image model/data/test/Im006_1.jpg
2021-08-22 18:04:17,543 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.0021212100982666016 seconds.
2021-08-22 18:04:17,806 - Classifier - INFO - Loaded test image model/data/test/Im035_0.jpg
2021-08-22 18:04:17,818 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.0021283626556396484 seconds.
2021-08-22 18:04:17,889 - Classifier - INFO - Loaded test image model/data/test/Im031_1.jpg
2021-08-22 18:04:17,893 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.0021491050720214844 seconds.
2021-08-22 18:04:18,190 - Classifier - INFO - Loaded test image model/data/test/Im069_0.jpg
2021-08-22 18:04:18,203 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.002172708511352539 seconds.
2021-08-22 18:04:18,922 - Classifier - INFO - Loaded test image model/data/test/Im063_1.jpg
2021-08-22 18:04:18,935 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.002173900604248047 seconds.
2021-08-22 18:04:19,488 - Classifier - INFO - Loaded test image model/data/test/Im060_1.jpg
2021-08-22 18:04:19,501 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.002492666244506836 seconds.
2021-08-22 18:04:19,565 - Classifier - INFO - Loaded test image model/data/test/Im020_1.jpg
2021-08-22 18:04:19,569 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly detected (True Positive) in 0.002119779586791992 seconds.
2021-08-22 18:04:20,562 - Classifier - INFO - Loaded test image model/data/test/Im095_0.jpg
2021-08-22 18:04:20,575 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.0021810531616210938 seconds.
2021-08-22 18:04:21,296 - Classifier - INFO - Loaded test image model/data/test/Im099_0.jpg
2021-08-22 18:04:21,308 - Classifier - INFO - Acute Lymphoblastic Leukemia correctly not detected (True Negative) in 0.0022246837615966797 seconds.
2021-08-22 18:04:21,308 - Classifier - INFO - Images Classified: 20
2021-08-22 18:04:21,309 - Classifier - INFO - True Positives: 10
2021-08-22 18:04:21,309 - Classifier - INFO - False Positives: 0
2021-08-22 18:04:21,309 - Classifier - INFO - True Negatives: 10
2021-08-22 18:04:21,310 - Classifier - INFO - False Negatives: 0
2021-08-22 18:04:21,310 - Classifier - INFO - Total Time Taken: 0.07416033744812012
ConclusionHere we can see that optimizing our Tensorflow model using TFRT improves our classification by around 8 seconds which is a considerable improvement. When comparing the performance of the TFRT model with the TensorRT model we see an improvement of more than 8 seconds, demonstrating the pure power of Tensorrt and the possibilities it brings to AI on the edge.
This completes our tutorial for now. You have created a Tensorflow model for Acute Lymphoblastic Leukemia classification, converted it to TFRT and ONNX formats, and converted the ONNX model to TensorRT format, then ran each model on your desktop/laptop device and the NVIDIA Jetson Nano.
ContributingAsociación de Investigacion en Inteligencia Artificial Para la Leucemia Peter Moss encourages and welcomes code contributions, bug fixes and enhancements from the Github community.
Please read the CONTRIBUTING document for a full guide to forking our repositories and submitting your pull requests. You will also find our code of conduct in the Code of Conduct document.
Contributors- Adam Milton-Barker - Asociación de Investigacion en Inteligencia Artificial Para la Leucemia Peter Moss President/Founder & Lead Developer, Sabadell, Spain
Versioning
We use SemVer for versioning.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Bugs/Issues
We use the repo issues to track bugs and general requests related to using this project. See CONTRIBUTING for more info on how to submit bugs, feature requests and proposals.
Comments