From 2e82ef5e9d68c20afffd4bd928c292c21006d143 Mon Sep 17 00:00:00 2001 From: Danish Bansal Date: Thu, 20 Jul 2023 13:20:41 +0530 Subject: [PATCH] Resolved The notebook is throwing error in current state due to dependency issues --- notebooks/onnx_model_example.ipynb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/notebooks/onnx_model_example.ipynb b/notebooks/onnx_model_example.ipynb index b1186f0..7e2eaf0 100644 --- a/notebooks/onnx_model_example.ipynb +++ b/notebooks/onnx_model_example.ipynb @@ -83,13 +83,16 @@ " print(\"Torchvision version:\", torchvision.__version__)\n", " print(\"CUDA is available:\", torch.cuda.is_available())\n", " import sys\n", - " !{sys.executable} -m pip install opencv-python matplotlib onnx onnxruntime\n", + " !{sys.executable} -m pip install opencv-python matplotlib onnx onnxruntime timm\n", " !{sys.executable} -m pip install 'git+https://github.com/facebookresearch/segment-anything.git'\n", + " !{sys.executable} -m pip install 'git+https://github.com/ChaoningZhang/MobileSAM.git'\n", " \n", " !mkdir images\n", " !wget -P images https://raw.githubusercontent.com/facebookresearch/segment-anything/main/notebooks/images/truck.jpg\n", " \n", - " !wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth" + " !wget https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth\n", + "\n", + " !wget https://github.com/ChaoningZhang/MobileSAM/raw/master/weights/mobile_sam.pt" ] }, { @@ -184,7 +187,11 @@ "metadata": {}, "outputs": [], "source": [ - "checkpoint = \"../weights/mobile_sam.pt\"\n", + "if colab:\n", + " checkpoint = \"mobile_sam.pt\"\n", + "else:\n", + " checkpoint = \"../weights/mobile_sam.pt\"\n", + "\n", "model_type = \"vit_t\"" ] }, @@ -358,7 +365,7 @@ "metadata": {}, "outputs": [], "source": [ - "image = cv2.imread('images/picture2.jpg')\n", + "image = cv2.imread('images/truck.jpg')\n", "image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)" ] },