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

Add face optional parameter #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion datacollection/run_rs_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,19 @@ def get_op_args():
type=str2bool,
default=False,
help='')
p.add_argument('--face',
type=str2bool,
default=True,
help='enable face detection')

args, _ = p.parse_known_args()

rs_args = get_rs_args()
op_args = get_op_args()

if len(args.extract_pose) != 0:
extract_pose_from_heatmaps(args.extract_pose, op_args,
args.display_pose)
args.display_pose, args.face)
elif args.save_heatmaps:
save_heatmaps(rs_args, op_args)
else:
Expand Down
5 changes: 4 additions & 1 deletion datacollection/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ def predict_hm3(self):

def extract_pose_from_heatmaps(base_path: str,
op_args: argparse.Namespace,
display_pose: bool = False):
display_pose: bool = False,
face: bool = True
):
op_args.face = face
PE = OpenPosePoseExtractor(op_args)
PE.pyop.configure(PE.pyop.params_cin)

Expand Down
8 changes: 6 additions & 2 deletions openpose/native/python/skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@ def __init__(self,
params: Optional[dict] = None,
skel_thres: float = 0.0,
max_true_body: int = 2,
patch_offset: int = 2) -> None:
patch_offset: int = 2,
) -> None:
super().__init__(skel_thres, max_true_body, patch_offset)

# default parameters
Expand All @@ -396,6 +397,8 @@ def __init__(self,

params["scale_number"] = 1
params["body"] = 1


# params["posenet_only"] = False
# params["custom_net_input_layer"] = ""
# params["custom_net_output_layer"] = ""
Expand Down Expand Up @@ -519,7 +522,7 @@ class OpenPosePoseExtractor:
has functions that intialize openpose, infer + save pose, and display pose.
"""

def __init__(self, args: argparse.Namespace) -> None:
def __init__(self, args: argparse.Namespace, face: bool) -> None:
self.pyop = PyOpenPoseNative(
dict(
model_folder=args.op_model_folder,
Expand All @@ -530,6 +533,7 @@ def __init__(self, args: argparse.Namespace) -> None:
heatmaps_add_PAFs=args.op_heatmaps_add_PAFs,
heatmaps_scale=args.op_heatmaps_scale,
render_pose=-1 if args.op_display > 0 else 0,
face=face
),
args.op_skel_thres,
args.op_max_true_body,
Expand Down