diff --git a/README.md b/README.md index 1d4cea4..9989712 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ [![Project Page](https://img.shields.io/badge/Project-Website-green)](https://easyanimate.github.io/) [![Modelscope Studio](https://img.shields.io/badge/Modelscope-Studio-blue)](https://modelscope.cn/studios/PAI/EasyAnimate/summary) [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-yellow)](https://huggingface.co/spaces/alibaba-pai/EasyAnimate) +[![Discord Page](https://img.shields.io/badge/Discord-Page-blue)](https://discord.gg/UzkpB4Bn) English | [简体中文](./README_zh-CN.md) diff --git a/README_zh-CN.md b/README_zh-CN.md index f46ef26..ab736c6 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -9,6 +9,7 @@ [![Project Page](https://img.shields.io/badge/Project-Website-green)](https://easyanimate.github.io/) [![Modelscope Studio](https://img.shields.io/badge/Modelscope-Studio-blue)](https://modelscope.cn/studios/PAI/EasyAnimate/summary) [![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-yellow)](https://huggingface.co/spaces/alibaba-pai/EasyAnimate) +[![Discord Page](https://img.shields.io/badge/Discord-Page-blue)](https://discord.gg/UzkpB4Bn) [English](./README.md) | 简体中文 diff --git a/easyanimate/data/bucket_sampler.py b/easyanimate/data/bucket_sampler.py index 2c5fded..78eb683 100644 --- a/easyanimate/data/bucket_sampler.py +++ b/easyanimate/data/bucket_sampler.py @@ -243,6 +243,9 @@ class AspectRatioBatchSampler(BatchSampler): videoid, name, page_dir = video_dict['videoid'], video_dict['name'], video_dict['page_dir'] video_dir = os.path.join(self.video_folder, f"{videoid}.mp4") cap = cv2.VideoCapture(video_dir) + if not cap.isOpened(): + print(f"Open video {video_dir} is error! ") + continue # 获取视频尺寸 width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) # 浮点数转换为整数 @@ -354,6 +357,9 @@ class AspectRatioBatchImageVideoSampler(BatchSampler): else: video_dir = os.path.join(self.train_folder, video_id) cap = cv2.VideoCapture(video_dir) + if not cap.isOpened(): + print(f"Open video {video_dir} is error! ") + continue # 获取视频尺寸 width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) # 浮点数转换为整数 @@ -376,4 +382,4 @@ class AspectRatioBatchImageVideoSampler(BatchSampler): # yield a batch of indices in the same aspect ratio group if len(bucket) == self.batch_size: yield bucket[:] - del bucket[:] \ No newline at end of file + del bucket[:]