diff --git a/easymocap/datasets/base.py b/easymocap/datasets/base.py index a059abb..0885c71 100644 --- a/easymocap/datasets/base.py +++ b/easymocap/datasets/base.py @@ -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']: - 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: data['annots'] = data['annots']['annots'] # compose the data diff --git a/easymocap/estimator/openpose_wrapper.py b/easymocap/estimator/openpose_wrapper.py index 3479817..bf57f76 100644 --- a/easymocap/estimator/openpose_wrapper.py +++ b/easymocap/estimator/openpose_wrapper.py @@ -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': diff --git a/easymocap/multistage/base_ops.py b/easymocap/multistage/base_ops.py index f49b6db..ae40a8b 100644 --- a/easymocap/multistage/base_ops.py +++ b/easymocap/multistage/base_ops.py @@ -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 \ No newline at end of file