Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/sg 000 fix sigmas #1503

Merged
merged 5 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion documentation/source/PoseEstimation.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ Then, the full configuration file should look like this:
num_joints: 17

# OKs sigma values take from https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py#L523
oks_sigmas: [0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062, 0.062, 1.007, 1.007, 0.087, 0.087, 0.089, 0.089]
oks_sigmas: [0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062, 0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089]

train_dataset_params:
image_paths: /my_new_dataset/train/images
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This is not "true" dataset params, one cannot use it to instantiate dataloaders
# But it contains skeleton definitions for COCO2017 dataset and exists to avoid
# duplication of those parameters in other dataset params

num_joints: 17

# OKs sigma values take from https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py#L523
oks_sigmas: [0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062, 0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089]

flip_indexes: [ 0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15,]

edge_links:
- [0, 1]
- [0, 2]
- [1, 2]
- [1, 3]
- [2, 4]
- [3, 5]
- [4, 6]
- [5, 6]
- [5, 7]
- [5, 11]
- [6, 8]
- [6, 12]
- [7, 9]
- [8, 10]
- [11, 12]
- [11, 13]
- [12, 14]
- [13, 15]
- [14, 16]

edge_colors:
- [214, 39, 40] # Nose -> LeftEye
- [148, 103, 189] # Nose -> RightEye
- [44, 160, 44] # LeftEye -> RightEye
- [140, 86, 75] # LeftEye -> LeftEar
- [227, 119, 194] # RightEye -> RightEar
- [127, 127, 127] # LeftEar -> LeftShoulder
- [188, 189, 34] # RightEar -> RightShoulder
- [127, 127, 127] # Shoulders
- [188, 189, 34] # LeftShoulder -> LeftElbow
- [140, 86, 75] # LeftTorso
- [23, 190, 207] # RightShoulder -> RightElbow
- [227, 119, 194] # RightTorso
- [31, 119, 180] # LeftElbow -> LeftArm
- [255, 127, 14] # RightElbow -> RightArm
- [148, 103, 189] # Waist
- [255, 127, 14] # Left Hip -> Left Knee
- [214, 39, 40] # Right Hip -> Right Knee
- [31, 119, 180] # Left Knee -> Left Ankle
- [44, 160, 44] # Right Knee -> Right Ankle


keypoint_colors:
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
Original file line number Diff line number Diff line change
@@ -1,71 +1,6 @@
num_joints: 17

# OKs sigma values take from https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py#L523
oks_sigmas: [0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062, 0.062, 1.007, 1.007, 0.087, 0.087, 0.089, 0.089]

flip_indexes: [ 0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15,]

edge_links:
- [0, 1]
- [0, 2]
- [1, 2]
- [1, 3]
- [2, 4]
- [3, 5]
- [4, 6]
- [5, 6]
- [5, 7]
- [5, 11]
- [6, 8]
- [6, 12]
- [7, 9]
- [8, 10]
- [11, 12]
- [11, 13]
- [12, 14]
- [13, 15]
- [14, 16]

edge_colors:
- [214, 39, 40] # Nose -> LeftEye
- [148, 103, 189] # Nose -> RightEye
- [44, 160, 44] # LeftEye -> RightEye
- [140, 86, 75] # LeftEye -> LeftEar
- [227, 119, 194] # RightEye -> RightEar
- [127, 127, 127] # LeftEar -> LeftShoulder
- [188, 189, 34] # RightEar -> RightShoulder
- [127, 127, 127] # Shoulders
- [188, 189, 34] # LeftShoulder -> LeftElbow
- [140, 86, 75] # LeftTorso
- [23, 190, 207] # RightShoulder -> RightElbow
- [227, 119, 194] # RightTorso
- [31, 119, 180] # LeftElbow -> LeftArm
- [255, 127, 14] # RightElbow -> RightArm
- [148, 103, 189] # Waist
- [255, 127, 14] # Left Hip -> Left Knee
- [214, 39, 40] # Right Hip -> Right Knee
- [31, 119, 180] # Left Knee -> Left Ankle
- [44, 160, 44] # Right Knee -> Right Ankle


keypoint_colors:
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
- [31, 119, 180]
- [148, 103, 189]
defaults:
- coco_pose_estimation_common_dataset_params
- _self_


train_dataset_params:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
num_joints: 17

# OKs sigma values take from https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py#L523
oks_sigmas: [0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062, 0.062, 1.007, 1.007, 0.087, 0.087, 0.089, 0.089]

edge_links:
- [0, 1]
- [0, 2]
- [1, 2]
- [1, 3]
- [2, 4]
- [3, 5]
- [4, 6]
- [5, 6]
- [5, 7]
- [5, 11]
- [6, 8]
- [6, 12]
- [7, 9]
- [8, 10]
- [11, 12]
- [11, 13]
- [12, 14]
- [13, 15]
- [14, 16]

defaults:
- coco_pose_estimation_common_dataset_params
- _self_

train_dataset_params:
pkl_file: REPLACE_ME_WITH_PATH_TO_TRAIN_DATASET.PKL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def __init__(

if oks_sigmas is None:
if num_joints == 17:
oks_sigmas = np.array([0.26, 0.25, 0.25, 0.35, 0.35, 0.79, 0.79, 0.72, 0.72, 0.62, 0.62, 1.07, 1.07, 0.87, 0.87, 0.89, 0.89]) / 10.0
oks_sigmas = np.array([0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062, 0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089])
else:
oks_sigmas = np.array([0.1] * num_joints)
logger.warning(
Expand Down
8 changes: 7 additions & 1 deletion tests/integration_tests/pose_estimation_models_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest

import torch
Expand All @@ -14,14 +15,17 @@

class PoseEstimationModelsIntegrationTest(unittest.TestCase):
def setUp(self):
self.oks_sigmas = [0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062, 0.062, 1.007, 1.007, 0.087, 0.087, 0.089, 0.089]
self.oks_sigmas = [0.026, 0.025, 0.025, 0.035, 0.035, 0.079, 0.079, 0.072, 0.072, 0.062, 0.062, 0.107, 0.107, 0.087, 0.087, 0.089, 0.089]
self.flip_indexes = [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15]
# This is for easy testing on local machine - you can set this environment variable to your own COCO dataset location
self.data_dir = os.environ.get("SUPER_GRADIENTS_COCO_DATASET_DIR", "/data/coco")

def test_dekr_model(self):
val_loader = get_data_loader(
"coco_pose_estimation_dekr_dataset_params",
COCOKeypointsDataset,
train=False,
dataset_params=dict(data_dir=self.data_dir),
dataloader_params=dict(num_workers=0),
)

Expand Down Expand Up @@ -54,6 +58,7 @@ def test_dekr_model_with_tta(self):
"coco_pose_estimation_dekr_dataset_params",
COCOKeypointsDataset,
train=False,
dataset_params=dict(data_dir=self.data_dir),
dataloader_params=dict(num_workers=0),
)

Expand Down Expand Up @@ -84,6 +89,7 @@ def test_dekr_model_with_rescoring(self):
"coco_pose_estimation_dekr_dataset_params",
COCOKeypointsDataset,
train=False,
dataset_params=dict(data_dir=self.data_dir),
dataloader_params=dict(batch_size=1, num_workers=0),
)

Expand Down