From a823cd7b60a229b3512682f848eb902a2164bbb8 Mon Sep 17 00:00:00 2001
From: Low <jl02958@aisurrey-condor.surrey.ac.uk>
Date: Fri, 12 Jul 2024 15:07:33 +0100
Subject: [PATCH] Adding Try Catch

---
 predict_multi_video.py | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/predict_multi_video.py b/predict_multi_video.py
index 561ad64..9e0d2f8 100644
--- a/predict_multi_video.py
+++ b/predict_multi_video.py
@@ -340,20 +340,25 @@ if __name__ == "__main__":
     for path in input_video_path:
         path = os.path.join(_parser().video_path, path)
         print("Processing video: ", path)
-        main(_parser().checkpoint_path, 
-            path,
-            _parser().output_dir,
-            _parser().video_start_frame,
-            _parser().video_end_frame,
-            _parser().word_data_json,
-            _parser().num_classes,
-            _parser().num_in_frames,
-            _parser().confidence,
-            _parser().batch_size,
-            _parser().stride,
-            _parser().topk,
-            _parser().resize_res,
-            _parser().datasetname,
-            _parser().include_embds,
-            _parser().include_probs
-        )
+        try:
+            main(_parser().checkpoint_path, 
+                path,
+                _parser().output_dir,
+                _parser().video_start_frame,
+                _parser().video_end_frame,
+                _parser().word_data_json,
+                _parser().num_classes,
+                _parser().num_in_frames,
+                _parser().confidence,
+                _parser().batch_size,
+                _parser().stride,
+                _parser().topk,
+                _parser().resize_res,
+                _parser().datasetname,
+                _parser().include_embds,
+                _parser().include_probs
+            )
+        except Exception as e:
+            print("Error in processing video: ", path)
+            print(e)
+            continue
-- 
GitLab