From 40175f59d13ba1ef1529fe3f80353820889161d9 Mon Sep 17 00:00:00 2001
From: Shivam Khandelwal <skbly7@gmail.com>
Date: Fri, 16 Apr 2021 20:57:00 +0530
Subject: [PATCH] Rebased public facing starter kit with internal version

---
 README.md                          |  5 ++---
 core/metrics                       |  1 +
 docs/DATASET.md                    |  4 ++--
 requirements.txt                   |  4 +++-
 test.py                            | 23 +++++++++++------------
 utility/verify_or_download_data.py | 19 +++++++++++++++++--
 6 files changed, 36 insertions(+), 20 deletions(-)
 create mode 160000 core/metrics

diff --git a/README.md b/README.md
index 1ba44c7..de94573 100644
--- a/README.md
+++ b/README.md
@@ -67,7 +67,7 @@ You can add your SSH Keys to your GitLab account by going to your profile settin
 
 3. **Install** competition specific dependencies!
     ```
-    cd airborne_detection_starter_kit
+    cd airborne-detection-starter-kit
     pip3 install -r requirements.txt
     ```
 
@@ -137,9 +137,8 @@ You need to make sure that your model can predict airborne objects for each flig
 
 ## Local evaluation
 
-You can also test end to end evaluation on your own systems. This step will provide you random scores.
+You can also test end to end evaluation on your own systems. The scripts are available in `core/metrics` folder.
 
-TBA
 
 # 📎 Important links
 
diff --git a/core/metrics b/core/metrics
new file mode 160000
index 0000000..3a3dc7e
--- /dev/null
+++ b/core/metrics
@@ -0,0 +1 @@
+Subproject commit 3a3dc7eb623027d0081fadb7e43eeca3ddd9be8d
diff --git a/docs/DATASET.md b/docs/DATASET.md
index 6f67112..7c5a84a 100644
--- a/docs/DATASET.md
+++ b/docs/DATASET.md
@@ -122,8 +122,8 @@ This library will provide you quick access and download only the files you requi
 ```python
 from core.dataset import Dataset
 dataset = Dataset(local_path='data/part1', s3_path='s3://airborne-obj-detection-challenge-training/part1/')
-dataset.add(local_path='data/part1', s3_path='s3://airborne-obj-detection-challenge-training/part1/')
-dataset.add(local_path='data/part1', s3_path='s3://airborne-obj-detection-challenge-training/part1/')
+dataset.add(local_path='data/part2', s3_path='s3://airborne-obj-detection-challenge-training/part2/')
+dataset.add(local_path='data/part3', s3_path='s3://airborne-obj-detection-challenge-training/part3/')
 ```
 
 NOTE: You don't need to have `groundtruth.json` pre-downloaded, it will automatically download, save and load them for you.
diff --git a/requirements.txt b/requirements.txt
index a6e4e06..d17d22b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -7,4 +7,6 @@ boto3
 opencv-python<4.3
 bounding-box
 numpy
-Pillow
\ No newline at end of file
+Pillow
+imgaug
+core/metrics
diff --git a/test.py b/test.py
index 4b22304..0a0ffad 100644
--- a/test.py
+++ b/test.py
@@ -30,27 +30,26 @@ 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)
+
+        i = random.randint(500, 900)
+        j = 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... (example of loading images for evaluation)
+            # Do something...
             
-            initial_empty_frames -= 1
-            if initial_empty_frames > 0:
+            i -= 1
+            if i > 0:
                 continue
-            
-            frame_with_airborne_object -= 1
-            if frame_with_airborne_object > 0:
-                confidence = random.uniform(0.5, 1)
+
+            j -= 1
+            if j > 0:
+                confidence = random.uniform(0.7, 1)
                 self.register_object_and_location(class_name, track_id, bbox, confidence, frame_image)
 
 
diff --git a/utility/verify_or_download_data.py b/utility/verify_or_download_data.py
index eae74ba..34cdea8 100644
--- a/utility/verify_or_download_data.py
+++ b/utility/verify_or_download_data.py
@@ -1,4 +1,19 @@
-import os
+import os, sys
+sys.path.append(os.path.dirname(os.path.realpath(os.getcwd())))
+sys.path.append(os.path.realpath(os.getcwd()))
+
+from core.dataset import Dataset
 
 if __name__ == "__main__":
-    print("Easy to use download script to be added here!")
+    dataset = Dataset(local_path='data/part1', s3_path='s3://airborne-obj-detection-challenge-training/part1/')
+    dataset.add(local_path='data/part2', s3_path='s3://airborne-obj-detection-challenge-training/part2/')
+    dataset.add(local_path='data/part3', s3_path='s3://airborne-obj-detection-challenge-training/part3/')
+
+    i = 1
+    all_flights = dataset.get_flight_ids()
+    for flight_id in all_flights:
+        print("Downloading Flight#%s (%s/%s)..." % (flight_id, i, len(all_flights)))
+        dataset.get_flight_by_id(flight_id).download()
+        i += 1
+
+    print("Download complete.")
-- 
GitLab