commit RandomGenerator node, fix TextJoin input to force
This commit is contained in:
@@ -104,6 +104,7 @@ When this error has occurred, please check the network environment.
|
||||
## Update
|
||||
<font size="4">**If the dependency package error after updating, please double clicking ```repair_dependency.bat``` (for Official ComfyUI Protable) or ```repair_dependency_aki.bat``` (for ComfyUI-aki-v1.x) in the plugin folder to reinstall the dependency packages. </font><br />
|
||||
|
||||
* Commit [RandomGenerator](#RandomGenerator) node, Used to generate random numbers within a specified range, with outputs of int, float, and boolean, supporting batch generation of different random numbers by image batch.
|
||||
* Commit [EVF-SAMUltra](#EVFSAMUltra) node, it is implementation of [EVF-SAM](https://github.com/hustvl/EVF-SAM) in ComfyUI. Please download model files from [BaiduNetdisk](https://pan.baidu.com/s/1EvaxgKcCxUpMbYKzLnEx9w?pwd=69bn) or [huggingface/EVF-SAM2](https://huggingface.co/YxZhang/evf-sam2/tree/main), [huggingface/EVF-SAM](https://huggingface.co/YxZhang/evf-sam/tree/main) to ```ComfyUI/models/EVF-SAM``` folder(save the models in their respective subdirectories).
|
||||
Due to the introduction of new dependencies package, after the plugin upgrade, please reinstall the dependency packages.
|
||||
* Commit [ImageTaggerSave](#ImageTaggerSave) and [ImageAutoCropV3](#ImageAutoCropV3) nodes. Used to implement the automatic trimming and marking workflow for the training set (the workflow ```image_tagger_save.json``` is located in the workflow directory).
|
||||
@@ -1278,6 +1279,23 @@ Output a floating-point value with a precision of 5 decimal places.
|
||||

|
||||
Output a boolean value.
|
||||
|
||||
### <a id="table1">RandomGenerator</a>
|
||||
Used to generate random value within a specified range, with outputs of int, float, and boolean. Supports batch and list generation, and supports batch generation of a set of different random number lists based on image batch.
|
||||

|
||||
|
||||
Node Options:
|
||||

|
||||
* image: Optional input, generate a list of random numbers that match the quantity in batches according to the image.
|
||||
* min_value: Minimum value. Random numbers will randomly take values from the minimum to the maximum.
|
||||
* max_value: Maximum value. Random numbers will randomly take values from the minimum to the maximum.
|
||||
* float_decimal_places: Precision of float value.
|
||||
* fix_seed:Is the random number seed fixed. If this option is fixed, the generated random number will always be the same.
|
||||
|
||||
Outputs:
|
||||
int: Integer random number.
|
||||
float: Float random number.
|
||||
bool: Boolean random number.
|
||||
|
||||
### <a id="table1">NumberCalculator</a>
|
||||

|
||||
Performs mathematical operations on two numeric values and outputs integer and floating point results<sup>*</sup>. Supported operations include```+```, ```-```, ```*```, ```/```, ```**```, ```//```, ```%```.
|
||||
|
||||
@@ -105,6 +105,7 @@ git clone https://github.com/chflame163/ComfyUI_LayerStyle.git
|
||||
## 更新说明
|
||||
<font size="4">**如果本插件更新后出现依赖包错误,请双击运行插件目录下的```install_requirements.bat```(官方便携包),或 ```install_requirements_aki.bat```(秋叶整合包) 重新安装依赖包。
|
||||
|
||||
* 添加 [RandomGenerator](#RandomGenerator) 节点,用于生成指定范围内的随机数,有int,float,bool输出,支持按图片批量生成不同的随机数。
|
||||
* 添加 [EVF-SAMUltra](#EVFSAMUltra) 节点,是[EVF-SAM](https://github.com/hustvl/EVF-SAM)在ComfyUI中的实现。请从[百度网盘](https://pan.baidu.com/s/1EvaxgKcCxUpMbYKzLnEx9w?pwd=69bn) 或者 [huggingface/EVF-SAM2](https://huggingface.co/YxZhang/evf-sam2/tree/main), [huggingface/EVF-SAM](https://huggingface.co/YxZhang/evf-sam/tree/main) 下载全部模型文件并复制到```ComfyUI/models/EVF-SAM```文件夹(请将模型保存在各自子目录中)。
|
||||
由于引入了新的依赖,插件升级后请重新安装依赖包。
|
||||
* 添加 [ImageTaggerSave](#ImageTaggerSave) 和 [ImageAutoCropV3](#ImageAutoCropV3) 节点,用于实现训练集自动裁切打标工作流(工作流```image_tagger_save_example.json```在workflow目录中)。
|
||||
@@ -1259,6 +1260,23 @@ box_preview: 裁切位置预览。
|
||||

|
||||
输出一个布尔值。
|
||||
|
||||
### <a id="table1">RandomGenerator</a>
|
||||
用于生成指定范围内的随机数,有int,float,bool输出,支持批量和列表,支持按图片批量生成一组不同的随机数列表。
|
||||

|
||||
|
||||
节点选项说明:
|
||||

|
||||
* image: 可选输入,按照图片批量生成数量相符的随机数列表。
|
||||
* min_value:最小值。随机数将从最小值到最大值之间随机取值。
|
||||
* max_value:最大值。随机数将从最小值到最大值之间随机取值。
|
||||
* float_decimal_places:浮点数精度。
|
||||
* fix_seed:是否固定随机数种子。如果此选项固定,生成的随机数将始终相同。
|
||||
|
||||
输出:
|
||||
int: 整数随机数。
|
||||
float: 浮点数随机数。
|
||||
bool: 布尔随机数。
|
||||
|
||||
### <a id="table1">NumberCalculator</a>
|
||||

|
||||
对两个数值进行数学运算并输出整数和浮点数结果<sup>*</sup>。支持的运算包括```+```、```-```、```*```、```/```、```**```、```//```、```%```。
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
from .imagefunc import AnyType
|
||||
import random
|
||||
|
||||
NODE_NAME = 'RandomGenerator'
|
||||
|
||||
|
||||
class LSRandomGenerator:
|
||||
|
||||
def __init__(self):
|
||||
self.previous_seeds= set({})
|
||||
self.fixed_seed = 0
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(self):
|
||||
|
||||
return {
|
||||
"required": {
|
||||
"min_value": ("FLOAT", {"default": 0, "min": -1.0e14, "max": 1.0e14, "step": 0.01}),
|
||||
"max_value": ("FLOAT", {"default": 10, "min": -1.0e14, "max": 1.0e14, "step": 0.01}),
|
||||
"float_decimal_places": ("INT", {"default": 1, "min": 1, "max": 14, "step": 1}),
|
||||
"fix_seed": ("BOOLEAN", {"default": False}),
|
||||
},
|
||||
"optional": {
|
||||
"image": ("IMAGE", ),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("INT", "FLOAT", "BOOLEAN",)
|
||||
RETURN_NAMES = ("int", "float", "bool",)
|
||||
FUNCTION = 'random_generator'
|
||||
CATEGORY = '😺dzNodes/LayerUtility/Data'
|
||||
|
||||
def random_generator(self, min_value, max_value, float_decimal_places, fix_seed, image=None):
|
||||
batch_size = 1
|
||||
if image is not None:
|
||||
batch_size = image.shape[0]
|
||||
ret_nunbers = []
|
||||
for i in range(batch_size):
|
||||
new_seed = self.generate_unique_seed()
|
||||
if fix_seed:
|
||||
if self.fixed_seed == 0:
|
||||
self.fixed_seed = new_seed
|
||||
seed = self.fixed_seed
|
||||
else:
|
||||
seed = new_seed
|
||||
random.seed(seed)
|
||||
factor = random.uniform(3, 9)
|
||||
random_float = random.uniform(min_value, max_value) / factor
|
||||
random_float = round(random_float * factor, float_decimal_places)
|
||||
random_int = int(random_float)
|
||||
random_bool = random_int %2 == 0
|
||||
ret_nunbers.append((random_int, random_float, random_bool))
|
||||
|
||||
if len(ret_nunbers) > 1:
|
||||
ret_ints = [item[0] for item in ret_nunbers]
|
||||
ret_floats = [item[1] for item in ret_nunbers]
|
||||
ret_bools = [item[2] for item in ret_nunbers]
|
||||
return (ret_ints, ret_floats, ret_bools)
|
||||
else:
|
||||
return (ret_nunbers[0][0], ret_nunbers[0][1], ret_nunbers[0][2])
|
||||
|
||||
def generate_unique_seed(self) -> int:
|
||||
while True:
|
||||
new_number = random.randint(0, 1e14)
|
||||
if new_number not in self.previous_seeds:
|
||||
self.previous_seeds.add(new_number)
|
||||
return new_number
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"LayerUtility: RandomGenerator": LSRandomGenerator
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"LayerUtility: RandomGenerator": "LayerUtility: Random Generator"
|
||||
}
|
||||
+4
-4
@@ -11,13 +11,13 @@ class TextJoin:
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"text_1": ("STRING", {"multiline": False}),
|
||||
"text_1": ("STRING", {"multiline": False,"forceInput":True}),
|
||||
|
||||
},
|
||||
"optional": {
|
||||
"text_2": ("STRING", {"multiline": False}),
|
||||
"text_3": ("STRING", {"multiline": False}),
|
||||
"text_4": ("STRING", {"multiline": False}),
|
||||
"text_2": ("STRING", {"multiline": False,"forceInput":True}),
|
||||
"text_3": ("STRING", {"multiline": False,"forceInput":True}),
|
||||
"text_4": ("STRING", {"multiline": False,"forceInput":True}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "comfyui_layerstyle"
|
||||
description = "A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress."
|
||||
version = "1.0.37"
|
||||
version = "1.0.38"
|
||||
license = "MIT"
|
||||
dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "accelerate", "bitsandbytes", "torchscale", "wandb", "hydra-core", "psd-tools"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user