-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
39 lines (32 loc) · 1.19 KB
/
run.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
import path_config as config
from organize.final import finalize
from organize.preprocess import rename, preprocess, resize_images
from organize.framediff import difference
from utils.count import do_count
from engine import do_detect
import time
if __name__ == '__main__':
'''
our default set for the raw images is 512x512
default confidence threshold is 0.3
'''
img_size = 512
conf_thred = 0.3
# Use config variables
folder_images = config.folder_images
output_folder = config.output_folder
model_baylos = config.model_baylos
model_yolov7 = config.model_yolov7
# start timer
start_time = time.time()
resize_images(folder_images, img_size)
num_exps = rename(folder_images)
start_folder, end_folder = preprocess(folder_images, output_folder, num_exps)
difference(start_folder, end_folder, output_folder)
do_count(start_folder, model_baylos, output_folder)
diff_images = f'{output_folder}/diff_images'
do_detect(model_yolov7, diff_images, img_size, conf_thred, output_folder)
finalize(output_folder)
# end timer
end_time = time.time()
print(f"\033[1mTotal time taken: {(end_time - start_time)/60:.3f} minutes\033[0m")