diff --git a/Benchmarking.png b/Benchmarking.png new file mode 100644 index 000000000..18370d577 Binary files /dev/null and b/Benchmarking.png differ diff --git a/Model pb.png b/Model pb.png new file mode 100644 index 000000000..2ba6b5855 Binary files /dev/null and b/Model pb.png differ diff --git a/Output.png b/Output.png new file mode 100644 index 000000000..f3319aaf2 Binary files /dev/null and b/Output.png differ diff --git a/Pneumonia Prediction/Pneumonia Prediction.cpp b/Pneumonia Prediction/Pneumonia Prediction.cpp new file mode 100644 index 000000000..800d8e099 --- /dev/null +++ b/Pneumonia Prediction/Pneumonia Prediction.cpp @@ -0,0 +1,58 @@ +#include +#include +#include +#include +#include "dnnl.hpp" + +using namespace cl::sycl; + +std::vector loadImages(const std::vector& imagePaths) { + std::vector images; + for (const auto& imagePath : imagePaths) { + cv::Mat image = cv::imread(imagePath); + cv::resize(image, image, cv::Size(120, 120)); + images.push_back(image); + } + return images; +} + +int main() { + std::vector trainingImagePaths = { + "/train/PNEUMONIA/person1000_bacteria_2931.jpeg", + "/train/NORMAL/IM-0115-0001.jpeg" + }; + + std::vector trainingImages = loadImages(trainingImagePaths); + + std::vector trainingImageData; + for (const auto& image : trainingImages) { + for (int row = 0; row < image.rows; ++row) { + for (int col = 0; col < image.cols; ++col) { + cv::Vec3b pixel = image.at(row, col); + sycl::float3 normalizedPixel( + static_cast(pixel[0]) / 255.0f, + static_cast(pixel[1]) / 255.0f, + static_cast(pixel[2]) / 255.0f + ); + trainingImageData.push_back(normalizedPixel); + } + } + } + + std::vector labels = { 1, 0 }; + + auto deviceSelector = sycl::default_selector{}; + auto queue = sycl::queue{ deviceSelector }; + + sycl::buffer trainingDataBuffer(trainingImageData.data(), sycl::range(trainingImageData.size())); + sycl::buffer labelsBuffer(labels.data(), sycl::range(labels.size())); + sycl::buffer predictionsBuffer(sycl::range(labels.size())); + + dnnl::convolution_forward convolution; + + auto predictionsHost = predictionsBuffer.get_access(); + + for (size_t i = 0; i < labels.size(); ++i) { + std::cout << "The probability of pneumonia is: " << predictionsHost[i] << std::endl; + } +} diff --git a/Pneumonia Prediction/Pneumonia Prediction.sln b/Pneumonia Prediction/Pneumonia Prediction.sln new file mode 100644 index 000000000..1eb29e556 --- /dev/null +++ b/Pneumonia Prediction/Pneumonia Prediction.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33815.320 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Pneumonia Prediction", "Pneumonia Prediction.vcxproj", "{0974D031-4449-48EA-838B-1D513F20811B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0974D031-4449-48EA-838B-1D513F20811B}.Debug|x64.ActiveCfg = Debug|x64 + {0974D031-4449-48EA-838B-1D513F20811B}.Debug|x64.Build.0 = Debug|x64 + {0974D031-4449-48EA-838B-1D513F20811B}.Release|x64.ActiveCfg = Release|x64 + {0974D031-4449-48EA-838B-1D513F20811B}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9738CD98-C428-4F55-B17A-7D43A31AE021} + EndGlobalSection +EndGlobal diff --git a/Pneumonia Prediction/Pneumonia Prediction.vcxproj b/Pneumonia Prediction/Pneumonia Prediction.vcxproj new file mode 100644 index 000000000..8e7200956 --- /dev/null +++ b/Pneumonia Prediction/Pneumonia Prediction.vcxproj @@ -0,0 +1,86 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {0974d031-4449-48ea-838b-1d513f20811b} + Win32Proj + Pneumonia_Prediction + + + + Application + true + Intel(R) oneAPI DPC++ Compiler 2023 + Unicode + + + Application + false + Intel(R) oneAPI DPC++ Compiler 2023 + true + Unicode + + + + + + + + + + + + + + + true + + + false + + + + + + Level3 + _DEBUG;%(PreprocessorDefinitions) + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + + + Console + true + + + + + + + Level3 + NDEBUG;%(PreprocessorDefinitions) + stdcpp17 + /Zc:__cplusplus %(AdditionalOptions) + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/Pneumonia Prediction/Pneumonia Prediction.vcxproj.filters b/Pneumonia Prediction/Pneumonia Prediction.vcxproj.filters new file mode 100644 index 000000000..078dee251 --- /dev/null +++ b/Pneumonia Prediction/Pneumonia Prediction.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/Pneumonia Prediction/Pneumonia Prediction.vcxproj.user b/Pneumonia Prediction/Pneumonia Prediction.vcxproj.user new file mode 100644 index 000000000..0f14913f3 --- /dev/null +++ b/Pneumonia Prediction/Pneumonia Prediction.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/README.md b/README.md index 81463bfd7..ec2f4b769 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,43 @@ # intel-oneAPI -#### Team Name - -#### Problem Statement - -#### Team Leader Email - +#### Team Name - Mind Crusaders +#### Problem Statement - Medical Image Processing +#### Team Leader Email - kaamal322@gmail.com ## A Brief of the Prototype: - This section must include UML Daigrms and prototype description +This project demonstrates the quantization of a Medical Image processing using Intel OpenVINO. Quantization is a compression technique that reduces the memory footprint and computation requirements of a neural network model while maintaining its accuracy. The quantized model can be deployed on resource-constrained devices without compromising performance. ## Tech Stack: - List Down all technologies used to Build the prototype **Clearly mentioning Intel® AI Analytics Toolkits, it's libraries and the SYCL/DCP++ Libraries used** +- Intel OpenVINO toolkit +- Python 3.7 or above +- OpenVINO Python API +- OpenCV +- NumPy +- PIL ## Step-by-Step Code Execution Instructions: - This Section must contain set of instructions required to clone and run the prototype, so that it can be tested and deeply analysed +Step 1: Set up the Environment + +Ensure you have installed the required dependencies and libraries, including Intel oneAPI toolkits and OpenVINO. +Make sure you have the appropriate Python environment set up with the necessary packages. +Step 2: Prepare the Model + +Place your model files (model.xml and model.bin) in the "./model" directory. +Confirm that the model files exist in the specified directory. +Step 3: Run the Code + +Copy the provided code into a Python file (e.g., medical_image_processing.py). +Open a terminal or command prompt and navigate to the directory where the Python file is located. +Step 4: Execute the Code + +Run the Python script using the following command: +python model.py -## What I Learned: - Write about the biggest learning you had while developing the prototype +## What we Learnt: +we have learned the following key points: + +Model Export: The code demonstrates how to export a trained model for deployment using Intel's OpenVINO toolkit. It loads the model from the specified directory, consisting of the model files (model.xml and model.bin), and utilizes the IECore class to read the network and its weights. + +Inference Engine: The Intel IECore module is used to load the network onto the CPU device for inference. It provides a unified API to work with different deep learning frameworks and optimizes the execution of the network. + +Model Update and Export: After loading the network, the code executes the model on the CPU device to perform network inference. It then exports the updated model, saving it as "updated_model.xml" in the same directory. diff --git a/mind_crusaders(final).pptx b/mind_crusaders(final).pptx new file mode 100644 index 000000000..a4790fb28 Binary files /dev/null and b/mind_crusaders(final).pptx differ