add eval.py with metrics
This commit is contained in:
1 parent
11277e478f
commit
baed1fffe3
53 files changed
+5844
-378
No files matched your search
@@ -8,7 +8,7 @@ if __name__ == '__main__':
|
||||
|
||||
# path_root = Path("/yrfs/lsen/DATA/Actor1")
|
||||
|
||||
path_raw = Path("/ssdata1/cf/data/raw/20220311")
|
||||
path_raw = Path("/ssdata1/cf/data/raw/20220319")
|
||||
path_root = Path("/yrfs/lsen/DATA/Actor2")
|
||||
|
||||
vpath_videos = sorted(path_raw.glob("*.MP4"), reverse=False)
|
||||
@@ -23,7 +23,7 @@ if __name__ == '__main__':
|
||||
|
||||
# if i < 40: continue
|
||||
# if iname not in IDs: continue
|
||||
|
||||
|
||||
# data path
|
||||
ipath_data = path_root.joinpath("processing", ipath_item.stem)
|
||||
|
||||
@@ -36,13 +36,19 @@ if __name__ == '__main__':
|
||||
ipath_video.mkdir(parents=True, exist_ok=True)
|
||||
ipath_audio.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# # # load video info
|
||||
# if ipath_infor.exists():
|
||||
# continue
|
||||
# # with open(str(ipath_infor), "r") as f:
|
||||
# # info = json.load(f)
|
||||
# # nframe_info = info['nframes']
|
||||
# # load video info & check
|
||||
if ipath_infor.exists():
|
||||
# continue
|
||||
with open(str(ipath_infor), "r") as f:
|
||||
info = json.load(f)
|
||||
nframe_info = info['nframes']
|
||||
|
||||
# check frames
|
||||
nframe_real = len(list(ipath_frame.glob("*.jpg")))
|
||||
if nframe_real == nframe_info:
|
||||
print(f"\n Skip: have already done!")
|
||||
continue
|
||||
|
||||
# load video
|
||||
video = VideoFileClip(str(ipath_item))
|
||||
print(f"video duration = {video.duration}, fps = {video.fps}, (start, end)=({video.start},{video.end}), nframes={int(video.duration * video.fps)}")
|
||||
@@ -52,8 +58,8 @@ if __name__ == '__main__':
|
||||
continue
|
||||
|
||||
durations += video.duration
|
||||
print(f"\t -> Total durations = ({durations / 60 } min) ({durations / 3600 } h))")
|
||||
continue
|
||||
print(f"\n\t -> Total durations = ({durations / 60 } min) ({durations / 3600 } h))")
|
||||
# continue
|
||||
|
||||
# Trim
|
||||
# video = video.subclip(t_start=5.0, t_end=int(video.duration)-5.0) before 03.14
|
||||
@@ -65,7 +71,6 @@ if __name__ == '__main__':
|
||||
# nframes = len(list(video.iter_frames()))
|
||||
# print(f"after cut video duration = {video.duration}, fps = {video.fps}, (start, end)=({video.start},{video.end}), nframes={int(video.duration * video.fps)}")
|
||||
|
||||
|
||||
# if fps != 50
|
||||
if video.fps != 50:
|
||||
print("FPS NOT = 50!! ")
|
||||
@@ -86,11 +91,6 @@ if __name__ == '__main__':
|
||||
nframes = len(list(video.iter_frames()))
|
||||
|
||||
|
||||
# check frames
|
||||
# nframe_real = len(list(ipath_frame.glob("*.jpg")))
|
||||
# if nframe_real == nframes:
|
||||
# print(f"\n Skip: have already done!")
|
||||
# continue
|
||||
|
||||
# get audio
|
||||
audio_sub = video.audio
|
||||
|
||||
Reference in new issue
Block a user