Merge pull request #268 from xk-huang/fix-demo
Fix Quick Start Demo of mv1p
This commit is contained in:
commit
1c2f2c3fe9
@ -42,6 +42,10 @@ def get_allname(root0, subs, ranges, root, ext, **kwargs):
|
|||||||
else:
|
else:
|
||||||
_ranges = ranges
|
_ranges = ranges
|
||||||
nv = subs.index(sub)
|
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)):
|
for nnf, nf in enumerate(range(*_ranges)):
|
||||||
image_names.append({
|
image_names.append({
|
||||||
'sub': sub,
|
'sub': sub,
|
||||||
@ -230,7 +234,7 @@ class Base(BaseData):
|
|||||||
self.reader = reader
|
self.reader = reader
|
||||||
self.writer = writer
|
self.writer = writer
|
||||||
if camera != 'none':
|
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)
|
camera = join(self.root, camera)
|
||||||
if os.path.exists(camera):
|
if os.path.exists(camera):
|
||||||
cameras = read_cameras(camera)
|
cameras = read_cameras(camera)
|
||||||
@ -464,7 +468,10 @@ class ImageFolder(Base):
|
|||||||
data[key] = Undistort.points(data[key], K, dist)
|
data[key] = Undistort.points(data[key], K, dist)
|
||||||
data[key+'_unproj'] = unproj(data[key], invK)
|
data[key+'_unproj'] = unproj(data[key], invK)
|
||||||
for _key in [key, key+'_distort', key+'_unproj']:
|
for _key in [key, key+'_distort', key+'_unproj']:
|
||||||
self.cache_shape[_key] = np.zeros_like(data[_key])
|
try:
|
||||||
|
self.cache_shape[_key] = np.zeros_like(data[_key])
|
||||||
|
except KeyError:
|
||||||
|
print(f"missed key: {_key}")
|
||||||
if self.loadmp:
|
if self.loadmp:
|
||||||
data['annots'] = data['annots']['annots']
|
data['annots'] = data['annots']['annots']
|
||||||
# compose the data
|
# compose the data
|
||||||
|
@ -18,6 +18,9 @@ from glob import glob
|
|||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
|
|
||||||
def run_openpose(image_root, annot_root, config):
|
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)
|
os.makedirs(annot_root, exist_ok=True)
|
||||||
pwd = os.getcwd()
|
pwd = os.getcwd()
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
|
@ -33,7 +33,7 @@ class SkipPoses(BeforeAfterBase):
|
|||||||
def before(self, body_params):
|
def before(self, body_params):
|
||||||
poses = body_params['poses']
|
poses = body_params['poses']
|
||||||
poses_copy = torch.zeros_like(poses)
|
poses_copy = torch.zeros_like(poses)
|
||||||
print(poses.shape)
|
# print(poses.shape)
|
||||||
poses_copy[..., self.copy_index] = poses[..., self.copy_index]
|
poses_copy[..., self.copy_index] = poses[..., self.copy_index]
|
||||||
body_params['poses'] = poses_copy
|
body_params['poses'] = poses_copy
|
||||||
return body_params
|
return body_params
|
Loading…
Reference in New Issue
Block a user