Skip to content
Snippets Groups Projects
Commit 974a0459 authored by Shivam Khandelwal's avatar Shivam Khandelwal
Browse files

Made random example less random

parent 13b6fd00
No related branches found
No related tags found
No related merge requests found
......@@ -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__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment