{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial loading Deepforest" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!pip install ../../ -U" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from deepforest import get_data\n", "from deepforest import main\n", "\n", "model = main.deepforest()\n", "model.load_model(model_name=\"weecology/deepforest-tree\", revision=\"main\")\n", "image_path = get_data('OSBS_029.tif')\n", "results = model.predict_image(path=image_path)\n", "# plot_results(results)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# To save a model you can use\n", "# model.save_pretrained(\"Path/to/model/folder\")\n", "# This will give config.json for the configuration and model.safetensors for the weights" ] } ], "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.10.14" } }, "nbformat": 4, "nbformat_minor": 4 }