From d309d74f37d40ce198ce19a394ca03ebcc72aa30 Mon Sep 17 00:00:00 2001 From: Onuralp SEZER Date: Tue, 5 Mar 2024 05:23:15 +0300 Subject: [PATCH] =?UTF-8?q?docs(notebooks):=20=F0=9F=93=9D=20json=20and=20?= =?UTF-8?q?csv=20sink=20cookbooks=20are=20added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Onuralp SEZER --- .../serialise-detections-to-csv.ipynb | 706 +++++++++++++++++ .../serialise-detections-to-json.ipynb | 708 ++++++++++++++++++ docs/theme/cookbooks.html | 3 + 3 files changed, 1417 insertions(+) create mode 100644 docs/notebooks/serialise-detections-to-csv.ipynb create mode 100644 docs/notebooks/serialise-detections-to-json.ipynb diff --git a/docs/notebooks/serialise-detections-to-csv.ipynb b/docs/notebooks/serialise-detections-to-csv.ipynb new file mode 100644 index 00000000..adea8428 --- /dev/null +++ b/docs/notebooks/serialise-detections-to-csv.ipynb @@ -0,0 +1,706 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "RFjrV07Spmm2" + }, + "source": [ + "# Serialise Detections to a CSV File\n", + "\n", + "---\n", + "\n", + "[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/roboflow/supervision/blob/develop/docs/notebooks/detections-to-jsonsink.ipynb)\n", + "\n", + "This cookbook introduce [sv.CSVSink](https://supervision.roboflow.com/develop/detection/tools/save_detections/#supervision.detection.tools.csv_sink.CSVSink) tool designed to write captured object detection data to file from video streams/file" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "aFQHoaDLp8R3" + }, + "source": [ + "Click the `Open in Colab` button to run the cookbook on Google Colab." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "hzMGlRKlel4p" + }, + "outputs": [], + "source": [ + "!pip install -q inference requests tqdm supervision==0.19.0rc5" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "id": "6vRfXc_Je5Ee" + }, + "outputs": [], + "source": [ + "import supervision as sv\n", + "from supervision.assets import download_assets, VideoAssets\n", + "from inference import InferencePipeline\n", + "from inference.core.interfaces.camera.entities import VideoFrame\n", + "import numpy as np\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "urRjZjh2f30v" + }, + "outputs": [], + "source": [ + "SOURCE_VIDEO_PATH = download_assets(VideoAssets.PEOPLE_WALKING)\n", + "CONFIDENCE_THRESHOLD = 0.3\n", + "IOU_THRESHOLD = 0.7" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "2YyE30JOS4Sf" + }, + "source": [ + "## Initialize ByteTrack" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "id": "Jpw_TzAsm2oL" + }, + "outputs": [], + "source": [ + "byte_track = sv.ByteTrack()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "IjYwj2vbTLBd" + }, + "source": [ + "## Initialize CSVSink and open sink" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "id": "-yvv6N1uTKSl" + }, + "outputs": [], + "source": [ + "csv_sink = sv.CSVSink('detections.csv')\n", + "csv_sink.open()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "d7IAyIYzmv_v" + }, + "source": [ + "## Process video to class to track detections and save detections to CSV file" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "-YvmJW5yud1G" + }, + "source": [ + "All the operations we plan to perform for each frame of our video - detection, tracking, annotation, and write to csv - are encapsulated in a function named `callback`." + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": { + "id": "eRQiVkblapCk" + }, + "outputs": [], + "source": [ + "def callback(predictions: dict, frame: VideoFrame) -> np.ndarray:\n", + " detections = sv.Detections.from_inference(predictions)\n", + " detections = byte_track.update_with_detections(detections)\n", + " csv_sink.append(detections, custom_data={'frame_number': frame.frame_id})\n", + " print(f\"Processed Frame ID: {frame.frame_id}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "3GRH_QdHgGiC" + }, + "outputs": [], + "source": [ + "#Aliases:\u00a0https://inference.roboflow.com/reference_pages/model_aliases/\n", + "\n", + "REGISTERED_ALIASES = {\n", + " \"yolov8n-640\": \"coco/3\",\n", + " \"yolov8n-1280\": \"coco/9\",\n", + " \"yolov8m-640\": \"coco/8\",\n", + " \"yolov8x-1280\": \"coco/10\",\n", + "}\n", + "\n", + "def resolve_roboflow_model_alias(model_id: str) -> str:\n", + " return REGISTERED_ALIASES.get(model_id, model_id)\n", + "\n", + "alias = \"yolov8n-640\"\n", + "model_name = resolve_roboflow_model_alias(alias)\n", + "\n", + "pipeline = InferencePipeline.init(\n", + " model_id=model_name,\n", + " video_reference=SOURCE_VIDEO_PATH,\n", + " on_prediction=callback,\n", + " iou_threshold=IOU_THRESHOLD,\n", + " confidence_threshold=CONFIDENCE_THRESHOLD,\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "bYpA9VxBsOvS" + }, + "outputs": [], + "source": [ + "pipeline.start()\n", + "pipeline.join()" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "id": "RrewOF02AYta" + }, + "outputs": [], + "source": [ + "# Close CSVSink\n", + "csv_sink.close()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "u7Akx7aUsh75" + }, + "source": [ + "## Visualizate results of detections CSV data with Pandas\n", + "\n", + "Let's take a look at our resulting data with by using Pandas.\n", + "\n", + "It will also be created in your current directory with the name detections.csv as well." + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 424 + }, + "id": "Bu7AZ3QHiAqb", + "outputId": "22678389-7be4-4d5e-beb5-2543bdde0b52" + }, + "outputs": [ + { + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "summary": "{\n \"name\": \"df\",\n \"rows\": 7922,\n \"fields\": [\n {\n \"column\": \"x_min\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 526.8407670284447,\n \"min\": -12.644972,\n \"max\": 1898.8293,\n \"num_unique_values\": 7920,\n \"samples\": [\n 1172.3636,\n 737.3481,\n 1380.5814\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"y_min\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 284.9445302145063,\n \"min\": -0.33771914,\n \"max\": 1028.6375,\n \"num_unique_values\": 7911,\n \"samples\": [\n 30.866436,\n 162.8454,\n 103.83498\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"x_max\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 527.2472667729564,\n \"min\": 23.571644,\n \"max\": 1933.4734,\n \"num_unique_values\": 7916,\n \"samples\": [\n 265.69644,\n 212.48213,\n 1423.4131\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"y_max\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 302.5701148946947,\n \"min\": 79.2273,\n \"max\": 1083.3434,\n \"num_unique_values\": 7879,\n \"samples\": [\n 1060.831,\n 390.86444,\n 805.1297\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"class_id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 2,\n \"min\": 0,\n \"max\": 28,\n \"num_unique_values\": 4,\n \"samples\": [\n 14,\n 26,\n 0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"confidence\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.12142000720578869,\n \"min\": 0.40000778,\n \"max\": 0.9084047,\n \"num_unique_values\": 7912,\n \"samples\": [\n 0.65444267,\n 0.65596485,\n 0.6623484\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"tracker_id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 33,\n \"min\": 180,\n \"max\": 323,\n \"num_unique_values\": 86,\n \"samples\": [\n 309,\n 180,\n 300\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"frame_number\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 96,\n \"min\": 1,\n \"max\": 341,\n \"num_unique_values\": 341,\n \"samples\": [\n 323,\n 117,\n 114\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}", + "type": "dataframe", + "variable_name": "df" + }, + "text/html": [ + "\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
x_miny_minx_maxy_maxclass_idconfidencetracker_idframe_number
01460.000000469.0000001544.00000641.0000000.8201431801
11447.000000320.0000001516.00000480.0000000.7915991811
2259.000000435.000000326.00000610.0000000.7750271821
31142.000000950.0000001245.000001080.0000000.7680631831
4665.000000649.000000744.00000851.0000000.7629941841
...........................
79171854.766600259.9255701914.51900442.5870400.715024322341
7918391.996430470.574280460.88147632.9277000.506561318341
791974.250565700.197940173.04185893.1593600.477815306341
79201012.475770170.8317701058.31270297.3979800.565866283341
79211012.56080060.4157181052.00890175.3359200.406130320341
\n", + "

7922 rows \u00d7 8 columns

\n", + "
\n", + "
\n", + "\n", + "
\n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
\n", + "\n", + "\n", + "
\n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
\n", + "\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + "
\n" + ], + "text/plain": [ + " x_min y_min x_max y_max class_id confidence \\\n", + "0 1460.000000 469.000000 1544.00000 641.00000 0 0.820143 \n", + "1 1447.000000 320.000000 1516.00000 480.00000 0 0.791599 \n", + "2 259.000000 435.000000 326.00000 610.00000 0 0.775027 \n", + "3 1142.000000 950.000000 1245.00000 1080.00000 0 0.768063 \n", + "4 665.000000 649.000000 744.00000 851.00000 0 0.762994 \n", + "... ... ... ... ... ... ... \n", + "7917 1854.766600 259.925570 1914.51900 442.58704 0 0.715024 \n", + "7918 391.996430 470.574280 460.88147 632.92770 0 0.506561 \n", + "7919 74.250565 700.197940 173.04185 893.15936 0 0.477815 \n", + "7920 1012.475770 170.831770 1058.31270 297.39798 0 0.565866 \n", + "7921 1012.560800 60.415718 1052.00890 175.33592 0 0.406130 \n", + "\n", + " tracker_id frame_number \n", + "0 180 1 \n", + "1 181 1 \n", + "2 182 1 \n", + "3 183 1 \n", + "4 184 1 \n", + "... ... ... \n", + "7917 322 341 \n", + "7918 318 341 \n", + "7919 306 341 \n", + "7920 283 341 \n", + "7921 320 341 \n", + "\n", + "[7922 rows x 8 columns]" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = pd.read_csv('detections.csv')\n", + "df" + ] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/docs/notebooks/serialise-detections-to-json.ipynb b/docs/notebooks/serialise-detections-to-json.ipynb new file mode 100644 index 00000000..59e3c4d7 --- /dev/null +++ b/docs/notebooks/serialise-detections-to-json.ipynb @@ -0,0 +1,708 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "RFjrV07Spmm2" + }, + "source": [ + "# Serialise Detections to a JSON File\n", + "\n", + "---\n", + "\n", + "[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/roboflow/supervision/blob/develop/docs/notebooks/detections-to-jsonsink.ipynb)\n", + "\n", + "This cookbook introduce [sv.JSONSink](https://supervision.roboflow.com/develop/detection/tools/save_detections/#supervision.detection.tools.json_sink.JSONSink) tool designed to write captured object detection data to file from video streams/file" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "aFQHoaDLp8R3" + }, + "source": [ + "Click the `Open in Colab` button to run the cookbook on Google Colab." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "hzMGlRKlel4p" + }, + "outputs": [], + "source": [ + "!pip install -q inference requests tqdm supervision==0.19.0rc6" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "6vRfXc_Je5Ee" + }, + "outputs": [], + "source": [ + "import supervision as sv\n", + "from supervision.assets import download_assets, VideoAssets\n", + "from inference import InferencePipeline\n", + "from inference.core.interfaces.camera.entities import VideoFrame\n", + "import numpy as np\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "urRjZjh2f30v" + }, + "outputs": [], + "source": [ + "SOURCE_VIDEO_PATH = download_assets(VideoAssets.PEOPLE_WALKING)\n", + "CONFIDENCE_THRESHOLD = 0.3\n", + "IOU_THRESHOLD = 0.7" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "2YyE30JOS4Sf" + }, + "source": [ + "## Initialize ByteTrack" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "id": "Jpw_TzAsm2oL" + }, + "outputs": [], + "source": [ + "byte_track = sv.ByteTrack()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "IjYwj2vbTLBd" + }, + "source": [ + "## Initialize JsonSink" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "id": "-yvv6N1uTKSl" + }, + "outputs": [], + "source": [ + "json_sink = sv.JSONSink('detections.json')\n", + "json_sink.open()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "d7IAyIYzmv_v" + }, + "source": [ + "## Process video to class to track detections and save detections to json file" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "-YvmJW5yud1G" + }, + "source": [ + "All the operations we plan to perform for each frame of our video - detection, tracking, annotation, and write to json - are encapsulated in a function named `callback`." + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "id": "eRQiVkblapCk" + }, + "outputs": [], + "source": [ + "def callback(predictions: dict, frame: VideoFrame) -> np.ndarray:\n", + " detections = sv.Detections.from_inference(predictions)\n", + " detections = byte_track.update_with_detections(detections)\n", + " json_sink.append(detections, custom_data={'frame_number': frame.frame_id})\n", + " print(f\"Processed Frame ID: {frame.frame_id}\")" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "id": "3GRH_QdHgGiC" + }, + "outputs": [], + "source": [ + "#Aliases:\u00a0https://inference.roboflow.com/reference_pages/model_aliases/\n", + "\n", + "REGISTERED_ALIASES = {\n", + " \"yolov8n-640\": \"coco/3\",\n", + " \"yolov8n-1280\": \"coco/9\",\n", + " \"yolov8m-640\": \"coco/8\",\n", + " \"yolov8x-1280\": \"coco/10\",\n", + "}\n", + "\n", + "def resolve_roboflow_model_alias(model_id: str) -> str:\n", + " return REGISTERED_ALIASES.get(model_id, model_id)\n", + "\n", + "alias = \"yolov8n-640\"\n", + "model_name = resolve_roboflow_model_alias(alias)\n", + "\n", + "pipeline = InferencePipeline.init(\n", + " model_id=model_name,\n", + " video_reference=SOURCE_VIDEO_PATH,\n", + " on_prediction=callback,\n", + " iou_threshold=IOU_THRESHOLD,\n", + " confidence_threshold=CONFIDENCE_THRESHOLD,\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "bYpA9VxBsOvS" + }, + "outputs": [], + "source": [ + "pipeline.start()\n", + "pipeline.join()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "KXbZt-FNVnrS" + }, + "outputs": [], + "source": [ + "# Close JSONSink\n", + "json_sink.write_and_close()" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "u7Akx7aUsh75" + }, + "source": [ + "## Visualizate results of detections json data with Pandas\n", + "\n", + "Let's take a look at our resulting data with by using Pandas.\n", + "\n", + "It will also be created in your current directory with the name detections.json as well." + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 424 + }, + "id": "Bu7AZ3QHiAqb", + "outputId": "f6dab963-6ac2-4055-b79b-893c100301e7" + }, + "outputs": [ + { + "data": { + "application/vnd.google.colaboratory.intrinsic+json": { + "summary": "{\n \"name\": \"df\",\n \"rows\": 15829,\n \"fields\": [\n {\n \"column\": \"x_min\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 526.8739960472874,\n \"min\": -12.64497184753418,\n \"max\": 1898.829345703125,\n \"num_unique_values\": 11137,\n \"samples\": [\n 1591.7908935546875,\n 1337.453125,\n 701.3184814453125\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"y_min\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 284.9995089434701,\n \"min\": -0.33771914243698103,\n \"max\": 1028.637451171875,\n \"num_unique_values\": 9618,\n \"samples\": [\n 47.191009521484375,\n 23.033039093017578,\n 44.03553009033203\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"x_max\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 527.3199046060209,\n \"min\": 23.571643829345703,\n \"max\": 1933.473388671875,\n \"num_unique_values\": 11122,\n \"samples\": [\n 746.7100219726562,\n 1432.0216064453125,\n 1901.59716796875\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"y_max\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 302.62132272340716,\n \"min\": 79.22730255126953,\n \"max\": 1083.3433837890625,\n \"num_unique_values\": 9538,\n \"samples\": [\n 301.63653564453125,\n 1079.0537109375,\n 152.47158813476562\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"class_id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 2,\n \"min\": 0,\n \"max\": 28,\n \"num_unique_values\": 4,\n \"samples\": [\n 14,\n 26,\n 0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"confidence\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.1214256650003242,\n \"min\": 0.40000790357589705,\n \"max\": 0.90840470790863,\n \"num_unique_values\": 7916,\n \"samples\": [\n 0.59814703464508,\n 0.737265467643737,\n 0.576151430606842\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"tracker_id\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 75,\n \"min\": 1,\n \"max\": 279,\n \"num_unique_values\": 164,\n \"samples\": [\n 226,\n 185,\n 211\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"frame_number\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 96,\n \"min\": 1,\n \"max\": 341,\n \"num_unique_values\": 341,\n \"samples\": [\n 323,\n 117,\n 114\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}", + "type": "dataframe", + "variable_name": "df" + }, + "text/html": [ + "\n", + "
\n", + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
x_miny_minx_maxy_maxclass_idconfidencetracker_idframe_number
01460.000000469.0000001544.000000641.00000000.82014311
11447.000000320.0000001516.000000480.00000000.79159921
2259.000000435.000000326.000000610.00000000.77502731
31142.000000950.0000001245.0000001080.00000000.76806441
4665.000000649.000000744.000000851.00000000.76299451
...........................
158241854.766602259.9255681914.519043442.58703600.715025278341
15825391.996429470.574280460.881470632.92767300.506562274341
1582674.250565700.197937173.041855893.15936300.477815262341
158271012.475769170.8317721058.312744297.39798000.565866239341
158281012.56079160.4157181052.008911175.33592200.406129276341
\n", + "

15829 rows \u00d7 8 columns

\n", + "
\n", + "
\n", + "\n", + "
\n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
\n", + "\n", + "\n", + "
\n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
\n", + "\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + "
\n" + ], + "text/plain": [ + " x_min y_min x_max y_max class_id \\\n", + "0 1460.000000 469.000000 1544.000000 641.000000 0 \n", + "1 1447.000000 320.000000 1516.000000 480.000000 0 \n", + "2 259.000000 435.000000 326.000000 610.000000 0 \n", + "3 1142.000000 950.000000 1245.000000 1080.000000 0 \n", + "4 665.000000 649.000000 744.000000 851.000000 0 \n", + "... ... ... ... ... ... \n", + "15824 1854.766602 259.925568 1914.519043 442.587036 0 \n", + "15825 391.996429 470.574280 460.881470 632.927673 0 \n", + "15826 74.250565 700.197937 173.041855 893.159363 0 \n", + "15827 1012.475769 170.831772 1058.312744 297.397980 0 \n", + "15828 1012.560791 60.415718 1052.008911 175.335922 0 \n", + "\n", + " confidence tracker_id frame_number \n", + "0 0.820143 1 1 \n", + "1 0.791599 2 1 \n", + "2 0.775027 3 1 \n", + "3 0.768064 4 1 \n", + "4 0.762994 5 1 \n", + "... ... ... ... \n", + "15824 0.715025 278 341 \n", + "15825 0.506562 274 341 \n", + "15826 0.477815 262 341 \n", + "15827 0.565866 239 341 \n", + "15828 0.406129 276 341 \n", + "\n", + "[15829 rows x 8 columns]" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = pd.read_json('detections.json')\n", + "df" + ] + } + ], + "metadata": { + "accelerator": "GPU", + "colab": { + "gpuType": "T4", + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/docs/theme/cookbooks.html b/docs/theme/cookbooks.html index fe01a568..8a182064 100644 --- a/docs/theme/cookbooks.html +++ b/docs/theme/cookbooks.html @@ -18,6 +18,9 @@

+

+

+