{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":5658042,"sourceType":"datasetVersion","datasetId":3251852},{"sourceId":7069282,"sourceType":"datasetVersion","datasetId":4070846}],"dockerImageVersionId":30407,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"##########################################################################################\n\n* **In this notebook we will see how to build and use Openvino in Kaggle competition where the internet is disabled.** \n* **Openvino is used to accelerate the inference of Deep Learning models.** \n* **OpenVINO is a toolkit facilitating the optimization of a deep learning model from a framework and deployment using an inference engine.**","metadata":{}},{"cell_type":"markdown","source":"***Use pip download *package (not pip install) to download the .whl files required\nHere, pip download openvino******* \nOnce this is downloaded, add the files as a dataset to kaggle notebook. \n\nAlternatively, one can just use the public dataset(openvino-wheels) already loaded with this notebook. ","metadata":{}},{"cell_type":"markdown","source":"Now pip install openvino using the loaded dataset as shown below","metadata":{}},{"cell_type":"code","source":"!pip install /kaggle/input/openvino-wheels/openvino-2022.3.0-9052-cp37-cp37m-manylinux_2_17_x86_64.whl --no-index --find-links /kaggle/input/openvino-wheels","metadata":{"execution":{"iopub.status.busy":"2023-12-11T06:22:38.440983Z","iopub.execute_input":"2023-12-11T06:22:38.441532Z","iopub.status.idle":"2023-12-11T06:22:51.296703Z","shell.execute_reply.started":"2023-12-11T06:22:38.441486Z","shell.execute_reply":"2023-12-11T06:22:51.294635Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Now, we will be able to use openvino without internet","metadata":{}},{"cell_type":"markdown","source":"Now import the library","metadata":{}},{"cell_type":"code","source":"import openvino.runtime as ov","metadata":{"execution":{"iopub.status.busy":"2023-12-11T06:22:51.299056Z","iopub.execute_input":"2023-12-11T06:22:51.299476Z","iopub.status.idle":"2023-12-11T06:22:51.305901Z","shell.execute_reply.started":"2023-12-11T06:22:51.299437Z","shell.execute_reply":"2023-12-11T06:22:51.304504Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Use it as you would normally","metadata":{}},{"cell_type":"code","source":"core = ov.Core()\nclassification_model_xml = \"/kaggle/input/effnetv2s21k-openvino/exported_tf_model.xml\"\nmodel = core.read_model(model=classification_model_xml)\ncompiled_model = core.compile_model(model=model, device_name=\"CPU\")\ninput_layer = compiled_model.input(0)\noutput_layer = compiled_model.output(0)","metadata":{"execution":{"iopub.status.busy":"2023-12-11T06:22:51.307725Z","iopub.execute_input":"2023-12-11T06:22:51.308169Z","iopub.status.idle":"2023-12-11T06:22:52.577015Z","shell.execute_reply.started":"2023-12-11T06:22:51.308115Z","shell.execute_reply":"2023-12-11T06:22:52.575223Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Hint: If there are any issues with pip installing the packages, try copy&edit this notebook.","metadata":{}}]}