rein0421 commited on
Commit
a98a160
·
verified ·
1 Parent(s): 4bc50cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -85,11 +85,11 @@ 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,
@@ -204,15 +204,16 @@ from datetime import datetime
204
  from PIL import Image
205
  from ultralytics import YOLO
206
 
207
- # オブジェクト選択を動的に行う関数
208
  def decide_to_object(risk_level):
 
209
  tex = [
210
- 'text', 'poster', 'Name tag', 'License plate', 'digital screens',
211
  'signboard', 'sign', 'logo', 'manhole', 'electricity pole', 'cardboard'
212
  ]
213
- risk_level = int(risk_level / 20) * (len(tex) / 5) # 個数決定(1/2)
214
- return tex[:int(risk_level) + 1]
215
-
 
216
 
217
  # マスクを生成する関数
218
  def create_mask(image, x1, y1, x2, y2):
 
85
  'text': 0.1,
86
  'Name tag':0.1,
87
  'License plate': 0.1,
88
+ 'Digital screenss': 0.1,
89
  'signboard': 0.1,
90
  'Documents': 0.1,
91
+ 'information boards': 0.1,
92
+ 'posters': 0.1,
93
  'sign': 0.1,
94
  'Mail or envelope': 0.1,
95
  'logo': 0.1,
 
204
  from PIL import Image
205
  from ultralytics import YOLO
206
 
 
207
  def decide_to_object(risk_level):
208
+ # `tex` の要素を `thresholds` のキーに合わせて書き換え
209
  tex = [
210
+ 'text', 'posters', 'Name tag', 'License plate', 'Digital screenss',
211
  'signboard', 'sign', 'logo', 'manhole', 'electricity pole', 'cardboard'
212
  ]
213
+
214
+ # リスクレベルに応じたオブジェクト数の決定
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):