Skip to content
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
4 changes: 2 additions & 2 deletions src/python/pose_format/numpy/pose_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ def bbox(self, header: PoseHeader):

return NumPyPoseBody(self.fps, new_data, confidence)

def interpolate(self, new_fps: int = None, kind='cubic'):
def interpolate(self, new_fps: float = None, kind='cubic'):
"""
Interpolates the pose data to match a new frame rate.

Parameters
----------
new_fps : int, optional
new_fps : float, optional
The desired frame rate for interpolation.
kind : str, optional
The type of interpolation. Options include: "linear", "quadratic", and "cubic".
Expand Down
6 changes: 3 additions & 3 deletions src/python/pose_format/tensorflow/pose_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .masked.tensor import MaskedTensor

TF_POSE_RECORD_DESCRIPTION = {
'fps': tf.io.FixedLenFeature([], tf.int64, default_value=0),
'fps': tf.io.FixedLenFeature([], tf.float32, default_value=0.0),
'pose_data': tf.io.FixedLenFeature([], tf.string),
'pose_confidence': tf.io.FixedLenFeature([], tf.string),
}
Expand Down Expand Up @@ -218,7 +218,7 @@ def as_tfrecord(self):
confidence = tf.io.serialize_tensor(self.confidence).numpy()

return {
'fps': tf.train.Feature(int64_list=tf.train.Int64List(value=[self.fps])),
'fps': tf.train.Feature(float_list=tf.train.FloatList(value=[self.fps])),
'pose_data': tf.train.Feature(bytes_list=tf.train.BytesList(value=[data])),
'pose_confidence': tf.train.Feature(bytes_list=tf.train.BytesList(value=[confidence]))
}
Expand All @@ -238,7 +238,7 @@ def from_tfrecord(cls, tfrecord_dict: dict):
TensorflowPoseBody
An instance constructed from given TensorFlow record data
"""
fps = tf.cast(tfrecord_dict['fps'], dtype=tf.float32)
fps = tfrecord_dict['fps']
data = tf.io.parse_tensor(tfrecord_dict['pose_data'], out_type=tf.float32)
confidence = tf.io.parse_tensor(tfrecord_dict['pose_confidence'], out_type=tf.float32)
return cls(fps=fps, data=data, confidence=confidence)
4 changes: 2 additions & 2 deletions src/python/pose_format/utils/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def get_standard_components_for_known_format(known_pose_format: KnownPoseFormat)
raise NotImplementedError(f"Unsupported pose header schema {known_pose_format}")


def fake_pose(num_frames: int, fps: int=25, components: Union[List[PoseHeaderComponent],None]=None)->Pose:
def fake_pose(num_frames: int, fps: float=25.0, components: Union[List[PoseHeaderComponent],None]=None)->Pose:
if components is None:
components = copy.deepcopy(OpenPose_Components) # fixes W0102, dangerous default value

Expand All @@ -230,7 +230,7 @@ def fake_pose(num_frames: int, fps: int=25, components: Union[List[PoseHeaderCom
confidence = np.random.randn(num_frames, 1, total_points)
masked_data = ma.masked_array(data)

body = NumPyPoseBody(fps=int(fps), data=masked_data, confidence=confidence)
body = NumPyPoseBody(fps=fps, data=masked_data, confidence=confidence)

return Pose(header, body)

Expand Down
2 changes: 1 addition & 1 deletion src/python/pose_format/utils/holistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def formatted_holistic_pose(width: int, height: int, additional_face_points: int
{"FACE_LANDMARKS": FACEMESH_CONTOURS_POINTS})


def load_mediapipe_directory(directory: str, fps: int, width: int, height: int, num_face_points: int = 128) -> Pose:
def load_mediapipe_directory(directory: str, fps: float, width: int, height: int, num_face_points: int = 128) -> Pose:
"""
Load pose data from a directory of MediaPipe

Expand Down
2 changes: 1 addition & 1 deletion src/python/pose_format/utils/openpose.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def load_openpose(frames: OpenPoseFrames,
stacked_confidence = np.stack([mask, mask], axis=3)
masked_data = ma.masked_array(data, mask=stacked_confidence)

body = NumPyPoseBody(fps=int(fps), data=masked_data, confidence=confidence)
body = NumPyPoseBody(fps=fps, data=masked_data, confidence=confidence)

return Pose(header, body)

Expand Down