magnusdtd commited on
Commit
c90da43
·
verified ·
1 Parent(s): 1c0e86a

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. main.py +10 -9
main.py CHANGED
@@ -73,15 +73,16 @@ class TransNetV2Torch:
73
 
74
  predictions = []
75
 
76
- for inp in input_iterator():
77
- single_frame_pred, all_frames_pred = self.predict_raw(inp)
78
- predictions.append((single_frame_pred[0, 25:75, 0],
79
- all_frames_pred[0, 25:75, 0]))
80
-
81
- print("\r[TransNetV2] Processing video frames {}/{}".format(
82
- min(len(predictions) * 50, total), total
83
- ), end="")
84
- print("")
 
85
 
86
  single_frame_pred = np.concatenate([single_ for single_, _ in predictions])
87
  all_frames_pred = np.concatenate([all_ for _, all_ in predictions])
 
73
 
74
  predictions = []
75
 
76
+ with tqdm(total=total, desc="[TransNetV2] Processing video frames", unit="frames") as pbar:
77
+ for inp in input_iterator():
78
+ single_frame_pred, all_frames_pred = self.predict_raw(inp)
79
+ predictions.append((single_frame_pred[0, 25:75, 0],
80
+ all_frames_pred[0, 25:75, 0]))
81
+
82
+ processed = min(len(predictions) * 50, total)
83
+ pbar.n = processed
84
+ pbar.last_print_n = processed
85
+ pbar.refresh()
86
 
87
  single_frame_pred = np.concatenate([single_ for single_, _ in predictions])
88
  all_frames_pred = np.concatenate([all_ for _, all_ in predictions])