V 1.0.6 - Ae scorer better for detailers

This commit is contained in:
DESKTOP-CNFQ7PM\Primere
2024-12-30 10:06:57 +01:00
parent 76182ab97a
commit 1ce7e2cf32
5 changed files with 22 additions and 20 deletions
+9 -5
View File
@@ -920,7 +920,7 @@ class PrimereAestheticCKPTScorer:
},
}
def aesthetic_scorer(self, image, get_aesthetic_score, add_to_checkpoint, add_to_saved_prompt, prompt, workflow_data = None, **kwargs):
def aesthetic_scorer(self, image, get_aesthetic_score, add_to_checkpoint, add_to_saved_prompt, prompt, dual_mode = True, workflow_data = None, **kwargs):
final_prediction = '*** Aesthetic scorer off ***'
models = []
def pipe(model):
@@ -984,9 +984,13 @@ class PrimereAestheticCKPTScorer:
ae_model_access = os.path.join(AE_MODEL_ROOT, 'cafe_aesthetic')
style_model_access = os.path.join(AE_MODEL_ROOT, 'cafe_style')
if os.path.isdir(ae_model_access) == True and os.path.isdir(style_model_access) == True:
models.append({"pipe": pipe(ae_model_access), "weights": [0.0, 1.0], })
models.append({"pipe": pipe(style_model_access), "weights": [1.0, 0.75, 0.5, 0.0, 0.0], })
if dual_mode == True:
models.append({"pipe": pipe(ae_model_access), "weights": [0.0, 1.0], })
models.append({"pipe": pipe(style_model_access), "weights": [1.0, 0.75, 0.5, 0.0, 0.0], })
final_divider = 2
else:
models.append({"pipe": pipe(ae_model_access), "weights": [0.0, 1.0], })
final_divider = 1
try:
count = 1
pil_images = image.permute(0, 3, 1, 2)
@@ -1007,7 +1011,7 @@ class PrimereAestheticCKPTScorer:
scores[index] += sum(score) / w_sum
scores = sorted(scores.items(), key=lambda k: k[1], reverse=True)[:count]
final_score = ", ".join([f"{v:.3f}" for k, v in scores])
final_prediction = int((float(final_score) * 1000) / 2)
final_prediction = int((float(final_score) * 1000) / final_divider)
except Exception:
final_prediction = '*** Invalid input image ***'
else:
+1 -1
View File
@@ -50,7 +50,7 @@ The main difference between **minimal** and **basic** workflows, that **basic**
- **Half-automatic model concept selector:**
- **Supported concepts:** SD1, SD2, SDXL, SD3, StableCascade, Turbo, Flux, KwaiKolors, Hunyuan, Playground, Pony, LCM, Lightning, Hyper, PixartSigma, Sana (both 1024 and 512)
- Custom (and different) sampler settings for all concepts. The main ide that set sampler nodes only one time (`sampler`, `scheduler`, `step`, `cfg`) then just select model only what will use right sampler setting by `Model concept selector`.
- Custom (and different) sampler settings for all concepts. The main idea is set sampler nodes only one time (`sampler`, `scheduler`, `step`, `cfg`) then just select model only what will use right sampler, vae, clip settings by `Model concept selector`.
- Auto detection of selected model type (if data already stored on external .json file, see longer [manual](Workflow/Manual/nodes/basic_workflow.md))
- Auto **download** and apply Hyper, Lightning, and Turbo speed loras at first usage from here: https://huggingface.co/ByteDance/Hyper-SD/tree/main **check your SSD space before!**
@@ -15,13 +15,13 @@ This node allows you to enrich your prompts with various artistic styles, concep
- Add multiple style elements to positive and negative prompts
- Fine-tune the strength of each style component
- Categories include:
- Art Types (3d-rendering, digital-artwork, drawing, painting, photo, vector-art)
- Concepts
- Artists
- Art Movements
- Colors
- Directions
- Moods
- Art Types (3d-rendering, digital-artwork, drawing, painting, photo, vector-art)
- Concepts
- Artists
- Art Movements
- Colors
- Directions
- Moods
#### Style Controls:
@@ -37,11 +37,6 @@ Each category includes:
- Stack multiple styles with precise control
- Separate positive and negative style applications
#### Node Outputs:
- STYLE+: Enhanced positive prompt
- STYLE-: Enhanced negative prompt
<hr>
### Midjourney styles:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

+5 -2
View File
@@ -1465,8 +1465,11 @@ class DetailerForEach:
ae_model_access = os.path.join(AE_MODEL_ROOT, 'cafe_aesthetic')
style_model_access = os.path.join(AE_MODEL_ROOT, 'cafe_style')
if os.path.isdir(ae_model_access) == True and os.path.isdir(style_model_access) == True:
original_score = int(Outputs.PrimereAestheticCKPTScorer.aesthetic_scorer(None, cropped_image, True, False, None, {})['result'][0])
enhanced_score = int(Outputs.PrimereAestheticCKPTScorer.aesthetic_scorer(None, enhanced_image, True, False, None, {})['result'][0])
try:
original_score = int(Outputs.PrimereAestheticCKPTScorer.aesthetic_scorer(None, cropped_image, True, False, None, {}, False)['result'][0])
enhanced_score = int(Outputs.PrimereAestheticCKPTScorer.aesthetic_scorer(None, enhanced_image, True, False, None, {}, False)['result'][0])
except ImportError:
use_aesthetic_scorer = False
else:
use_aesthetic_scorer = False
else: