|
@ -35,12 +35,14 @@ class SaveImageCallback(Callback): |
|
|
version = pl_module.trainer.logger.version |
|
|
version = pl_module.trainer.logger.version |
|
|
fname = Path(f"{self.final_dir}") / Path(f"v{version}") |
|
|
fname = Path(f"{self.final_dir}") / Path(f"v{version}") |
|
|
pl_module.eval() |
|
|
pl_module.eval() |
|
|
create_circle(pl_module, fname=fname) |
|
|
create_circle(pl_module, fname=fname, dpi=300, figsize=(6, 6)) |
|
|
if self.save_interval > 0: |
|
|
if self.save_interval > 0: |
|
|
import os |
|
|
import os |
|
|
|
|
|
|
|
|
log_dir = str(Path(pl_module.trainer.logger.log_dir)) |
|
|
log_dir = str(Path(pl_module.trainer.logger.log_dir)) |
|
|
fps = 12 |
|
|
fps = 12 |
|
|
os.system( |
|
|
_cmd = f'ffmpeg -r {fps} -f image2 -i {log_dir}/e%04d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2:color=white" {log_dir}/a{version}.mp4' |
|
|
f'ffmpeg -i {log_dir}/e%04d.png -c:v libx264 -vf "fps={fps},format=yuv420p,pad=ceil(iw/2)*2:ceil(ih/2)*2" {log_dir}/a{version}.mp4' |
|
|
os.system(_cmd) |
|
|
) |
|
|
# os.system( |
|
|
|
|
|
# f'ffmpeg -i {log_dir}/e%04d.png -c:v libx264 -vf "fps={fps},format=yuv420p,pad=ceil(iw/2)*2:ceil(ih/2)*2" {log_dir}/a{version}.mp4' |
|
|
|
|
|
# ) |
|
|