wkpark / uddetailer

μ DDetailer, DDetailer fork to support DDetailer as an extension
GNU Affero General Public License v3.0
65 stars 1 forks source link

nsfwrecog_v1 censors too much #76

Open MitPitt opened 8 months ago

MitPitt commented 8 months ago

Besides NSFW, it also detects face and covered parts of the body. Instead, it should be possible to choose which classes are to be censored.

wkpark commented 8 months ago

yes you can select specific obj classes image

MitPitt commented 8 months ago

I can't get classes to show up. brave_3DH5CgjAur

MitPitt commented 8 months ago

When selecting this model I get WARNING ⚠️ Unable to automatically guess model task, assuming 'task=detect'. Explicitly define task for your model, i.e. 'task=detect', 'segment', 'classify','pose' or 'obb'.

wkpark commented 8 months ago

thank you for your reporting I've just found very old mistake.

nsfwrecog_v1.onnx has bug. it has wrong classes information and it needs workaround to get the right classes information.

you can add the following json file in the models/yolo/ dir. make a new nsfwrecog_v1.json file in the dir. uddetailer will automatically load this json info to use it as classes info of the given model.

["EXPOSED ANUS",
"EXPOSED ARMPITS",
"COVERED BELLY",
"EXPOSED BELLY",
"COVERED BUTTOCKS",
"EXPOSED BUTTOCKS",
"FACE F",
"FACE M",
"COVERED FEET",
"EXPOSED FEET",
"COVERED BREAST F",
"EXPOSED BREAST F",
"COVERED GENITALIA F",
"EXPOSED GENITALIA F",
"EXPOSED BREAST M",
"EXPOSED GENITALIA M",
"EXPOSED BACK F",
"EXPOSED BACK M",
"DILDO"]
jgrubs1 commented 7 months ago

Another bug: neither nsfwrecog_v1 nor any other module that works with object classes will restore its configuration, even if it is saved using A1111's Setting > Other > Defaults > View changes > Apply sequence. This sequence saves changes to uddetailer's config into webui/ui-config.json. Most settings are restored, with the exception of object classes.

Here's what appears in the ui-config.json:

"txt2img/Object classes/value": [
   < here goes the correct list of objects >
],

However, after A1111 is restarted, these object classes are not loaded. Moreover, as MitPitt commented last week, object classes do not even appear next to the combo box. One has to select a different detection model, then re-select nsfwrecog_v1 to just make the selection box show up, and then re-select all the object classes.

Suggestion: display object classification list correctly after restart; load object classes on startup.