From faeb1fd7b3c1985a9ca8a93548ec66edc0b1ec80 Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 10 Jun 2023 18:36:12 -0300 Subject: [PATCH 1/3] add practical error column --- main.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 83e5abe..3a43999 100644 --- a/main.py +++ b/main.py @@ -472,7 +472,12 @@ def plot2(output_path, normalized_scores, model_scores): def plot3(output_path, normalized_scores, model_scores): - data_for_df = {"model": [], "errors": [], "rating_errors": []} + data_for_df = { + "model": [], + "errors": [], + "rating_errors": [], + "practical_errors": [], + } for model in sorted( normalized_scores.keys(), @@ -488,9 +493,11 @@ def plot3(output_path, normalized_scores, model_scores): for rating in ["general", "sensitive", "questionable", "explicit"] if rating in score_data["incorrect_tags"] ) + practical_absolute_error = total_incorrect_tags - total_rating_errors data_for_df["errors"].append(total_incorrect_tags) data_for_df["rating_errors"].append(total_rating_errors) + data_for_df["practical_errors"].append(practical_absolute_error) data_for_df["model"].append(model) df = pd.DataFrame(data_for_df) @@ -499,6 +506,7 @@ def plot3(output_path, normalized_scores, model_scores): data=[ go.Bar(name="incorrect tags", x=df.model, y=df.errors), go.Bar(name="incorrect ratings", x=df.model, y=df.rating_errors), + go.Bar(name="practical error", x=df.model, y=df.practical_errors), ] ) pio.write_image(fig, output_path, width=1024, height=800) From c21398785972df83a64ae2b5eef5592ee8cfc649 Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 10 Jun 2023 18:36:18 -0300 Subject: [PATCH 2/3] add usage notes to readme --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fe130f0..f15069c 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,33 @@ score formula: then average for all posts +system dependencies: + - python3 + - [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) with the [tagger extension](https://github.com/toriato/stable-diffusion-webui-wd14-tagger) + - [hydrus-dd](https://gitgud.io/koto/hydrus-dd) + ```sh python3 -m venv env env/bin/pip install -Ur ./requirements.txt -env/bin/python3 ./main.py + +# by default, downloads 30 images at page 150 of the default empty query +env/bin/python3 ./main.py download_images + +# gets 40 images at page 150 from tag 'rating:questionable' +# you should add more tags to diversify the dataset before calculating scores +env/bin/python3 ./main.py download_images 'rating:questionable' 40 150 + +# configure interrogators / tagger models +# set sd_webui_address to your stable diffusion webui' address +# set dd_address to hydrus-dd's address +# and set dd_model_name to be something identifiable about the model +# i set it to the md5sum output of my file, to make sure that if the file +# changes back on koto's end, my numbers may be different +cp config.example.json config.json + +# fight mode -- run all interrogators against the dataset you've downloaded +env/bin/python3 ./main.py fight + +# score mode -- crank the final numbers, generates graphs under plots/ folder +env/bin/python3 ./main.py fight ``` \ No newline at end of file From 511ce6af161d5e9d04ce2e2175d4738f68953172 Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 10 Jun 2023 18:37:03 -0300 Subject: [PATCH 3/3] add note about working with larger datasets --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index f15069c..26af782 100644 --- a/README.md +++ b/README.md @@ -41,4 +41,8 @@ env/bin/python3 ./main.py fight # score mode -- crank the final numbers, generates graphs under plots/ folder env/bin/python3 ./main.py fight + +# keep in mind that you can download more images, run fight mode, and then +# run score mode! the commands are aware of work that's been already done and +# will only run the tagger models for the new files ``` \ No newline at end of file