[7f2816]: / demo_model / data / Loading Model.ipynb

Download this file

138 lines (137 with data), 2.5 kB

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7f754e9c",
   "metadata": {},
   "outputs": [],
   "source": [
    "from fastai.vision.all import * "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "9fe02021",
   "metadata": {},
   "outputs": [],
   "source": [
    "learner = load_learner(\"/home/tkrsh/demo/demo_model/model_a.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "33ade43c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x =learner.predict(\"/home/tkrsh/demo/demo_model/data/hemorrhage/Test/Hemorrhage/hemorrhage_images/58 (3).jpg\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "e708e7c7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "TensorBase(0.9318)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x[-1][0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "11a3253f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "int(x[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "c484273b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "('hemorrhage_images', TensorBase(0), TensorBase([0.9318, 0.0682]))"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5ddb2350",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "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.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}