Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Airborne Object Detection - Starter Kit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vivo_advan
Airborne Object Detection - Starter Kit
Commits
974a0459
Commit
974a0459
authored
3 years ago
by
Shivam Khandelwal
Browse files
Options
Downloads
Patches
Plain Diff
Made random example less random
parent
13b6fd00
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test.py
+20
-9
20 additions, 9 deletions
test.py
with
20 additions
and
9 deletions
test.py
+
20
−
9
View file @
974a0459
...
...
@@ -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__
"
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment