Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
a613039
1
Parent(s):
c95203a
Update app
Browse files- app.py +1 -1
- preprocess/inference_preprocess.py +4 -4
app.py
CHANGED
|
@@ -1389,4 +1389,4 @@ if __name__ == "__main__":
|
|
| 1389 |
outputs=[demo_choice, video_input, global_speaker, num_avg_frames, apply_preprocess, result_text, output_video]
|
| 1390 |
)
|
| 1391 |
# Launch the interface
|
| 1392 |
-
demo.launch(allowed_paths=["."],
|
|
|
|
| 1389 |
outputs=[demo_choice, video_input, global_speaker, num_avg_frames, apply_preprocess, result_text, output_video]
|
| 1390 |
)
|
| 1391 |
# Launch the interface
|
| 1392 |
+
demo.launch(allowed_paths=["."], share=True)
|
preprocess/inference_preprocess.py
CHANGED
|
@@ -48,7 +48,7 @@ def bb_intersection_over_union(boxA, boxB):
|
|
| 48 |
return iou
|
| 49 |
|
| 50 |
def track_shot(opt, scenefaces):
|
| 51 |
-
|
| 52 |
iouThres = 0.5 # Minimum IOU between consecutive face detections
|
| 53 |
tracks = []
|
| 54 |
|
|
@@ -104,7 +104,7 @@ def read_video(o, start_idx):
|
|
| 104 |
return video_stream
|
| 105 |
|
| 106 |
def crop_video(opt, track, cropfile, tight_scale=1):
|
| 107 |
-
|
| 108 |
fourcc = cv2.VideoWriter_fourcc(*'XVID')
|
| 109 |
vOut = cv2.VideoWriter(cropfile + '.avi', fourcc, opt.frame_rate, (480, 270))
|
| 110 |
|
|
@@ -169,7 +169,7 @@ def inference_video(opt, padding=0):
|
|
| 169 |
|
| 170 |
dets = []
|
| 171 |
fidx = 0
|
| 172 |
-
|
| 173 |
while True:
|
| 174 |
success, image = vidObj.read()
|
| 175 |
if not success:
|
|
@@ -203,7 +203,7 @@ def inference_video(opt, padding=0):
|
|
| 203 |
return dets
|
| 204 |
|
| 205 |
def scene_detect(opt):
|
| 206 |
-
|
| 207 |
video_manager = VideoManager([os.path.join(opt.avi_dir, 'video.avi')])
|
| 208 |
stats_manager = StatsManager()
|
| 209 |
scene_manager = SceneManager(stats_manager)
|
|
|
|
| 48 |
return iou
|
| 49 |
|
| 50 |
def track_shot(opt, scenefaces):
|
| 51 |
+
print("Tracking video...")
|
| 52 |
iouThres = 0.5 # Minimum IOU between consecutive face detections
|
| 53 |
tracks = []
|
| 54 |
|
|
|
|
| 104 |
return video_stream
|
| 105 |
|
| 106 |
def crop_video(opt, track, cropfile, tight_scale=1):
|
| 107 |
+
print("Cropping video...")
|
| 108 |
fourcc = cv2.VideoWriter_fourcc(*'XVID')
|
| 109 |
vOut = cv2.VideoWriter(cropfile + '.avi', fourcc, opt.frame_rate, (480, 270))
|
| 110 |
|
|
|
|
| 169 |
|
| 170 |
dets = []
|
| 171 |
fidx = 0
|
| 172 |
+
print("Detecting people in the video using YOLO...")
|
| 173 |
while True:
|
| 174 |
success, image = vidObj.read()
|
| 175 |
if not success:
|
|
|
|
| 203 |
return dets
|
| 204 |
|
| 205 |
def scene_detect(opt):
|
| 206 |
+
print("Detecting scenes in the video...")
|
| 207 |
video_manager = VideoManager([os.path.join(opt.avi_dir, 'video.avi')])
|
| 208 |
stats_manager = StatsManager()
|
| 209 |
scene_manager = SceneManager(stats_manager)
|