mirror of
https://github.com/gosticks/body-pose-animation.git
synced 2025-10-16 11:45:42 +00:00
minor imporvements
This commit is contained in:
parent
18e7c484d5
commit
51f220b2ae
1
.gitignore
vendored
1
.gitignore
vendored
@ -101,3 +101,4 @@ vposer_v1_0
|
|||||||
results/
|
results/
|
||||||
output/
|
output/
|
||||||
tests/
|
tests/
|
||||||
|
samples/video*
|
||||||
@ -26,9 +26,9 @@ RUN apt-get update && \
|
|||||||
|
|
||||||
#get openpose
|
#get openpose
|
||||||
# WORKDIR /openpose
|
# WORKDIR /openpose
|
||||||
# RUN git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git .
|
RUN git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose.git .
|
||||||
|
|
||||||
#build it
|
#build it
|
||||||
# WORKDIR /openpose/build
|
WORKDIR /openpose/build
|
||||||
# RUN cmake -DBUILD_PYTHON=OFF .. && make -j `nproc`
|
RUN cmake -DBUILD_PYTHON=OFF .. && make -j `nproc`
|
||||||
# WORKDIR /openpose
|
WORKDIR /openpose
|
||||||
|
|||||||
@ -48,10 +48,14 @@ class SMPLyDataset(Dataset):
|
|||||||
model_type=config['smpl']['type'],
|
model_type=config['smpl']['type'],
|
||||||
image_format=config['data']['sampleImageFormat'],
|
image_format=config['data']['sampleImageFormat'],
|
||||||
sample_format=config['data']['sampleNameFormat'],
|
sample_format=config['data']['sampleNameFormat'],
|
||||||
# img_format=config['data']['sampleImageFormat'],
|
|
||||||
sample_id_pad=config['data']['sampleImageFormat'].count('%')
|
sample_id_pad=config['data']['sampleImageFormat'].count('%')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_image_id(self, index):
|
||||||
|
img_id_pad = self.image_format.count("%")
|
||||||
|
|
||||||
|
return str(index + self.start_index).zfill(img_id_pad)
|
||||||
|
|
||||||
def get_item_name(self, index):
|
def get_item_name(self, index):
|
||||||
if self.sample_id_pad == 0:
|
if self.sample_id_pad == 0:
|
||||||
name = str(index)
|
name = str(index)
|
||||||
@ -94,7 +98,8 @@ class SMPLyDataset(Dataset):
|
|||||||
return sample_count
|
return sample_count
|
||||||
|
|
||||||
def get_image_path(self, index):
|
def get_image_path(self, index):
|
||||||
id = self.get_item_name(index)
|
id = self.get_image_id(index)
|
||||||
name = self.image_format.replace("%" * len(id), id)
|
name = self.image_format.replace("%" * len(id), id)
|
||||||
path = os.path.join(self.root_dir, name)
|
path = os.path.join(self.root_dir, name)
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|||||||
@ -8,7 +8,7 @@ from renderer import *
|
|||||||
from utils.general import rename_files, get_new_filename
|
from utils.general import rename_files, get_new_filename
|
||||||
|
|
||||||
START_IDX = 1 # starting index of the frame to optimize for
|
START_IDX = 1 # starting index of the frame to optimize for
|
||||||
FINISH_IDX = 100 # choose a big number to optimize for all frames in samples directory
|
FINISH_IDX = 200 # choose a big number to optimize for all frames in samples directory
|
||||||
# if False, only run already saved animation without optimization
|
# if False, only run already saved animation without optimization
|
||||||
RUN_OPTIMIZATION = True
|
RUN_OPTIMIZATION = True
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ from renderer import *
|
|||||||
from utils.general import rename_files, get_new_filename
|
from utils.general import rename_files, get_new_filename
|
||||||
|
|
||||||
START_IDX = 1 # starting index of the frame to optimize for
|
START_IDX = 1 # starting index of the frame to optimize for
|
||||||
FINISH_IDX = 120 # choose a big number to optimize for all frames in samples directory
|
FINISH_IDX = None # choose a big number to optimize for all frames in samples directory
|
||||||
|
|
||||||
result_image = []
|
result_image = []
|
||||||
idx = START_IDX
|
idx = START_IDX
|
||||||
|
|||||||
@ -238,6 +238,19 @@ def get_named_joint(joints: List, name: str, type="smpl"):
|
|||||||
return joints[joint_names_body_25[name]]
|
return joints[joint_names_body_25[name]]
|
||||||
|
|
||||||
|
|
||||||
|
def get_indices_by_name(names: List[str], type="smpl"):
|
||||||
|
return [get_index_by_name(name, type=type) for name in names]
|
||||||
|
|
||||||
|
|
||||||
|
def get_index_by_name(name: str, type="smpl"):
|
||||||
|
if type == "smpl":
|
||||||
|
mapping = get_mapping_arr()
|
||||||
|
index = joint_names_body_25[name]
|
||||||
|
return np.where(mapping == index)
|
||||||
|
if type == "body_25":
|
||||||
|
return joint_names_body_25[name]
|
||||||
|
|
||||||
|
|
||||||
def get_named_joints(joints: List, names: List[str], type="smpl"):
|
def get_named_joints(joints: List, names: List[str], type="smpl"):
|
||||||
return np.array([get_named_joint(joints, name, type=type) for name in names]).squeeze()
|
return np.array([get_named_joint(joints, name, type=type) for name in names]).squeeze()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user