-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.py
40 lines (30 loc) · 975 Bytes
/
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
import os
import cv2
import yaml
from inference import Lanefinder
def read_config():
if not os.path.isfile('config.yaml'):
raise FileNotFoundError('Could not find config file')
with open('config.yaml', 'r') as file:
config = yaml.load(file)
return config
def main():
# set video stream to fullscreen
window_name = 'lanefinder'
cv2.namedWindow(window_name, cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty(window_name, cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
config = read_config()
lanefinder = Lanefinder(
model=config['model'],
input_shape=config['input_shape'],
output_shape=tuple(config['output_shape']),
quant=config['quantization'],
dequant=config['dequantization']
)
# set window name to one with fullscren property
# and run
lanefinder.window = window_name
lanefinder.stream()
lanefinder.destroy()
if __name__ == '__main__':
main()