Files
Grounded-SAM-2/sav_dataset/sav_visualization_example.ipynb

599 lines
662 KiB
Plaintext
Raw Normal View History

2024-07-29 21:54:20 +00:00
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Copyright (c) Meta Platforms, Inc. and affiliates."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Segment Anything Video (SA-V) Dataset"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook presents an example showing how to load and visualize the SA-V annotations.\n",
"To run this notebook, you will need to have the following installed:\n",
"- jupyter\n",
"- matplotlib\n",
"- opencv-python\n",
"- numpy\n",
"- pycocoevalcap\n",
"- pandas"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Import libaries"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\n",
"import pandas as pd\n",
"from utils.sav_utils import SAVDataset"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example video and annotations from SA-V"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There are 483 frames decoded from example/sav_000001.mp4 (24fps).\n",
"Videos are annotated every 4 frames. To align with the annotations, downsample the video to 121 frames.\n"
]
}
],
"source": [
"sav_dataset = SAVDataset(sav_dir=\"example/\")\n",
"frames, manual_annot, auto_annot = sav_dataset.get_frames_and_annotations(\"sav_000001\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Show the SA-V annotations in frame 0 - auto + manual"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAOUAAAGFCAYAAAACSjT4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP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CVioqxpTB+x4hPQ9qBOMnKGQGO9IvMV5TdUu2Lh0AoiAqy2JbsjCgN/977cQ1Rbzu9sM9RZoDzJBoOKVSY+QcZF761FKIrXCOgdOsHdnj8N3biImNY2tWXnsLOcevcjqu3v0DgsKA73SMz04ivNkEnJdU00X6FRjF0eUYh8fdyysbTg6mtAf9OMuFjy1rUmShCADDs/Zixd56+o3uXT6NBt5zvL8OOG93GukYvlIZ+jd770PrK+us7a6Fh+U0ZyVFYjmAYLbA1mgCAjrIm4hAzKAEoIAJFKSGoPSknzYuy9bu2+jFCc+lGkBjIuXHiRJEqyHnd1dvv3HX2dra5ubN24ihOCFFz7NeGWFolhE18+k7M72WFtfp6xrVk8/xP/7X/07VBuXArz93jXefPs9tNHLHa0b7753lbcuv4MQgrXVFX7xCz/F4WRCmmVUZcnO7i6DwYBer0fTNGitCMGT5RmTownWNuR5jtaKvbt3kYkiNRJfNZgrCq0149GYPMkwyrC3t09VloDFB/DUzFjQaMnZSyNGhUeGmhxN4QQ4T0Dc4+KfnD+ldFwkIbpOi9mMdGQiYCYlea/Hzv4+i72KRVVSVzXOuTa2BO8gkSnD/hCd5ARhQTlEJTE6QagcKRSCEmeLaHBC4oNANBn
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sav_dataset.visualize_annotation(\n",
" frames, manual_annot, auto_annot, \n",
" annotated_frame_id=0,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Show the SA-V annotations in another frame - auto + manual"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAOUAAAGFCAYAAAACSjT4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9W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iQBUGrTV1XTKZjLh18wajqqYqS4qioNAF8/mccT1iVI6o6zoHA7LTL7Qixlw+SCEzcEMghUjz5A/ZOouPPYWJdEDyT0ghEa0neU+KEWcdIQVSgsl4TNv3fOvbv8Bs/4Af/tEP+eD5B6zWGz795APeeesBL1485snTZ7z93nuobc/7nz4GoYjBI1PiV3/xW8yPFWO3YKQuwbqfy9b+zEYpYKglIgQoCkVRViBKUlII6RAiR6e4M7ZceBFTrr+QBiEVKjl24XLAUiAFlFSUyiDSDljKhpxEyB7zX/su5fAlXhlgghQzAilEvE6jSSkbLPI6Jc6vPRjrYK27FAkSQmSkVghN33eEEBBSXsfnnd+SMiOtzvaE0GIKSVFIlHrldKRgAE5eOSqBoKoqJvUUJTWg8ut4y7bdgkhICcFbXLD0tiNJQRwMOkfKwZGIHB1TGurfjBejEDnI80VHm0RCCoUpNdPJeKiHLTGBUpKyrOk6z9nZBTEGUgw5oxGSJBW6KIbaSmKtpWssjz57xrtv3sb7hLWR7bqjb3ukSPxHf+NvoHrHtB6xN92jLEuUBCUSSkZGkxGFNsQY8b0lpEjMeBeEROodzWKJ94GmbQnBM5lOqeqalECmyOXZKcF77r71kOXlC9bbLTePTxjv7eF
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sav_dataset.visualize_annotation(\n",
" frames, manual_annot, auto_annot, \n",
" annotated_frame_id=30,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Show the SA-V annotations in frame 0 - manual only"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAOUAAAGFCAYAAAACSjT4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9WZCt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FISOUUhSbwj9RbnNXW7YOPSCSACrrGk2pCHHl/4b7YR9Tazuzv09TZoDzJFoOInkx4h4yL31qOURGqFdQ6cYP/OPkfv3ESMGoxtWHnkDGcfvsDqu/t0jkrKBDqVZ3I4jvOUpBS6oZ7M0ZnGzsdU4gAfdyysNYzHI7q9btzFgqexDWmaEmTA4Tlz4QJvXv0GF0+dYqMoWJ4fJ7yXe41ULB9ZGPri994H1lfXWVtdiw/KaM7KCoS5RHD7IEsUAWFdxC1kQAZQQhCAVEqyJEFpSdHv3Jet3bdRihMXlbQAxoWLD5CmKdbD7t4e3/rS19je3uHmjZsIIXjhhY8zXFmhLOfR9Usy9qb7rK2vUzUNq6ce5P/5L/8tqo1LAd5+7xpvvP0eOtHLHW0x3n3vKm++9Q5CCNZWV/iFz36Ko9GILM+pq4rdvT16vR6dTgdjDForQvDkRc5oPMJaQ1EUaK3Yv3sXmSqyROJrQ3JFobVmOBhSpDmJStjfP6CuKsDiA3gapswxWnLm4oBB6ZGhoUBTOgHOExD3uPgn508pHRdJiK7TfDolGyQRMJOSotNh9+CA+X7NvK5o6gbnXBtbgneQyox+t49OC4KwoByiliQ6RagCKRSCCmfLaHBC4oNAmJxZnrPrLbMgMHhM8Ij
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sav_dataset.visualize_annotation(\n",
" frames, manual_annot, auto_annot,\n",
" annotated_frame_id=0,\n",
" show_auto=False,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Show the SA-V annotations in frame 0 - auto only"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAOUAAAGFCAYAAAACSjT4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPY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g8fc7SPgObQFcoTH5nOqF0jgFSSBij0dYQYoSoOH1yysWPH6IuR3wYOXj/Ve69d5/Dn5wyu+joHMz6xOr8Ku+Tq2jtyLDaYmtL2F7RqzNS9liE4Lm6umS+mGcvJokxjFRVhWghkkgqb2+tNKRESvlzfT56KUa5M87yXREqIIpiUJoUhVu3jzk6PMp/SOe83wSF8m8i8RR0h0FQIWbcQgtawCiFAJXW1M5hrKZdzr5Yo1Q/NyTL349asdlu+Nf/739KiIIkwfVbCCProafrtjn0czUn61OOjo/px5HOJ/7o+39BEkUMgTAGzOYMLQpIKK1x1mKMIcVAihFjDNY6Usq/vri8pG4ahr7nxckJi8WC2WyG9x5rDSKJpm24vLokBE/btlhrOH36FF0ZaqdJg8d9bLDWsr+3T1s1OOM4PT1j6HsgkAQSI2u2eKt59Y099rqElpEWSxcVxLQLg6YQ/+Y+GWN3qUsSYbteU++5nL9oTTub8eLsjO3pwHboGYeRGGPJLSFFqHTNcr7EVi2iApiIGjTOVijTopVB0RNDlw1OaZIolG/YNA0vUmAjCk/CS0LlABoAbTS2CRzd+yG33CucfO9X2K4uuTv/hOB+gqnAaocuB05Nx1n
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sav_dataset.visualize_annotation(\n",
" frames, manual_annot, auto_annot,\n",
" annotated_frame_id=0,\n",
" show_manual=False,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Masklet annotations and Metadata"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Manual annotations and metadata"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>video_id</th>\n",
" <th>video_duration</th>\n",
" <th>video_frame_count</th>\n",
" <th>video_height</th>\n",
" <th>video_width</th>\n",
" <th>video_resolution</th>\n",
" <th>video_environment</th>\n",
" <th>video_split</th>\n",
" <th>masklet</th>\n",
" <th>masklet_id</th>\n",
" <th>masklet_size_rel</th>\n",
" <th>masklet_size_abs</th>\n",
" <th>masklet_size_bucket</th>\n",
" <th>masklet_visibility_changes</th>\n",
" <th>masklet_first_appeared_frame</th>\n",
" <th>masklet_frame_count</th>\n",
" <th>masklet_edited_frame_count</th>\n",
" <th>masklet_type</th>\n",
" <th>masklet_stability_score</th>\n",
" <th>masklet_num</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>sav_000001</td>\n",
" <td>20.125</td>\n",
" <td>483.0</td>\n",
" <td>848.0</td>\n",
" <td>480.0</td>\n",
" <td>407040.0</td>\n",
" <td>Indoor</td>\n",
" <td>train</td>\n",
" <td>[[{'size': [848, 480], 'counts': 'i\\Y4&lt;Qj05K4L...</td>\n",
" <td>[0, 1, 2, 3, 4]</td>\n",
" <td>[0.0035249812, 0.0946159778, 0.011285757, 0.00...</td>\n",
" <td>[1434.8083333333, 38512.4876033058, 4593.75454...</td>\n",
" <td>[medium, large, medium, medium, medium]</td>\n",
" <td>[2, 0, 10, 0, 0]</td>\n",
" <td>[0.0, 0.0, 0.0, 113.0, 0.0]</td>\n",
" <td>[121, 121, 121, 121, 121]</td>\n",
" <td>[41, 11, 22, 4, 115]</td>\n",
" <td>[manual, manual, manual, manual, manual]</td>\n",
" <td>[None, None, None, None, None]</td>\n",
" <td>5</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" video_id video_duration video_frame_count video_height video_width \\\n",
"0 sav_000001 20.125 483.0 848.0 480.0 \n",
"\n",
" video_resolution video_environment video_split \\\n",
"0 407040.0 Indoor train \n",
"\n",
" masklet masklet_id \\\n",
"0 [[{'size': [848, 480], 'counts': 'i\\Y4<Qj05K4L... [0, 1, 2, 3, 4] \n",
"\n",
" masklet_size_rel \\\n",
"0 [0.0035249812, 0.0946159778, 0.011285757, 0.00... \n",
"\n",
" masklet_size_abs \\\n",
"0 [1434.8083333333, 38512.4876033058, 4593.75454... \n",
"\n",
" masklet_size_bucket masklet_visibility_changes \\\n",
"0 [medium, large, medium, medium, medium] [2, 0, 10, 0, 0] \n",
"\n",
" masklet_first_appeared_frame masklet_frame_count \\\n",
"0 [0.0, 0.0, 0.0, 113.0, 0.0] [121, 121, 121, 121, 121] \n",
"\n",
" masklet_edited_frame_count masklet_type \\\n",
"0 [41, 11, 22, 4, 115] [manual, manual, manual, manual, manual] \n",
"\n",
" masklet_stability_score masklet_num \n",
"0 [None, None, None, None, None] 5 "
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pd.DataFrame([manual_annot])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Auto annotations and metadata"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>video_id</th>\n",
" <th>video_duration</th>\n",
" <th>video_frame_count</th>\n",
" <th>video_height</th>\n",
" <th>video_width</th>\n",
" <th>video_resolution</th>\n",
" <th>video_environment</th>\n",
" <th>video_split</th>\n",
" <th>masklet</th>\n",
" <th>masklet_id</th>\n",
" <th>masklet_size_rel</th>\n",
" <th>masklet_size_abs</th>\n",
" <th>masklet_size_bucket</th>\n",
" <th>masklet_visibility_changes</th>\n",
" <th>masklet_first_appeared_frame</th>\n",
" <th>masklet_frame_count</th>\n",
" <th>masklet_edited_frame_count</th>\n",
" <th>masklet_type</th>\n",
" <th>masklet_stability_score</th>\n",
" <th>masklet_num</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>sav_000001</td>\n",
" <td>20.125</td>\n",
" <td>483.0</td>\n",
" <td>848.0</td>\n",
" <td>480.0</td>\n",
" <td>407040.0</td>\n",
" <td>Indoor</td>\n",
" <td>train</td>\n",
" <td>[[{'size': [848, 480], 'counts': 'ka0e8ka001O1...</td>\n",
" <td>[0, 1, 2, 3, 4, 5, 6, 7, 8]</td>\n",
" <td>[0.010841089678796047, 0.038489445267425544, 0...</td>\n",
" <td>[4412.757142857143, 15666.743801652892, 7663.1...</td>\n",
" <td>[medium, large, medium, large, medium, medium,...</td>\n",
" <td>[5, 0, 0, 0, 0, 0, 10, 3, 12]</td>\n",
" <td>[0, 0, 0, 0, 0, 0, 0, 0, 0]</td>\n",
" <td>[121, 121, 121, 121, 121, 121, 121, 121, 121]</td>\n",
" <td>[0, 0, 0, 0, 0, 0, 0, 0, 0]</td>\n",
" <td>[auto, auto, auto, auto, auto, auto, auto, aut...</td>\n",
" <td>[[1.0, 0.999616265296936, 1.0, 1.0, 1.0, 1.0, ...</td>\n",
" <td>9</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" video_id video_duration video_frame_count video_height video_width \\\n",
"0 sav_000001 20.125 483.0 848.0 480.0 \n",
"\n",
" video_resolution video_environment video_split \\\n",
"0 407040.0 Indoor train \n",
"\n",
" masklet \\\n",
"0 [[{'size': [848, 480], 'counts': 'ka0e8ka001O1... \n",
"\n",
" masklet_id \\\n",
"0 [0, 1, 2, 3, 4, 5, 6, 7, 8] \n",
"\n",
" masklet_size_rel \\\n",
"0 [0.010841089678796047, 0.038489445267425544, 0... \n",
"\n",
" masklet_size_abs \\\n",
"0 [4412.757142857143, 15666.743801652892, 7663.1... \n",
"\n",
" masklet_size_bucket \\\n",
"0 [medium, large, medium, large, medium, medium,... \n",
"\n",
" masklet_visibility_changes masklet_first_appeared_frame \\\n",
"0 [5, 0, 0, 0, 0, 0, 10, 3, 12] [0, 0, 0, 0, 0, 0, 0, 0, 0] \n",
"\n",
" masklet_frame_count masklet_edited_frame_count \\\n",
"0 [121, 121, 121, 121, 121, 121, 121, 121, 121] [0, 0, 0, 0, 0, 0, 0, 0, 0] \n",
"\n",
" masklet_type \\\n",
"0 [auto, auto, auto, auto, auto, auto, auto, aut... \n",
"\n",
" masklet_stability_score masklet_num \n",
"0 [[1.0, 0.999616265296936, 1.0, 1.0, 1.0, 1.0, ... 9 "
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pd.DataFrame([auto_annot])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Video info"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sav_000001 is 20.125 seconds long with 483.0 frames. The video resolution is 848.0 x 480.0.\n",
"This video is captured in Indoor environment.\n"
]
}
],
"source": [
"video_id = manual_annot[\"video_id\"]\n",
"video_duration = manual_annot[\"video_duration\"]\n",
"video_frame_count = manual_annot[\"video_frame_count\"]\n",
"H = manual_annot[\"video_height\"]\n",
"W = manual_annot[\"video_width\"]\n",
"environment = manual_annot[\"video_environment\"]\n",
"print(\n",
" f\"{video_id} is {video_duration} seconds long with {video_frame_count} frames. The video resolution is {H} x {W}.\"\n",
")\n",
"print(f\"This video is captured in {environment} environment.\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Masklet info"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"There are 5 manually labeled masklets and 9 automatically generated masklets.\n",
"In SA-V, videos are annotated every 4 frames. Therefore, there are 121 frames being annotated.\n"
]
}
],
"source": [
"print(\n",
" f\"There are {manual_annot['masklet_num']} manually labeled masklets and {auto_annot['masklet_num']} automatically generated masklets.\"\n",
")\n",
"print(\n",
" f\"In SA-V, videos are annotated every 4 frames. Therefore, there are {manual_annot['masklet_frame_count'][0]} frames being annotated.\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'size': [848, 480],\n",
" 'counts': 'i\\\\Y4<Qj05K4L4M3M2N3O000010O00001O00010O00000O101O0000000000000O010000000O10O10000O01000O100O010O1O1O1N2O1O0O2O1N20O01O1001N101O1N100O100O10O01O2O00000O1O10O1O11N1O1O100O1O2N1O1O3L4HTXk5'}"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Get the rle of the manual masklet with masklet_id=0 in frame 0\n",
"masklet_id = 0\n",
"annotated_frame_id = 0\n",
"manual_annot[\"masklet\"][annotated_frame_id][masklet_id]\n",
"# decode the rle using `mask_util.decode(rle)>0` to get the binary segmentation mask"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'size': [848, 480],\n",
" 'counts': 'Q_T6S1Xh0X1eNY1[Od0E;M4N10000O101O00000000000000O0100000000001M2O1O1N3N1M4H8B?@e0POc1jMfZ[5'}"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Get the rle of the masklet with masklet_id=5 in frame 100\n",
"masklet_id = 5\n",
"annotated_frame_id = 100\n",
"auto_annot[\"masklet\"][annotated_frame_id][masklet_id]\n",
"# decode the rle using `mask_util.decode(rle)>0` to get the binary segmentation mask"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "onevision_ta_2_pseudo_labeling",
"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.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}