-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e668027
commit cd95a43
Showing
5 changed files
with
146 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ imgutils.detect | |
halfbody | ||
hand | ||
head | ||
nudenet | ||
person | ||
text | ||
visual | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
imgutils.detect.nudenet | ||
========================== | ||
|
||
.. currentmodule:: imgutils.detect.nudenet | ||
|
||
.. automodule:: imgutils.detect.nudenet | ||
|
||
|
||
detect_with_nudenet | ||
------------------------------ | ||
|
||
.. autofunction:: detect_with_nudenet | ||
|
||
|
34 changes: 34 additions & 0 deletions
34
docs/source/api_doc/detect/nudenet_detect_benchmark.plot.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import random | ||
|
||
from benchmark import BaseBenchmark, create_plot_cli | ||
from imgutils.detect import detect_with_nudenet | ||
|
||
|
||
class NudenetDetectBenchmark(BaseBenchmark): | ||
def __init__(self): | ||
BaseBenchmark.__init__(self) | ||
|
||
def load(self): | ||
from imgutils.detect.nudenet import _open_nudenet_yolo, _open_nudenet_nms | ||
_ = _open_nudenet_yolo() | ||
_ = _open_nudenet_nms() | ||
|
||
def unload(self): | ||
from imgutils.detect.nudenet import _open_nudenet_yolo, _open_nudenet_nms | ||
_open_nudenet_yolo.cache_clear() | ||
_open_nudenet_nms.cache_clear() | ||
|
||
def run(self): | ||
image_file = random.choice(self.all_images) | ||
_ = detect_with_nudenet(image_file) | ||
|
||
|
||
if __name__ == '__main__': | ||
create_plot_cli( | ||
[ | ||
('Nudenet', NudenetDetectBenchmark()), | ||
], | ||
title='Benchmark for Anime NudeNet Detections', | ||
run_times=10, | ||
try_times=20, | ||
)() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from imgutils.detect.nudenet import _LABELS, detect_with_nudenet | ||
from imgutils.detect.visual import detection_visualize | ||
from plot import image_plot | ||
|
||
|
||
def _detect(img, **kwargs): | ||
return detection_visualize(img, detect_with_nudenet(img, **kwargs), _LABELS) | ||
|
||
|
||
if __name__ == '__main__': | ||
image_plot( | ||
(_detect('nudenet/nude_girl.png'), 'simple nude'), | ||
(_detect('nudenet/simple_sex.jpg'), 'simple sex'), | ||
(_detect('nudenet/complex_pose.jpg'), 'complex pose'), | ||
(_detect('nudenet/complex_sex.jpg'), 'complex sex'), | ||
columns=2, | ||
figsize=(9, 9), | ||
autonudenet=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters