Skip to content

Commit 40493ca

Browse files
Updating code to handle non-int registers value
1 parent 1d4e96e commit 40493ca

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

detection/deeplearning.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ def detect(
103103
if label_length == 1:
104104
true_label = atuple[0]
105105
else:
106-
true_label = (int(atuple[0]), int(atuple[1]), int(atuple[2]))
106+
true_label = (
107+
int(round(float(atuple[0]))),
108+
int(round(float(atuple[1]))),
109+
int(round(float(atuple[2]))),
110+
)
107111

108112
# Define LED and IR instance
109113
prepare_gpio()

utils/terminal.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ def prompt_label():
7373
if len(atuple) == 1:
7474
return atuple[0]
7575
else:
76-
return (int(atuple[0]), int(atuple[1]), int(atuple[2]))
76+
return (
77+
int(round(float(atuple[0]))),
78+
int(round(float(atuple[1]))),
79+
int(round(float(atuple[2]))),
80+
)
7781

7882

7983
def prompt_type():

0 commit comments

Comments
 (0)