Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -83,13 +83,13 @@ dangerarray=[10,30,90,50,80,20,40,70,100,60]#ここに各クラスターの危
|
|
| 83 |
|
| 84 |
thresholds = {
|
| 85 |
'text': 0.1,
|
| 86 |
-
'Name tag':0.1,
|
| 87 |
'License plate': 0.1,
|
| 88 |
-
'Digital
|
| 89 |
'signboard': 0.1,
|
| 90 |
-
'
|
| 91 |
-
'information
|
| 92 |
-
'
|
| 93 |
'sign': 0.1,
|
| 94 |
'Mail or envelope': 0.1,
|
| 95 |
'logo': 0.1,
|
|
@@ -207,7 +207,7 @@ from ultralytics import YOLO
|
|
| 207 |
def decide_to_object(risk_level):
|
| 208 |
# `tex` の要素を `thresholds` のキーに合わせて書き換え
|
| 209 |
tex = [
|
| 210 |
-
'text', '
|
| 211 |
'signboard', 'sign', 'logo', 'manhole', 'electricity pole', 'cardboard'
|
| 212 |
]
|
| 213 |
|
|
@@ -215,6 +215,7 @@ def decide_to_object(risk_level):
|
|
| 215 |
num_objects = int(risk_level / 20) * (len(tex) // 5) # 個数決定(1/2)
|
| 216 |
return tex[:int(num_objects) + 1]
|
| 217 |
|
|
|
|
| 218 |
# マスクを生成する関数
|
| 219 |
def create_mask(image, x1, y1, x2, y2):
|
| 220 |
mask = np.zeros((image.shape[0], image.shape[1]), dtype=np.uint8)
|
|
|
|
| 83 |
|
| 84 |
thresholds = {
|
| 85 |
'text': 0.1,
|
| 86 |
+
'Name tag': 0.1,
|
| 87 |
'License plate': 0.1,
|
| 88 |
+
'Digital screens': 0.1,
|
| 89 |
'signboard': 0.1,
|
| 90 |
+
'documents': 0.1,
|
| 91 |
+
'information board': 0.1,
|
| 92 |
+
'poster': 0.1,
|
| 93 |
'sign': 0.1,
|
| 94 |
'Mail or envelope': 0.1,
|
| 95 |
'logo': 0.1,
|
|
|
|
| 207 |
def decide_to_object(risk_level):
|
| 208 |
# `tex` の要素を `thresholds` のキーに合わせて書き換え
|
| 209 |
tex = [
|
| 210 |
+
'text', 'poster', 'Name tag', 'License plate', 'Digital screens',
|
| 211 |
'signboard', 'sign', 'logo', 'manhole', 'electricity pole', 'cardboard'
|
| 212 |
]
|
| 213 |
|
|
|
|
| 215 |
num_objects = int(risk_level / 20) * (len(tex) // 5) # 個数決定(1/2)
|
| 216 |
return tex[:int(num_objects) + 1]
|
| 217 |
|
| 218 |
+
|
| 219 |
# マスクを生成する関数
|
| 220 |
def create_mask(image, x1, y1, x2, y2):
|
| 221 |
mask = np.zeros((image.shape[0], image.shape[1]), dtype=np.uint8)
|