itechmusic
commited on
Fix fps calculation bug in realtime_inference.py (#35)
Browse files
scripts/realtime_inference.py
CHANGED
|
@@ -205,7 +205,7 @@ class Avatar:
|
|
| 205 |
#combine_frame = get_image(ori_frame,res_frame,bbox)
|
| 206 |
combine_frame = get_image_blending(ori_frame,res_frame,bbox,mask,mask_crop_box)
|
| 207 |
|
| 208 |
-
fps = 1/(time.time()-start)
|
| 209 |
print(f"Generating the {self.idx}-th frame with FPS: {fps:.2f}")
|
| 210 |
cv2.imwrite(f"{self.avatar_path}/tmp/{str(self.idx).zfill(8)}.png",combine_frame)
|
| 211 |
self.idx = self.idx + 1
|
|
@@ -292,4 +292,4 @@ if __name__ == "__main__":
|
|
| 292 |
for audio_num, audio_path in audio_clips.items():
|
| 293 |
print("Inferring using:",audio_path)
|
| 294 |
avatar.inference(audio_path, audio_num, args.fps)
|
| 295 |
-
|
|
|
|
| 205 |
#combine_frame = get_image(ori_frame,res_frame,bbox)
|
| 206 |
combine_frame = get_image_blending(ori_frame,res_frame,bbox,mask,mask_crop_box)
|
| 207 |
|
| 208 |
+
fps = 1/(time.time()-start+1e-6)
|
| 209 |
print(f"Generating the {self.idx}-th frame with FPS: {fps:.2f}")
|
| 210 |
cv2.imwrite(f"{self.avatar_path}/tmp/{str(self.idx).zfill(8)}.png",combine_frame)
|
| 211 |
self.idx = self.idx + 1
|
|
|
|
| 292 |
for audio_num, audio_path in audio_clips.items():
|
| 293 |
print("Inferring using:",audio_path)
|
| 294 |
avatar.inference(audio_path, audio_num, args.fps)
|
| 295 |
+
|