Merge pull request #268 from xk-huang/fix-demo

Fix Quick Start Demo of mv1p
This commit is contained in:
Qing Shuai 2023-02-11 20:55:11 +08:00 committed by GitHub
commit 1c2f2c3fe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View File

@ -42,6 +42,10 @@ def get_allname(root0, subs, ranges, root, ext, **kwargs):
else:
_ranges = ranges
nv = subs.index(sub)
if len(imgnames) < _ranges[1]:
raise ValueError('The number of images in {} is less than the range: {} vs {}'.format(join(root0, root, sub), len(imgnames), _ranges[1]))
for nnf, nf in enumerate(range(*_ranges)):
image_names.append({
'sub': sub,
@ -230,7 +234,7 @@ class Base(BaseData):
self.reader = reader
self.writer = writer
if camera != 'none':
if not os.path.isabs(camera):
if not os.path.exists(camera) and not os.path.isabs(camera):
camera = join(self.root, camera)
if os.path.exists(camera):
cameras = read_cameras(camera)
@ -464,7 +468,10 @@ class ImageFolder(Base):
data[key] = Undistort.points(data[key], K, dist)
data[key+'_unproj'] = unproj(data[key], invK)
for _key in [key, key+'_distort', key+'_unproj']:
try:
self.cache_shape[_key] = np.zeros_like(data[_key])
except KeyError:
print(f"missed key: {_key}")
if self.loadmp:
data['annots'] = data['annots']['annots']
# compose the data

View File

@ -18,6 +18,9 @@ from glob import glob
from multiprocessing import Process
def run_openpose(image_root, annot_root, config):
image_root = os.path.realpath(image_root)
annot_root = os.path.realpath(annot_root)
os.makedirs(annot_root, exist_ok=True)
pwd = os.getcwd()
if os.name != 'nt':

View File

@ -33,7 +33,7 @@ class SkipPoses(BeforeAfterBase):
def before(self, body_params):
poses = body_params['poses']
poses_copy = torch.zeros_like(poses)
print(poses.shape)
# print(poses.shape)
poses_copy[..., self.copy_index] = poses[..., self.copy_index]
body_params['poses'] = poses_copy
return body_params