Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/class-video #343

Merged
merged 18 commits into from
Feb 25, 2024
Merged

feat/class-video #343

merged 18 commits into from
Feb 25, 2024

Conversation

Zeyi-Lin
Copy link
Member

@Zeyi-Lin Zeyi-Lin commented Feb 22, 2024

Description

Close: #342

test code

解开Video的引入注释后:

import swanlab
import numpy as np

swanlab.init()

mp4_file = "path/to/file"
swanvideo = swanlab.Video(mp4_file, caption="video")

frames = np.random.randint(low=0, high=256, size=(10, 3, 100, 100), dtype=np.uint8)
swannpvideo = swanlab.Video(frames, fps=24)

gif_file = "path/to/file"
swanlabgifvideo = swanlab.Video(gif_file, format="gif")

swanlab.log({"video": swanvideo})
swanlab.log({"video": swannpvideo})
swanlab.log({"video": swanlabgifvideo})

test video/gif file

snowman.mp4

mutilmedia-chart

@Zeyi-Lin Zeyi-Lin self-assigned this Feb 22, 2024
@Zeyi-Lin
Copy link
Member Author

由于只有Video在传入numpy格式的视频时才需要安装moviepy,且这个库稍大,所以把这个库以安装提示的方式放入代码中:

  try:
      import moviepy
  except ImportError as e:
      raise TypeError(
          "swanlab.Video requires moviepy when process numpy data. Install with 'pip install moviepy'."
      )

@SAKURA-CAT SAKURA-CAT added the 🐛 bug Something isn't working label Feb 22, 2024
@Zeyi-Lin
Copy link
Member Author

ffmpeg需要去官网安装完整版,仅pip install不够,且moviepy可能在除ffmpeg以外的地方有其他报错,所以倾向于约束moviepy的使用范围(如不放到最开头的Import里面),而不单独处理此问题,让用户自行上网搜索

@SAKURA-CAT SAKURA-CAT added this to the v0.2.1 milestone Feb 23, 2024
@SAKURA-CAT SAKURA-CAT merged commit 9ac2754 into main Feb 25, 2024
@SAKURA-CAT SAKURA-CAT deleted the feat/video-chart branch February 25, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] video class bugs
3 participants