{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!git clone https://github.com/sithu31296/sota-backbones\n", "%cd sota-backbones\n", "%pip install -r requirements.txt" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import torch" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Show Available Models" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!python list_models.py" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load a Model" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from models import *\n", "\n", "model_name = \"VAN\"\n", "model = eval(model_name)('S', pretrained=None)\n", "image = torch.randn(1, 3, 224, 224)\n", "output = model(image)\n", "output.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load a Model with Pretrained Weights\n", "\n", "Download a model's weights from [Model Zoo](https://github.com/sithu31296/sota-backbones#benchmarks) and place it in a folder.\n", "\n", "```python\n", "model = eval(\"VAN\")('S', pretrained='checkpoints/van_small_811.pth.tar')\n", "```" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "interpreter": { "hash": "aea83569919be5773004d169c584d4ca51033e3a1bacc6aba24d8e7d3bf3b930" }, "kernelspec": { "display_name": "Python 3.10.0 64-bit", "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.10.0" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }