diff --git a/docs/notebooks/bounding-boxes.ipynb b/docs/notebooks/bounding-boxes.ipynb index e509b897..6649ca39 100644 --- a/docs/notebooks/bounding-boxes.ipynb +++ b/docs/notebooks/bounding-boxes.ipynb @@ -6,11 +6,18 @@ "source": [ "# How to Display Bounding Boxes on Objects in a Video.\n", "\n", + "---\n", + "\n", + "
\n", + "\n", + "\n", "One of the most common requirements of computer vision applications is detecting objects in images and displaying bounding boxes around those objects. In this cookbook we'll walk through the steps on how to utilize the open source Roboflow ecosystem to accomplish this task on a video. Let's dive in! \n", "\n", "## Installing Dependencies \n", "\n", - "In this cookbook we'll be utilizing the open source packages [Inference](https://inference.roboflow.com/) and [Supervision](https://supervision.roboflow.com/latest/) to accomplish our goals. Let's get those installed in a virtual environment with pip." + "In this cookbook we'll be utilizing the open source packages [Inference](https://inference.roboflow.com/) and [Supervision](https://supervision.roboflow.com/latest/) to accomplish our goals. Let's get those installed in our notebook with pip." ] }, { @@ -23,9 +30,7 @@ }, "outputs": [], "source": [ - "#!/bin/bash\n", - "!python -m venv venv\n", - "!source venv/bin/activate\n", + "\n", "!pip install -q inference \"supervision[assets]\"" ] }, @@ -112,7 +117,7 @@ "\n", "## Saving Bounding Boxes to the Video\n", "\n", - "Now comes the fun part. Let's wrap up our code by utilizing `Annotators` and a `VideoSink` to draw bounding boxes and save the resulting video respectively. Take a peak at the final code example below. " + "Now comes the fun part. Let's wrap up our code by utilizing `Annotators` and a `VideoSink` to draw bounding boxes and save the resulting video respectively. Take a peak at the final code example below. This might can take up to a minute to run, since we're processing a full video. " ] }, { @@ -168,20 +173,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - " Notice that we create a `box_annoator` variable by initalizing a [BoundingBoxAnnotator](https://supervision.roboflow.com/latest/annotators/#boundingboxannotator). We can change the color and thickness, but for simplicity we keep the defaults. There are a ton of easy to use [annotators](https://supervision.roboflow.com/latest/annotators/) available in the Supervision package other than a bounding box that are fun to play with. Next, we create a `video_info` variable to pass information about the video to our `VideoSink`. The `VideoSink` is a cool little context manager that allows us to `write_frames()` to a video ouput file. Prior to writing the frame, we annotate a copy of it utilizing `box_annotator.annotate()`. Let's take a look at the resulting video. " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "vscode": { - "languageId": "powershell" - } - }, - "outputs": [], - "source": [ - "!open output.mp4" + " Notice that we create a `box_annoator` variable by initalizing a [BoundingBoxAnnotator](https://supervision.roboflow.com/latest/annotators/#boundingboxannotator). We can change the color and thickness, but for simplicity we keep the defaults. There are a ton of easy to use [annotators](https://supervision.roboflow.com/latest/annotators/) available in the Supervision package other than a bounding box that are fun to play with. Next, we create a `video_info` variable to pass information about the video to our `VideoSink`. The `VideoSink` is a cool little context manager that allows us to `write_frames()` to a video ouput file. Prior to writing the frame, we annotate a copy of it utilizing `box_annotator.annotate()`. Let's take a look at the resulting video. It will be installed locally and is called `output.mp4`. When run, you will see bounding boxes around the detections. Pretty awesome! " ] }, { diff --git a/docs/notebooks/supervision-assets.ipynb b/docs/notebooks/supervision-assets.ipynb index e9f8256e..5efbfd07 100644 --- a/docs/notebooks/supervision-assets.ipynb +++ b/docs/notebooks/supervision-assets.ipynb @@ -6,32 +6,31 @@ "source": [ "# Experimenting with Supervision Assets\n", "\n", + "---\n", + "\n", + "\n", + "\n", "When experimenting with interesting and useful features of the Supervision package, its important to have some sort of image or video data to experiment with. Luckily for us, Supervision ships with [Assets](https://supervision.roboflow.com/latest/assets/)! Assets is a collection of videos that you can utilize to start experimenting with the various features Supervision has to offer. Let's take a look at how to use this resource.\n", "\n", "## Install with Pip\n", "\n", - "To start utilizing Supervision assets let's install them with pip. To install the assets with pip, let's first create a virtual enviornment. It's generally a best practice to create a virtual environment so that your projects deppendencies are isolated. Let's create one below and source it. A quick reminder that if you're running these commands in a terminal, first remove the \"!\". " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "vscode": { - "languageId": "shellscript" - } - }, - "outputs": [], - "source": [ - "!python -m venv venv\n", - "!source venv/bin/activate" + "If you're running this code outside a Jupyter notebook, it's generally a best practice to create a virtual environment so that your projects deppendencies are isolated. Run the following ing your command line of choice to create and source one.\n", + "\n", + "```shell\n", + "\n", + "python -m venv venv\n", + "source venv/bin/activate\n", + "\n", + "``` " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Now that we've got a virtual enviornment installed and sourced, let's install the pip package with the assets \"extra\" package." + "Now that we've got a virtual enviornment installed and sourced, let's install the pip package with the assets \"extra\" package. Make sure to remove the \"!\" if running this in your command line." ] }, { diff --git a/docs/notebooks/tracking.ipynb b/docs/notebooks/tracking.ipynb index 5433480c..35f42167 100644 --- a/docs/notebooks/tracking.ipynb +++ b/docs/notebooks/tracking.ipynb @@ -6,7 +6,13 @@ "source": [ "# Tracking Objects in a Video\n", "\n", - "In some cases, it's important for us to track objects across multiple frames of a video. For example, we may need to figure out the direction a vehicle is moving, or count objects in a frame. Some Supvervision [Annotators](https://supervision.roboflow.com/latest/annotators/) and Tools like [LineZone](https://supervision.roboflow.com/latest/detection/tools/line_zone/) require tracking to be setup. In this cookbook, we'll cover how to get a tracker up and running for use in your computer vision applications.\n", + "---\n", + "\n", + "\n", + "\n", + "In some cases, it's important for us to track objects across multiple frames of a video. For example, we may need to figure out the direction a vehicle is moving, or count objects in a frame. Some Supvervision [Annotators](https://supervision.roboflow.com/latest/annotators/) and Tools like [LineZone](https://supervision.roboflow.com/latest/detection/tools/line_zone/) require tracking to be setup. In this cookbook, we'll cover how to get a tracker up and running for use in your computer vision applications.\n", "\n", "## What is a Tracker?\n", "\n", @@ -25,8 +31,6 @@ }, "outputs": [], "source": [ - "!python -m venv venv\n", - "!source venv/bin/activate\n", "!pip install -q inference \"supervision[assets]\"" ] }, @@ -122,20 +126,7 @@ "source": [ "# View the Video\n", "\n", - "Let's take a look at our resulting video. Notice how even with flicker, we can see the `tracker_id` on the people walking in the video. With trackers under your belt, there are now a wide variety of use cases you can solve for! Happy building! " - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "vscode": { - "languageId": "shellscript" - } - }, - "outputs": [], - "source": [ - "!open output.mp4" + "Let's take a look at our resulting video. It will be created in your current directory with the name `output.mp4` Notice how even with a little flicker, we can see the `tracker_id` on the people walking in the video. With trackers under your belt, there are now a wide variety of use cases you can solve for! Happy building! " ] } ],