{ "cells": [ { "cell_type": "code", "execution_count": 4, "id": "3d72f70e", "metadata": {}, "outputs": [], "source": [ "import cv2\n", "import os\n", "import numpy as np\n", "import pickle\n", "import tensorflow as tf\n", "from tensorflow.keras import layers\n", "\n", "from tensorflow.keras import models,utils\n", "\n", "import pandas as pd\n", "\n", "from tensorflow.keras.models import load_model\n", "\n", "from tensorflow.keras.preprocessing.image import load_img,img_to_array\n", "\n", "from tensorflow.python.keras import utils\n", "current_path = os.getcwd()\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "d0655482", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting opencv-python\n", " Downloading opencv_python-4.7.0.72-cp37-abi3-macosx_11_0_arm64.whl (32.6 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m32.6/32.6 MB\u001b[0m \u001b[31m1.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n", "\u001b[?25hRequirement already satisfied: numpy>=1.21.2 in /Users/ujjwalbansal/anaconda3/lib/python3.10/site-packages (from opencv-python) (1.24.3)\n", "Installing collected packages: opencv-python\n", "Successfully installed opencv-python-4.7.0.72\n", "Note: you may need to restart the kernel to use updated packages.\n" ] } ], "source": [ "pip install opencv-python" ] }, { "cell_type": "code", "execution_count": 10, "id": "867fc892", "metadata": {}, "outputs": [], "source": [ "import tensorflow_hub as hub" ] }, { "cell_type": "code", "execution_count": 13, "id": "0fb1cb14", "metadata": {}, "outputs": [], "source": [ "model_path=\"skimlit_final_model\"" ] }, { "cell_type": "code", "execution_count": 14, "id": "20ad6fa1", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2023-06-14 12:49:03.226973: W tensorflow/tsl/platform/profile_utils/cpu_utils.cc:128] Failed to get CPU frequency: 0 Hz\n" ] } ], "source": [ "my_reloaded_model = tf.keras.models.load_model(\n", " (model_path),\n", " custom_objects={'KerasLayer':hub.KerasLayer})" ] }, { "cell_type": "code", "execution_count": null, "id": "ece84ef9", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.10 (tensorflow)", "language": "python", "name": "tensorflow" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.9" } }, "nbformat": 4, "nbformat_minor": 5 }