Spaces:
Running
Running
narugo1992
commited on
Commit
·
302fc24
1
Parent(s):
9d84e8d
dev(narugo): add censor detect v0.9
Browse files
app.py
CHANGED
|
@@ -91,7 +91,7 @@ if __name__ == '__main__':
|
|
| 91 |
gr_censor_infer_size = gr.Slider(480, 960, value=640, step=32, label='Max Infer Size')
|
| 92 |
with gr.Row():
|
| 93 |
gr_censor_iou_threshold = gr.Slider(0.0, 1.0, 0.5, label='IOU Threshold')
|
| 94 |
-
gr_censor_score_threshold = gr.Slider(0.0, 1.0, 0.
|
| 95 |
|
| 96 |
gr_censor_submit = gr.Button(value='Submit', variant='primary')
|
| 97 |
|
|
|
|
| 91 |
gr_censor_infer_size = gr.Slider(480, 960, value=640, step=32, label='Max Infer Size')
|
| 92 |
with gr.Row():
|
| 93 |
gr_censor_iou_threshold = gr.Slider(0.0, 1.0, 0.5, label='IOU Threshold')
|
| 94 |
+
gr_censor_score_threshold = gr.Slider(0.0, 1.0, 0.25, label='Score Threshold')
|
| 95 |
|
| 96 |
gr_censor_submit = gr.Button(value='Submit', variant='primary')
|
| 97 |
|
censor.py
CHANGED
|
@@ -9,6 +9,7 @@ from plot import detection_visualize
|
|
| 9 |
from yolo_ import _image_preprocess, _data_postprocess
|
| 10 |
|
| 11 |
_CENSOR_MODELS = [
|
|
|
|
| 12 |
'censor_detect_v0.8_s',
|
| 13 |
'censor_detect_v0.7_s',
|
| 14 |
]
|
|
@@ -27,7 +28,7 @@ _LABELS = ['nipple_f', 'penis', 'pussy']
|
|
| 27 |
|
| 28 |
|
| 29 |
def detect_censors(image: ImageTyping, model_name: str, max_infer_size=640,
|
| 30 |
-
conf_threshold: float = 0.
|
| 31 |
-> List[Tuple[Tuple[int, int, int, int], str, float]]:
|
| 32 |
image = load_image(image, mode='RGB')
|
| 33 |
new_image, old_size, new_size = _image_preprocess(image, max_infer_size)
|
|
@@ -38,6 +39,6 @@ def detect_censors(image: ImageTyping, model_name: str, max_infer_size=640,
|
|
| 38 |
|
| 39 |
|
| 40 |
def _gr_detect_censors(image: ImageTyping, model_name: str, max_infer_size=640,
|
| 41 |
-
conf_threshold: float = 0.
|
| 42 |
ret = detect_censors(image, model_name, max_infer_size, conf_threshold, iou_threshold)
|
| 43 |
return detection_visualize(image, ret, _LABELS)
|
|
|
|
| 9 |
from yolo_ import _image_preprocess, _data_postprocess
|
| 10 |
|
| 11 |
_CENSOR_MODELS = [
|
| 12 |
+
'censor_detect_v0.9_s',
|
| 13 |
'censor_detect_v0.8_s',
|
| 14 |
'censor_detect_v0.7_s',
|
| 15 |
]
|
|
|
|
| 28 |
|
| 29 |
|
| 30 |
def detect_censors(image: ImageTyping, model_name: str, max_infer_size=640,
|
| 31 |
+
conf_threshold: float = 0.25, iou_threshold: float = 0.5) \
|
| 32 |
-> List[Tuple[Tuple[int, int, int, int], str, float]]:
|
| 33 |
image = load_image(image, mode='RGB')
|
| 34 |
new_image, old_size, new_size = _image_preprocess(image, max_infer_size)
|
|
|
|
| 39 |
|
| 40 |
|
| 41 |
def _gr_detect_censors(image: ImageTyping, model_name: str, max_infer_size=640,
|
| 42 |
+
conf_threshold: float = 0.25, iou_threshold: float = 0.5):
|
| 43 |
ret = detect_censors(image, model_name, max_infer_size, conf_threshold, iou_threshold)
|
| 44 |
return detection_visualize(image, ret, _LABELS)
|