add BG_Actor6 support
This commit is contained in:
1 parent
dd5b0646be
commit
3664438a08
19 files changed
+4089
-52
No files matched your search
@@ -0,0 +1,52 @@
|
||||
|
||||
from pathlib import Path
|
||||
import json
|
||||
import os
|
||||
import moviepy
|
||||
from moviepy.editor import VideoFileClip, AudioFileClip
|
||||
|
||||
import os, sys
|
||||
sys.path.insert(0, os.getcwd())
|
||||
from common.logger import Logger
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# path_raw = Path("/ssdata1/cf/data/raw/actor06/20220517")
|
||||
path_raw = Path("/mfs/lsen/DATA/Actor6/bg/raw-rotaion")
|
||||
path_vis = Path("/mfs/lsen/DATA/Actor6/bg/openpifpaf-vis")
|
||||
path_json = Path("/mfs/lsen/DATA/Actor6/bg/openpifpaf-json")
|
||||
path_vis.mkdir(parents=True, exist_ok=True)
|
||||
path_json.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
|
||||
# get all videos
|
||||
vpath_videos = sorted(path_raw.glob("*.mp4"), reverse=False)
|
||||
print(f"Have {len(vpath_videos)} dir files")
|
||||
|
||||
# for each video
|
||||
for i, ipath_item in enumerate(vpath_videos):
|
||||
iname = ipath_item.stem
|
||||
print(f"processing {i}/{len(vpath_videos)} -> {ipath_item} ... ")
|
||||
|
||||
ipath_vis = path_vis.joinpath(f"{iname}_vis.mp4")
|
||||
ipath_json = path_json.joinpath(f"{iname}_wholepose.json")
|
||||
|
||||
|
||||
cmd = f"CUDA_VISIBLE_DEVICES=9 \
|
||||
python -m openpifpaf.video \
|
||||
--source={ipath_item} \
|
||||
--checkpoint=shufflenetv2k16-wholebody \
|
||||
--long-edge=960 \
|
||||
--batch-size 32 \
|
||||
--video-fps 50 \
|
||||
--line-width 1 \
|
||||
--video-output {ipath_vis} \
|
||||
--json-output {ipath_json} \
|
||||
"
|
||||
print(f"cmd = {cmd}")
|
||||
os.system(cmd)
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
from pathlib2 import Path
|
||||
import os
|
||||
|
||||
import os, sys
|
||||
sys.path.insert(0, os.getcwd())
|
||||
|
||||
import __future__
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
||||
path_data = Path("/mfs/lsen/DATA/Actor6/bg/processing")
|
||||
|
||||
# get all videos
|
||||
vpath_videos = sorted(path_data.glob("*"), reverse=False)
|
||||
print("Have", len(vpath_videos), " dir files")
|
||||
|
||||
|
||||
# for each video
|
||||
for i, ipath_data in enumerate(vpath_videos):
|
||||
iname = ipath_data.stem
|
||||
print("processing {}/{} -> {} ... ".format(i, len(vpath_videos), ipath_data))
|
||||
|
||||
|
||||
ipath_frame = ipath_data.joinpath("frames")
|
||||
ipath_json = ipath_data.joinpath("openpose")
|
||||
ipath_json.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
ipath_vis = ipath_data.joinpath("video", "openpose_vis.avi")
|
||||
ipath_vis.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
cmd = "CUDA_VISIBLE_DEVICES=7 \
|
||||
./build/examples/openpose/openpose.bin \
|
||||
--image_dir {} \
|
||||
--write_video {} \
|
||||
--write_keypoint_json {} \
|
||||
--no_display \
|
||||
--face \
|
||||
".format(str(ipath_frame), str(ipath_vis), str(ipath_json))
|
||||
|
||||
print("cmd = {}".format(cmd))
|
||||
os.system(cmd)
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
from pathlib import Path
|
||||
import json
|
||||
import os
|
||||
import moviepy
|
||||
from moviepy.editor import VideoFileClip, AudioFileClip
|
||||
|
||||
import os, sys
|
||||
sys.path.insert(0, os.getcwd())
|
||||
from common.logger import Logger
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# path_raw = Path("/ssdata1/cf/data/raw/actor06/20220517")
|
||||
path_raw = Path("/ssdata1/cf/data/raw/actor06/bg")
|
||||
path_root = Path("/mfs/lsen/DATA/Actor6/bg/raw-rotaion")
|
||||
path_root.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# get all videos
|
||||
vpath_videos = sorted(path_raw.glob("*.MP4"), reverse=False)
|
||||
print(f"Have {len(vpath_videos)} dir files")
|
||||
|
||||
# for each video
|
||||
for i, ipath_item in enumerate(vpath_videos):
|
||||
iname = ipath_item.stem
|
||||
print(f"processing {i}/{len(vpath_videos)} -> {ipath_item} ... ")
|
||||
|
||||
ipath_rotaion = path_root.joinpath(f"{iname}.mp4")
|
||||
|
||||
cmd = f"ffmpeg -i {str(ipath_item)} -vf 'transpose=1' {str(ipath_rotaion)} "
|
||||
print(f"cmd = {cmd}")
|
||||
os.system(cmd)
|
||||
|
||||
Reference in new issue
Block a user