-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
49 lines (34 loc) · 1.24 KB
/
Copy pathmain.py
File metadata and controls
49 lines (34 loc) · 1.24 KB
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
import numpy as np
from model import trafficSigns
from objectDetection import objectDetection
model = trafficSigns()
### Loading names ####
model.loadNames('data/signnames.csv')
## Loading trained model ####
model.loadModel('signsmodel')
###### MODEL TRAINING ###########
# model.loadData()
# model.splitData(0.8)
# model.train(12)
# model.evaluate()
# model.showTrainHistoryData("1.png", "2.png")
# model.testImageFromPath('testdata/00007.png')
# model.saveModel("signsmodel")
##################################
detection = objectDetection()
### Detection of colors ###
detection.addLowerRange(np.array([95, 15, 15])) # blue
detection.addUpperRange(np.array([130, 255, 255]))
detection.addLowerRange(np.array([0, 35, 35])) #red
detection.addUpperRange(np.array([10, 255, 255]))
detection.addLowerRange(np.array([170, 35, 35])) #red
detection.addUpperRange(np.array([180, 255, 255]))
detection.addLowerRange(np.array([20, 50, 50])) #yellow
detection.addUpperRange(np.array([30, 255, 255]))
detection.setBoundingBoxPadding(100)
detection.setThreshold(100)
detection.setFontSize(1)
### Sings detection based on picture ###
# detection.fromImage(model, "testdata/1.jpg", 800)
### Sings detection from video capture ###
detection.videoCapture(model, 900)