update BG_Actor6

This commit is contained in:
liangsen committed 2022-09-01 11:54:15 +08:00
1 parent b6567d5902
commit de75bc60b6
14 files changed
+9497 -94

No files matched your search

@@ -1,7 +1,8 @@
import pathlib
from pathlib2 import Path
import os
import json
import os, sys
sys.path.insert(0, os.getcwd())
@@ -13,19 +14,21 @@ import sys
if __name__ == "__main__":
path_data = Path("/mfs/lsen/DATA/Actor6/bg/processing")
# path_data = Path("/mfs/lsen/DATA/Actor6/bg/processing")
path_data = Path("/mfs/lsen/DATA/Actor6/bg/processing2_0810")
# 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):
if not ipath_data.is_dir(): continue
iname = ipath_data.stem
print("processing {}/{} -> {} ... ".format(i, len(vpath_videos), ipath_data))
ipath_infor = ipath_data.joinpath("video/info.json")
ipath_frame = ipath_data.joinpath("frames")
ipath_json = ipath_data.joinpath("openpose")
ipath_json.mkdir(parents=True, exist_ok=True)
@@ -33,14 +36,25 @@ if __name__ == "__main__":
ipath_vis = ipath_data.joinpath("video", "openpose_vis.avi")
ipath_vis.parent.mkdir(parents=True, exist_ok=True)
# check openpose
with open(str(ipath_infor), "r") as f:
info = json.load(f)
nframe_info = info['nframes']
cmd = "CUDA_VISIBLE_DEVICES=7 \
./build/examples/openpose/openpose.bin \
--image_dir {} \
--write_video {} \
--write_keypoint_json {} \
# check frames
nframe_real = len(list(ipath_json.glob("*.json")))
if nframe_real == nframe_info:
print("\n Skip: have already done!")
continue
cmd = "CUDA_VISIBLE_DEVICES=8 \
./build/examples/openpose/openpose.bin \
--image_dir {} \
--write_video {} \
--write_keypoint_json {} \
--no_display \
--face \
--hand \
".format(str(ipath_frame), str(ipath_vis), str(ipath_json))
print("cmd = {}".format(cmd))