PKUWilliamYang commited on
Commit
330ede4
1 Parent(s): 9fa55fe

Update vtoonify_model.py

Browse files
Files changed (1) hide show
  1. vtoonify_model.py +2 -2
vtoonify_model.py CHANGED
@@ -152,7 +152,7 @@ class Model():
152
  message = 'Error: no face detected!'
153
  instyle = torch.zeros(1,18,512).to(self.device)
154
  video_cap = cv2.VideoCapture(video)
155
- num = int(video_cap.get(7))
156
  success, frame = video_cap.read()
157
  frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
158
  frame, instyle, message, w, h, top, bottom, left, right, scale = self.detect_and_align(frame, top, bottom, left, right, True)
@@ -199,7 +199,7 @@ class Model():
199
  if exstyle is None:
200
  exstyle = self.exstyle
201
  video_cap = cv2.VideoCapture(aligned_video)
202
- num = int(video_cap.get(7))
203
  fourcc = cv2.VideoWriter_fourcc(*'mp4v')
204
  videoWriter = cv2.VideoWriter('output.mp4', fourcc,
205
  video_cap.get(5), (int(video_cap.get(3)*4),
 
152
  message = 'Error: no face detected!'
153
  instyle = torch.zeros(1,18,512).to(self.device)
154
  video_cap = cv2.VideoCapture(video)
155
+ num = min(100, int(video_cap.get(7)))
156
  success, frame = video_cap.read()
157
  frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
158
  frame, instyle, message, w, h, top, bottom, left, right, scale = self.detect_and_align(frame, top, bottom, left, right, True)
 
199
  if exstyle is None:
200
  exstyle = self.exstyle
201
  video_cap = cv2.VideoCapture(aligned_video)
202
+ num = min(100, int(video_cap.get(7)))
203
  fourcc = cv2.VideoWriter_fourcc(*'mp4v')
204
  videoWriter = cv2.VideoWriter('output.mp4', fourcc,
205
  video_cap.get(5), (int(video_cap.get(3)*4),