Skip to content

Commit

Permalink
Merge pull request #99 from boostcampaitech3/bug/98
Browse files Browse the repository at this point in the history
[Fix] Resolve non-reproducible result
  • Loading branch information
sooya233 authored Jun 10, 2022
2 parents fe3d4e4 + 7829b3e commit 0a2ffb0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions model/recognition/face_recog.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ def recognize_faces(self):
last_original_frame = last_original_frame[:, :, ::-1]
height, width = last_original_frame.shape[:2]
last_original_frame = last_original_frame[int(height*0.2):, int(width*0.2):int(width*0.8)]
if height > 600:
if height > 800:
last_original_frame = cv2.resize(last_original_frame, None, fx=0.6, fy=0.6)
frames.append(last_original_frame)
frames_real_time.append(frame_num-1)

start_original_frame = start_original_frame[:, :, ::-1]
height, width = start_original_frame.shape[:2]
start_original_frame = start_original_frame[int(height*0.2):, int(width*0.2):int(width*0.8)]
if height > 600:
if height > 800:
start_original_frame = cv2.resize(start_original_frame, None, fx=0.6, fy=0.6)
frames.append(start_original_frame)
frames_real_time.append(frame_num)
Expand Down
5 changes: 4 additions & 1 deletion serving/backend/app/ml/face_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def FaceClustering(video_path: str = "", save_dir:str = ""):
extractor = FaceExtractor(
video_path=video_path,
data_dir=None,
result_dir=save_dir
result_dir=save_dir,
threshold=0.65,
face_cnt=280, # demo 용
skip=60 # demo 용
)

# Extract Faces
Expand Down
4 changes: 2 additions & 2 deletions serving/backend/app/ml/face_recognizer/face_recog.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ def recognize_faces(self):
last_original_frame = last_original_frame[:, :, ::-1]
height, width = last_original_frame.shape[:2]
last_original_frame = last_original_frame[int(height*0.2):, int(width*0.2):int(width*0.8)]
if height > 600:
if height > 800:
last_original_frame = cv2.resize(last_original_frame, None, fx=0.6, fy=0.6)
frames.append(last_original_frame)
frames_real_time.append(frame_num-1)

start_original_frame = start_original_frame[:, :, ::-1]
height, width = start_original_frame.shape[:2]
start_original_frame = start_original_frame[int(height*0.2):, int(width*0.2):int(width*0.8)]
if height > 600:
if height > 800:
start_original_frame = cv2.resize(start_original_frame, None, fx=0.6, fy=0.6)
frames.append(start_original_frame)
frames_real_time.append(frame_num)
Expand Down
4 changes: 2 additions & 2 deletions serving/backend/app/ml/final_shorts/final_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ def make_final_timeline(laughter_timeline,person_timeline,max_length=None):
if length/shot_length > 0.35:
person_interest = (length/shot_length - 0.3)/0.4
total_interest = laugh_len*3 + laugh_db*2 + person_interest*1
final.append((round(start-5,2),end,round(total_interest,2),round(length/shot_length,3), shot_length))
final.append((round(start-5,2),end,round(total_interest,2),round(length/shot_length,3), shot_length+5))
total_length += shot_length
else:
if length/shot_length > 0.30:
person_interest = (length/shot_length - 0.3)/0.4
total_interest = laugh_len*3 + laugh_db*2 + person_interest*1
final.append((round(start-5,2),end,round(total_interest,2),round(length/shot_length,3), shot_length))
final.append((round(start-5,2),end,round(total_interest,2),round(length/shot_length,3), shot_length+5))
total_length += shot_length

# max_length 넘어가는 경우 흥미도 높은 순서로 max_length 이내로 선택
Expand Down

0 comments on commit 0a2ffb0

Please sign in to comment.