init-GrandPrix+dataset_v1-15kps
54
Grand_Prix/Inference/predict.ipynb
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "120b4212",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!python -m openpifpaf.predict test\\images\\test.png \\\n",
|
||||
"--checkpoint=model/mobilenetv2-GrandPrix_v1_15.pkl.№1.epoch510 --image-output \\\n",
|
||||
"--keypoint-threshold-rel=0.01 --cif-th=0.01 --caf-th=0.01 --seed-threshold=0.01 \\\n",
|
||||
"--keypoint-threshold=0.01 --tr-minimum-threshold=0.01 --tr-single-pose-threshold=0.01 \\\n",
|
||||
"--tr-multi-pose-threshold=0.01 --instance-threshold=0.1 --line-width=2 --json-output"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "984d60d5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# !python -m openpifpaf.video --source test\\videos\\test.mp4 \\\n",
|
||||
"# --checkpoint=model/mobilenetv2-GrandPrix_v1_15.pkl.№1.epoch510 --video-output --json-output \\\n",
|
||||
"# --keypoint-threshold-rel=0.01 --cif-th=0.01 --caf-th=0.01 --seed-threshold=0.01 \\\n",
|
||||
"# --keypoint-threshold=0.01 --tr-minimum-threshold=0.01 --tr-single-pose-threshold=0.01 \\\n",
|
||||
"# --tr-multi-pose-threshold=0.01 --instance-threshold=0.1 --line-width=4 --video-fps=25 \\\n",
|
||||
"# --scale=1 --loader-workers=3"
|
||||
]
|
||||
}
|
||||
],
|
||||
"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.9.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
BIN
Grand_Prix/Inference/test/images/test.png
Normal file
|
After Width: | Height: | Size: 2.6 MiB |
BIN
Grand_Prix/Inference/test/images/test.png.predictions.jpeg
Normal file
|
After Width: | Height: | Size: 652 KiB |
@@ -0,0 +1 @@
|
||||
[{"keypoints": [838.75, 615.73, 0.88, 909.25, 613.23, 0.96, 1016.17, 620.18, 0.97, 1061.86, 628.27, 0.97, 1009.92, 566.12, 0.97, 1058.38, 501.94, 0.97, 1009.72, 476.08, 0.97, 936.14, 503.76, 0.99, 887.17, 524.44, 1.0, 800.59, 530.07, 0.99, 692.88, 533.28, 0.93, 649.33, 581.98, 0.97, 703.06, 585.64, 0.96, 912.56, 581.72, 0.96, 921.69, 479.73, 0.87], "bbox": [639.74, 465.77, 433.49, 173.86], "score": 0.957, "category_id": 1}]
|
||||
227
Grand_Prix/Supervisely/Bbox from Pose.ipynb
Normal file
@@ -0,0 +1,227 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "07bdc0da",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import json\n",
|
||||
"import numpy as np\n",
|
||||
"from tqdm.notebook import tqdm\n",
|
||||
"path_dataset = r'D:\\GrandPrix\\Grand-Prix'"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "ca890aa0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def find_image(id):\n",
|
||||
" for row in coco['images']:\n",
|
||||
" if row['id'] == id:\n",
|
||||
" return row"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "b8135031",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def ltrb_from_cloud(cloud_2d, imgSize, expansion=0.1):\n",
|
||||
" height, width = imgSize\n",
|
||||
" ltrb = np.round((cloud_2d[:, 0].min(), cloud_2d[:, 1].min(),\n",
|
||||
" cloud_2d[:, 0].max(), cloud_2d[:, 1].max())).astype(int)\n",
|
||||
" \n",
|
||||
" if expansion > 0:\n",
|
||||
" dx = np.round((ltrb[2]-ltrb[0])*expansion/2)\n",
|
||||
" dy = np.round((ltrb[3]-ltrb[1])*expansion/2)\n",
|
||||
" ltrb += np.array([-dx, -2*dy, dx, dy], dtype=int)\n",
|
||||
" \n",
|
||||
" ltrb[[0,2]] = np.clip(ltrb[[0,2]], 0, width)\n",
|
||||
" ltrb[[1,3]] = np.clip(ltrb[[1,3]], 0, height)\n",
|
||||
" \n",
|
||||
" return ltrb\n",
|
||||
"\n",
|
||||
"def ltrb2ltwh(ltrb):\n",
|
||||
" return np.array([ltrb[0], ltrb[1], ltrb[2]-ltrb[0], ltrb[3]-ltrb[1]], dtype=int)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "79762c08",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(os.path.join(path_dataset, 'GrandPrix_COCO.json'), 'r') as file:\n",
|
||||
" coco = json.load(file)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a1cfe0e2",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Bboxes from pose"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "f9440b54",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "758138a872a9485885387a5ffe5a9696",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
" 0%| | 0/148 [00:00<?, ?it/s]"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"for obj in tqdm(coco['annotations']):\n",
|
||||
" keypoints_2d = np.array(obj['keypoints']).reshape((-1, 3))[:, :2]\n",
|
||||
" id, width, height, file_name = find_image(obj['image_id']).values()\n",
|
||||
" \n",
|
||||
" bbox_ltrb = ltrb_from_cloud(keypoints_2d, (height, width), 0.4)\n",
|
||||
" bbox_ltwh = ltrb2ltwh(bbox_ltrb).tolist()\n",
|
||||
" obj['bbox'] = bbox_ltwh\n",
|
||||
" obj['area'] = bbox_ltwh[2]*bbox_ltwh[3]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "dfcb675b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(os.path.join(path_dataset, 'GrandPrix_COCO.json'), 'w') as file:\n",
|
||||
" json.dump(coco, file)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "e8ff698d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Split COCO json to train/val"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "3aec7a2b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sklearn.model_selection import train_test_split\n",
|
||||
"import copy\n",
|
||||
"\n",
|
||||
"def split_coco_json(coco, test_size=0.2, random_state=0):\n",
|
||||
" \n",
|
||||
" train_idx, test_idx = train_test_split([i['id'] for i in coco['images']],\n",
|
||||
" test_size=test_size, random_state=random_state)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
" train = copy.deepcopy(coco)\n",
|
||||
" test = copy.deepcopy(coco)\n",
|
||||
"\n",
|
||||
" test['images'] = [x for x in coco['images'] if x['id'] in test_idx]\n",
|
||||
" train['images'] = [x for x in coco['images'] if x['id'] in train_idx]\n",
|
||||
"\n",
|
||||
" test['annotations'] = [x for x in coco['annotations'] if x['image_id'] in test_idx]\n",
|
||||
" train['annotations'] = [x for x in coco['annotations'] if x['image_id'] in train_idx]\n",
|
||||
" return train, test"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1cdd1a3c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Create new splited dataset"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"id": "aafd54fb",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"train, test = split_coco_json(coco, 0.1, random_state=77)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"id": "f6af98fc",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"test_path_images = [os.path.join(path_dataset, 'images', 'img', x['file_name']) for x in test['images']]\n",
|
||||
"train_path_images = [os.path.join(path_dataset, 'images', 'img', x['file_name']) for x in train['images']]\n",
|
||||
"\n",
|
||||
"import shutil\n",
|
||||
"path_new_dataset = r'C:\\Users\\Kir\\Jupiter\\Drivecast\\place6D_Nurburgring\\Grand_Prix\\Training\\GrandPrix_dataset_v1_15'\n",
|
||||
"\n",
|
||||
"path_train_img = os.path.join(path_new_dataset, 'images', 'train')\n",
|
||||
"path_test_img = os.path.join(path_new_dataset, 'images', 'val')\n",
|
||||
"path_ann = os.path.join(path_new_dataset, 'annotations')\n",
|
||||
"\n",
|
||||
"os.makedirs(path_train_img, exist_ok=True)\n",
|
||||
"os.makedirs(path_test_img, exist_ok=True)\n",
|
||||
"os.makedirs(path_ann, exist_ok=True)\n",
|
||||
"\n",
|
||||
"with open(os.path.join(path_ann, 'train.json'), 'w') as file:\n",
|
||||
" json.dump(train, file)\n",
|
||||
" \n",
|
||||
"with open(os.path.join(path_ann, 'val.json'), 'w') as file:\n",
|
||||
" json.dump(test, file)\n",
|
||||
"\n",
|
||||
"for path in train_path_images:\n",
|
||||
" shutil.copy(path, path_train_img)\n",
|
||||
"\n",
|
||||
"for path in test_path_images:\n",
|
||||
" shutil.copy(path, path_test_img)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"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.9.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
83
Grand_Prix/Supervisely/GrandPrix_create_3d_15.ipynb
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "9b13894c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import pandas as pd\n",
|
||||
"import numpy as np\n",
|
||||
"import cv2 \n",
|
||||
"import plotly.express as px\n",
|
||||
"import plotly.graph_objects as go\n",
|
||||
"# from utils import *\n",
|
||||
"\n",
|
||||
"def roration(x):\n",
|
||||
" x = np.deg2rad(x)\n",
|
||||
" return np.array([[np.cos(x), -np.sin(x)],\n",
|
||||
" [np.sin(x), np.cos(x)]])\n",
|
||||
"\n",
|
||||
"arrow = np.float32([[0,1,0],\n",
|
||||
" [0,-1,0]])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 178,
|
||||
"id": "39604368",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"img = cv2.imread('Grand_Prix_GPS-double.png')\n",
|
||||
"df = pd.read_csv('raw_keypoints.csv',index_col='index')\n",
|
||||
"df.loc[[1,2], ['x','y']] -=3\n",
|
||||
"df_raw = df.copy()\n",
|
||||
"center = (1164, 703)\n",
|
||||
"df[['x', 'y']]-= center\n",
|
||||
"df = df.astype('float32')\n",
|
||||
"df['z'] = 4.2*np.float32([0, 0, 0, 0, 3, 6.33, 7.33, 3.33, 2.33, 2.33, 2.33, 2.5, 2.5, 1.2,1.5])\n",
|
||||
"df[['x', 'y']] /= 8.4\n",
|
||||
"df[['x', 'y']] = df.values[:, :2]@roration(-135) # поворот x и y в плоскости земли\n",
|
||||
"# df.to_csv('GrandPrix_15kps.csv')\n",
|
||||
"\n",
|
||||
"# rvec, tvec, camMatrx, dist = fit(img.shape[:2], df_raw, df)\n",
|
||||
"# imgpts = cv.projectPoints(5*arrow, rvec, tvec, camMatrx, dist)[0][:, 0].astype(int)\n",
|
||||
"# for i, p in enumerate(imgpts):\n",
|
||||
"# cv2.circle(img, p, 3*(i+1), color=(200,25,200), thickness=-1)\n",
|
||||
"# px.imshow(img)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "82d1f0f1",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.9.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
BIN
Grand_Prix/Supervisely/Grand_Prix_GPS-double.png
Normal file
|
After Width: | Height: | Size: 3.3 MiB |
BIN
Grand_Prix/Supervisely/Grand_Prix_GPS-double2.png
Normal file
|
After Width: | Height: | Size: 3.9 MiB |
BIN
Grand_Prix/Supervisely/Grand_Prix_GPS.psd
Normal file
228
Grand_Prix/Supervisely/ToCOCO.ipynb
Normal file
@@ -0,0 +1,228 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "283f6e9c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import numpy as np\n",
|
||||
"import pandas as pd\n",
|
||||
"import glob\n",
|
||||
"import json\n",
|
||||
"from tqdm.notebook import tqdm\n",
|
||||
"\n",
|
||||
"path_dataset = r'D:\\GrandPrix\\Grand-Prix'\n",
|
||||
"with open(os.path.join(path_dataset, 'meta.json'), 'r') as j:\n",
|
||||
" meta = json.load(j)\n",
|
||||
"\n",
|
||||
"imgs = glob.glob(path_dataset + '\\\\images\\\\img\\\\*', recursive=True)\n",
|
||||
"anns = glob.glob(path_dataset + '\\\\images\\\\ann\\\\*', recursive=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "7af948d4",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def label2hash(meta_json, last):\n",
|
||||
" for clss in meta_json['classes']:\n",
|
||||
" if clss['title'] == last['classTitle']:\n",
|
||||
" meta_nodes = clss['geometry_config']['nodes']\n",
|
||||
" label2hash = {}\n",
|
||||
" for name in meta_nodes:\n",
|
||||
" label2hash[meta_nodes[name]['label']] = name\n",
|
||||
" return label2hash"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "7ea0771e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def annotations(meta_json, obj):\n",
|
||||
" nodes = obj['nodes']\n",
|
||||
" keypoints_2d = pd.DataFrame(columns=['x', 'y'])\n",
|
||||
"\n",
|
||||
" for i in range(1, len(nodes)+1):\n",
|
||||
" keypoints_2d.loc[i] = nodes[label2hash(meta_json, obj)[str(i)]]['loc']\n",
|
||||
"\n",
|
||||
" keypoints_2d['v'] = 2\n",
|
||||
" keypoints_2d[(keypoints_2d.x<3)&(keypoints_2d.y<3)] = 0\n",
|
||||
" keypoints_2d = keypoints_2d.astype(float).round().astype(int)\n",
|
||||
" return keypoints_2d"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "26b6abf4",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def ann_json(keypoints, img_id, obj):\n",
|
||||
" \n",
|
||||
" annotation = {\n",
|
||||
" \"id\": obj['id'],\n",
|
||||
" \"segmentation\": [],\n",
|
||||
" \"num_keypoints\": len(keypoints),\n",
|
||||
" \"area\": 0,\n",
|
||||
" \"iscrowd\": 0,\n",
|
||||
" \"image_id\": img_id,\n",
|
||||
" \"bbox\": [],\n",
|
||||
" \"category_id\": 1,\n",
|
||||
" \"keypoints\": keypoints.values.flatten().tolist()}\n",
|
||||
"\n",
|
||||
" return annotation\n",
|
||||
"\n",
|
||||
"def img_json(ann, name, id):\n",
|
||||
" height, width = ann['size'].values()\n",
|
||||
" image = {\n",
|
||||
" \"id\": id,\n",
|
||||
" \"width\": width,\n",
|
||||
" \"height\": height,\n",
|
||||
" \"file_name\": name,\n",
|
||||
" }\n",
|
||||
" return image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"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": 6,
|
||||
"id": "155be42d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def ann_img_list(anns, imgs, meta):\n",
|
||||
" annotations_list = []\n",
|
||||
" image_list = []\n",
|
||||
" for i in tqdm(range(len(anns))):\n",
|
||||
"\n",
|
||||
" with open(anns[i], 'r') as j:\n",
|
||||
" ann = json.load(j)\n",
|
||||
" \n",
|
||||
" image_name = os.path.basename(anns[i])[:-5]\n",
|
||||
" image = img_json(ann, image_name, i)\n",
|
||||
" image_list.append(image)\n",
|
||||
"\n",
|
||||
" 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, meta"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "6593f677",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"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\": \"1.0\", \"keypoints\":num_kpts\n",
|
||||
" },\n",
|
||||
"\n",
|
||||
" \"categories\": [\n",
|
||||
" {\n",
|
||||
" \"supercategory\": \"NurburgRing\",\n",
|
||||
" \"id\": 1,\n",
|
||||
" \"name\": \"GrandPrix\",\n",
|
||||
" \"keypoints\": list(range(num_kpts)),\n",
|
||||
" \"skeleton\": skeleton_supervisely(meta)\n",
|
||||
" }\n",
|
||||
" ]\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" coco['images'] = image_list\n",
|
||||
" coco['annotations'] = annotations_list\n",
|
||||
" return coco"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"id": "38880d13",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "d7d6cab432b5425894ec499e3216f3a3",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
"text/plain": [
|
||||
" 0%| | 0/148 [00:00<?, ?it/s]"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"coco_json = COCO(*ann_img_list(anns, imgs, meta))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"id": "314565c2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"with open(os.path.join(path_dataset, 'GrandPrix_COCO.json'), 'w') as file:\n",
|
||||
" json.dump(coco_json, file)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"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.9.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
16
Grand_Prix/Supervisely/raw_keypoints.csv
Normal file
@@ -0,0 +1,16 @@
|
||||
index,x,y
|
||||
1,1213,749
|
||||
2,1123,661
|
||||
3,1093,473
|
||||
4,1127,364
|
||||
5,1100,472
|
||||
6,1129,364
|
||||
7,1094,474
|
||||
8,734,841
|
||||
9,804,924
|
||||
10,918,1035
|
||||
11,1066,1183
|
||||
12,1500,960
|
||||
13,1468,868
|
||||
14,1064,693
|
||||
15,356,1107
|
||||
|
BIN
Grand_Prix/Supervisely/высота.jpg
Normal file
|
After Width: | Height: | Size: 799 KiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
After Width: | Height: | Size: 2.8 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.1 MiB |