dataset_88kps+some-updates

This commit is contained in:
2022-08-14 09:59:01 +03:00
parent ac04526fe1
commit 998aec2b80
943 changed files with 945 additions and 938 deletions

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"id": "283f6e9c",
"metadata": {},
"outputs": [],
@@ -14,7 +14,7 @@
"import json\n",
"from tqdm.notebook import tqdm\n",
"\n",
"path_dataset = r'D:\\downloads\\Nurburg-karussel'\n",
"path_dataset = r'D:\\Karusel\\Nurburg-karussel_88'\n",
"with open(os.path.join(path_dataset, 'meta.json'), 'r') as j:\n",
" meta = json.load(j)\n",
"\n",
@@ -24,7 +24,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"id": "7af948d4",
"metadata": {},
"outputs": [],
@@ -41,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "7ea0771e",
"metadata": {},
"outputs": [],
@@ -54,13 +54,14 @@
" keypoints_2d.loc[i] = nodes[label2hash(meta_json, obj)[str(i)]]['loc']\n",
"\n",
" keypoints_2d['v'] = 2\n",
" keypoints_2d[(keypoints_2d.x==0)&(keypoints_2d.y==0)] = 0\n",
" keypoints_2d = keypoints_2d.astype(float).round().astype(int)\n",
" return keypoints_2d[:24]"
" return keypoints_2d"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"id": "26b6abf4",
"metadata": {},
"outputs": [],
@@ -93,7 +94,26 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "7c4d21a7",
"metadata": {},
"outputs": [],
"source": [
"def skeleton_supervisely(meta):\n",
" meta_nodes = meta['classes'][0]['geometry_config']['nodes']\n",
" label2hash = {}\n",
" for name in meta_nodes:\n",
" label2hash[meta_nodes[name]['label']] = name\n",
"\n",
" skeleton_supervisely = []\n",
" for edge in meta['classes'][0]['geometry_config']['edges']:\n",
" skeleton_supervisely.append([meta_nodes[edge['src']]['label'], meta_nodes[edge['dst']]['label']])\n",
" return skeleton_supervisely"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "155be42d",
"metadata": {},
"outputs": [],
@@ -113,21 +133,22 @@
" for obj in ann['objects']:\n",
" keypoints = annotations(meta, obj)\n",
" annotations_list.append(ann_json(keypoints, i, obj))\n",
" return image_list, annotations_list"
" return image_list, annotations_list, meta"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 10,
"id": "6593f677",
"metadata": {},
"outputs": [],
"source": [
"def COCO(image_list, annotations_list):\n",
"def COCO(image_list, annotations_list, meta):\n",
" num_kpts = len(meta['classes'][0]['geometry_config']['nodes'])\n",
" coco = {\n",
"\n",
" \"info\": {\n",
" \"description\": \"karusel Dataset\", \"version\": \"2.0\"\n",
" \"description\": \"karusel Dataset\", \"version\": \"2.0\", \"keypoints\":num_kpts\n",
" },\n",
"\n",
" \"categories\": [\n",
@@ -135,13 +156,8 @@
" \"supercategory\": \"NurburgRing\",\n",
" \"id\": 1,\n",
" \"name\": \"karusel\",\n",
" \"keypoints\": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,\n",
" 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],\n",
" \"skeleton\": [\n",
" [1, 2],[2, 3],[3, 4],[4, 5],[5, 6],[6, 7],[7, 8],[8, 9],[9, 10],[10, 11],\n",
" [11, 12],[12, 13],[13, 14],[14, 15],[15, 16],[16, 17],[17, 18],[18, 19],[19, 20],\n",
" [20, 21],[21, 22],[22, 23],[23, 24],[24, 1],[24, 3],[1, 5]\n",
" ]\n",
" \"keypoints\": list(range(num_kpts)),\n",
" \"skeleton\": skeleton_supervisely(meta)\n",
" }\n",
" ]\n",
" }\n",
@@ -153,14 +169,14 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 11,
"id": "38880d13",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "96021bfc91ce425dbef57ae348321005",
"model_id": "219ba034d89346f188cf37dc9a722263",
"version_major": 2,
"version_minor": 0
},
@@ -178,7 +194,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"id": "314565c2",
"metadata": {},
"outputs": [],