minor imporvements

This commit is contained in:
Wlad 2021-02-22 19:07:33 +01:00
parent 18e7c484d5
commit 51f220b2ae
6 changed files with 28 additions and 9 deletions

3
.gitignore vendored
View File

@ -100,4 +100,5 @@ vposer_v1_0
*.avi
results/
output/
tests/
tests/
samples/video*

View File

@ -26,9 +26,9 @@ RUN apt-get update && \
#get 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
# WORKDIR /openpose/build
# RUN cmake -DBUILD_PYTHON=OFF .. && make -j `nproc`
# WORKDIR /openpose
WORKDIR /openpose/build
RUN cmake -DBUILD_PYTHON=OFF .. && make -j `nproc`
WORKDIR /openpose

View File

@ -48,10 +48,14 @@ class SMPLyDataset(Dataset):
model_type=config['smpl']['type'],
image_format=config['data']['sampleImageFormat'],
sample_format=config['data']['sampleNameFormat'],
# img_format=config['data']['sampleImageFormat'],
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):
if self.sample_id_pad == 0:
name = str(index)
@ -94,7 +98,8 @@ class SMPLyDataset(Dataset):
return sample_count
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)
path = os.path.join(self.root_dir, name)
return path

View File

@ -8,7 +8,7 @@ from renderer import *
from utils.general import rename_files, get_new_filename
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
RUN_OPTIMIZATION = True

View File

@ -9,7 +9,7 @@ from renderer import *
from utils.general import rename_files, get_new_filename
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 = []
idx = START_IDX

View File

@ -238,6 +238,19 @@ def get_named_joint(joints: List, name: str, type="smpl"):
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"):
return np.array([get_named_joint(joints, name, type=type) for name in names]).squeeze()