From e69954a50717c65f15db23a97081d040b802f316 Mon Sep 17 00:00:00 2001 From: Biuuuuuuuu <14502754+senpai-a@users.noreply.github.com> Date: Fri, 4 Jun 2021 18:43:33 +0800 Subject: [PATCH] fix: fix preprocessing bug 1. Fixed a key error when reading the status of pandas.read_csv. 2. The landmarks path does not correspond to the output dir in the landmark extraction step in README. It's confusing to use beacuse this landmark path is actually a directory containing subfolders for landmarks of every video. In README its never mentioned the landmarks for each video should be in a folder whose name is the video name. Therefore, I changed the rule to find landmarks in extract_facial_regions.py. The user use a single dir to store all videos' landmarks and use this dir in cropping and alignment step. --- preprocessing/extract_facial_regions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/preprocessing/extract_facial_regions.py b/preprocessing/extract_facial_regions.py index 4fa2533..6af7a14 100644 --- a/preprocessing/extract_facial_regions.py +++ b/preprocessing/extract_facial_regions.py @@ -33,8 +33,8 @@ def PatchExtraction(video_path, landmarks_path, output_dir, patch_size=32): break # if count % 6 == 0 and df[' success'][count] == 1: # if df[' success'][count] == 1: - if count % 6 == 0 and len(df[' success']) > count: - if df[' success'][count] == 1: + if count % 6 == 0 and len(df['success']) > count: + if df['success'][count] == 1: frame = frame[:,:,::-1] frames.append(frame) frame_number.append(count) @@ -102,7 +102,7 @@ def PatchExtraction(video_path, landmarks_path, output_dir, patch_size=32): for video in videos: video_path = os.path.join(videos_path, video) video = video.replace('.mp4', '') - csv_path = os.path.join(landmarks_path, video, video + '.csv') + csv_path = os.path.join(landmarks_path, video + '.csv') output_path = os.path.join(output_dir, video) parameters.append([video_path, csv_path, output_path]) pool = multiprocessing.Pool()