From 974a045914be18fdc6190882f04409f8102d19bd Mon Sep 17 00:00:00 2001
From: Shivam Khandelwal <shivam@aicrowd.com>
Date: Wed, 14 Apr 2021 09:33:25 +0000
Subject: [PATCH] Made random example less random

---
 test.py | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/test.py b/test.py
index 55d9398..4b22304 100644
--- a/test.py
+++ b/test.py
@@ -30,17 +30,28 @@ class RandomPredictor(AirbornePredictor):
     NOTE: In case you want to load your model, please do so in `predict_setup` function.
     """
     def inference(self, flight_id):
+        # In this random example, we are making use of dataset exploration i.e. objects are generally located somewhere near
+        # center range, and similarly for typical range of frames they are visible, etc...
+        class_name = random.choice(["Airplane1", "Helicopter1"])
+        track_id = random.randint(0, 3)
+        bbox = [random.uniform(1300, 1500), random.uniform(1000, 1200), random.uniform(50, 100), random.uniform(50, 100)]
+        
+        initial_empty_frames = random.randint(500, 900)
+        frame_with_airborne_object = random.randint(100, 200)
+        
         for frame_image in self.get_all_frame_images(flight_id):
-            frame_image_path = self.get_frame_image_location(flight_id, frame_image)
-            img = Image.open(frame_image_path)
-            # Do something...
-
-            for i in range(random.randint(-4, 7)):
-                bbox = [random.uniform(1300, 1500), random.uniform(1000, 1200), random.uniform(50, 100),
-                        random.uniform(50, 100)]
+            # frame_image_path = self.get_frame_image_location(flight_id, frame_image)
+            # img = Image.open(frame_image_path)
+            # Do something... (example of loading images for evaluation)
+            
+            initial_empty_frames -= 1
+            if initial_empty_frames > 0:
+                continue
+            
+            frame_with_airborne_object -= 1
+            if frame_with_airborne_object > 0:
                 confidence = random.uniform(0.5, 1)
-                class_name = random.choice(["Airplane1", "Helicopter1"])
-                self.register_object_and_location(class_name, random.randint(0, 3), bbox, confidence, frame_image)
+                self.register_object_and_location(class_name, track_id, bbox, confidence, frame_image)
 
 
 if __name__ == "__main__":
-- 
GitLab