-
Notifications
You must be signed in to change notification settings - Fork 50
/
main.py
92 lines (80 loc) · 2.81 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
"""
Created on Aug. 12, 2020
@author: Alireza Shamsoshoara
@Project: Aerial image dataset for fire classification, segmentation, and scheduling using
Unmanned Aerial Vehicles (UAVs)
Paper: https://ieeexplore.ieee.org/abstract/document/9381488
Arxiv: https://arxiv.org/pdf/2012.14036.pdf
Dataset: https://ieee-dataport.org/open-access/flame-dataset-aerial-imagery-pile-burn-detection-using-drones-uavs
YouTube Video: https://www.youtube.com/watch?v=bHK6g37_KyA
@Northern Arizona University
This project is developed and tested with Python 3.6 using pycharm on Ubuntu 18.04 LTS machine
"""
#################################
# Main File
#################################
# ############# import libraries
# General Modules
# Customized Modules
from config import Mode
from config import Flags
from config import pathVid_fire
from config import pathFrame_all
from config import pathFrame_resize
from config import pathVid_LakeMary
from config import pathFrame_lakemary
from config import pathFrame_resize_lakemary
from config import pathFrame_test
from config import pathVid_test_Fire
from config import pathVid_test_NoFire
from config import pathFrame_resize_test
from utils import resize
from utils import get_fps
from utils import play_vid
from utils import vid_to_frame
from utils import rename_all_files
from training import train_keras
from classification import classify
from segmentation import segmentation_keras_load
# from plotdata import plot_scheduling
# from scheduling import uav_scheduling
def main():
fps = get_fps(path_vid)
print("Frames per second using video.get(cv2.CAP_PROP_FPS) : {0}".format(fps))
if Flags.get('playVideoFlag'):
play_vid(path_vid)
if Flags.get('SaveRawFrameFlag'):
vid_to_frame(path_vid, mode=Mode)
if Flags.get('ResizeFlag'):
resize(path_load, path_save_resize, mode=Mode)
if __name__ == "__main__":
if Mode == 'Fire':
path_vid = pathVid_fire
path_load = pathFrame_all
path_save_resize = pathFrame_resize
main()
elif Mode == 'Lake_Mary':
path_vid = pathVid_LakeMary
path_load = pathFrame_lakemary
path_save_resize = pathFrame_resize_lakemary
main()
elif Mode == 'Test_Frame':
# path_vid = pathVid_test_Fire
path_vid = pathVid_test_NoFire
path_load = pathFrame_test
path_save_resize = pathFrame_resize_test
main()
elif Mode == 'Training':
train_keras()
elif Mode == 'Classification':
classify()
elif Mode == 'Rename':
rename_all_files(path="Image")
rename_all_files(path="Mask")
elif Mode == 'Segmentation':
segmentation_keras_load()
# elif Mode == 'Scheduling':
# uav_scheduling()
# plot_scheduling()
else:
print("Mode is not correct")