Skip to content

Commit 45271b6

Browse files
Directory Changes & Improvements
1 parent ed240e3 commit 45271b6

File tree

85 files changed

+2228
-944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2228
-944
lines changed
Binary file not shown.
File renamed without changes.

app/resources/backend/lib/factory.py

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from importlib import import_module
2+
from wires.wire_img import Wire_Read, Wire_Write
3+
4+
5+
def initialize_block(method_name, input_wires, output_wires, parameters, flags):
6+
7+
inputs, outputs = create_connections(input_wires, output_wires)
8+
9+
try:
10+
execute(method_name, inputs, outputs, parameters)
11+
12+
except KeyboardInterrupt:
13+
14+
monitoring_thread.terminate()
15+
16+
for memory in outputs:
17+
memory.release()
18+
19+
exit(0)
20+
21+
def create_connections(input_wires, output_wires):
22+
23+
inputs = []
24+
for wire in input_wires:
25+
inputs.append(Wire_Read(wire))
26+
27+
outputs = []
28+
for wire in output_wires:
29+
outputs.append(Wire_Write(wire))
30+
31+
return inputs, outputs
32+
33+
def execute(method_name, inputs, outputs, parameters):
34+
35+
module, function = method_name.rsplit('.',1)
36+
mod = import_module(module)
37+
method = getattr(mod, function)
38+
method(inputs, outputs, parameters)
39+
40+
41+
File renamed without changes.
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import cv2
2+
import numpy as np
3+
from time import sleep
4+
from utils.wires.wire_img import share_image
5+
from utils.tools.freq_monitor import monitor_frequency
6+
7+
def loop(block_name, input_wires, output_wires, parameters, flags):
8+
9+
ticks = np.array([0])
10+
if flags[0] == 1:
11+
monitor_frequency(block_name, ticks)
12+
13+
cap = cv2.VideoCapture(0)
14+
15+
output_0 = share_image(output_wires[0])
16+
17+
try:
18+
while True:
19+
20+
ticks += 1
21+
ret, frame = cap.read()
22+
output_0.add(frame)
23+
24+
except KeyboardInterrupt:
25+
output_0.release()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import cv2 as cv
2+
import numpy as np
3+
from time import sleep
4+
from utils.wires.wire_img import share_image, read_image
5+
from utils.tools.freq_monitor import monitor_frequency
6+
7+
def loop(block_name, input_wires, output_wires, parameters, flags):
8+
9+
ticks = np.array([0])
10+
if flags[0] == 1:
11+
monitor_frequency(block_name, ticks)
12+
13+
input_0 = read_image(input_wires[0])
14+
output_0 = share_image(output_wires[0])
15+
16+
lower_range = np.array([int(x.strip()) for x in parameters[0].split(',')])
17+
upper_range = np.array([int(x.strip()) for x in parameters[1].split(',')])
18+
19+
while True:
20+
21+
sleep(0.01)
22+
ticks += 1
23+
frame = input_0.get()
24+
25+
if frame is not None:
26+
27+
hsv = cv.cvtColor(frame, cv.COLOR_BGR2HSV)
28+
mask = cv.inRange(hsv, lower_range, upper_range)
29+
filtered = cv.bitwise_and(frame,frame, mask= mask)
30+
31+
output_0.add(filtered)
32+
33+
input_0.release()
34+
output_0.release()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import cv2
2+
import numpy as np
3+
from time import sleep
4+
from utils.wires.wire_img import share_image
5+
from utils.tools.freq_monitor import monitor_frequency
6+
7+
def loop(block_name, input_wires, output_wires, parameters, flags):
8+
9+
ticks = np.array([0])
10+
if flags[0] == 1:
11+
monitor_frequency(block_name, ticks)
12+
13+
image = cv2.imread(parameters[0], 1)
14+
15+
output_0 = share_image(output_wires[0])
16+
17+
try:
18+
while True:
19+
ticks[0] += 1
20+
output_0.add(image)
21+
sleep(0.03)
22+
23+
except KeyboardInterrupt:
24+
pass
25+
26+
shm_w.release()
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import cv2
2+
import numpy as np
3+
from time import sleep
4+
from utils.wires.wire_img import read_image
5+
from utils.tools.freq_monitor import monitor_frequency
6+
7+
def loop(block_name, input_wires, output_wires, parameters, flags):
8+
9+
ticks = np.array([0])
10+
if flags[0] == 1:
11+
monitor_frequency(block_name, ticks)
12+
13+
input_0 = read_image(input_wires[0])
14+
15+
try:
16+
while True:
17+
18+
sleep(0.03)
19+
ticks[0] += 1
20+
img = input_0.get()
21+
if img is not None:
22+
cv2.imshow('Screen', img)
23+
if cv2.waitKey(1) & 0xFF == ord('q'):
24+
break
25+
26+
except KeyboardInterrupt:
27+
input_0.release()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
[net]
2+
# Testing
3+
batch=1
4+
subdivisions=1
5+
# Training
6+
# batch=64
7+
# subdivisions=2
8+
width=416
9+
height=416
10+
channels=3
11+
momentum=0.9
12+
decay=0.0005
13+
angle=0
14+
saturation = 1.5
15+
exposure = 1.5
16+
hue=.1
17+
18+
learning_rate=0.001
19+
burn_in=1000
20+
max_batches = 500200
21+
policy=steps
22+
steps=400000,450000
23+
scales=.1,.1
24+
25+
[convolutional]
26+
batch_normalize=1
27+
filters=16
28+
size=3
29+
stride=1
30+
pad=1
31+
activation=leaky
32+
33+
[maxpool]
34+
size=2
35+
stride=2
36+
37+
[convolutional]
38+
batch_normalize=1
39+
filters=32
40+
size=3
41+
stride=1
42+
pad=1
43+
activation=leaky
44+
45+
[maxpool]
46+
size=2
47+
stride=2
48+
49+
[convolutional]
50+
batch_normalize=1
51+
filters=64
52+
size=3
53+
stride=1
54+
pad=1
55+
activation=leaky
56+
57+
[maxpool]
58+
size=2
59+
stride=2
60+
61+
[convolutional]
62+
batch_normalize=1
63+
filters=128
64+
size=3
65+
stride=1
66+
pad=1
67+
activation=leaky
68+
69+
[maxpool]
70+
size=2
71+
stride=2
72+
73+
[convolutional]
74+
batch_normalize=1
75+
filters=256
76+
size=3
77+
stride=1
78+
pad=1
79+
activation=leaky
80+
81+
[maxpool]
82+
size=2
83+
stride=2
84+
85+
[convolutional]
86+
batch_normalize=1
87+
filters=512
88+
size=3
89+
stride=1
90+
pad=1
91+
activation=leaky
92+
93+
[maxpool]
94+
size=2
95+
stride=1
96+
97+
[convolutional]
98+
batch_normalize=1
99+
filters=1024
100+
size=3
101+
stride=1
102+
pad=1
103+
activation=leaky
104+
105+
###########
106+
107+
[convolutional]
108+
batch_normalize=1
109+
filters=256
110+
size=1
111+
stride=1
112+
pad=1
113+
activation=leaky
114+
115+
[convolutional]
116+
batch_normalize=1
117+
filters=512
118+
size=3
119+
stride=1
120+
pad=1
121+
activation=leaky
122+
123+
[convolutional]
124+
size=1
125+
stride=1
126+
pad=1
127+
filters=255
128+
activation=linear
129+
130+
131+
132+
[yolo]
133+
mask = 3,4,5
134+
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
135+
classes=80
136+
num=6
137+
jitter=.3
138+
ignore_thresh = .7
139+
truth_thresh = 1
140+
random=1
141+
142+
[route]
143+
layers = -4
144+
145+
[convolutional]
146+
batch_normalize=1
147+
filters=128
148+
size=1
149+
stride=1
150+
pad=1
151+
activation=leaky
152+
153+
[upsample]
154+
stride=2
155+
156+
[route]
157+
layers = -1, 8
158+
159+
[convolutional]
160+
batch_normalize=1
161+
filters=256
162+
size=3
163+
stride=1
164+
pad=1
165+
activation=leaky
166+
167+
[convolutional]
168+
size=1
169+
stride=1
170+
pad=1
171+
filters=255
172+
activation=linear
173+
174+
[yolo]
175+
mask = 0,1,2
176+
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
177+
classes=80
178+
num=6
179+
jitter=.3
180+
ignore_thresh = .7
181+
truth_thresh = 1
182+
random=1
Binary file not shown.

0 commit comments

Comments
 (0)